Apache Log4j JsonTemplateLayout 2.x: Nonfinite float JSON error (2.25.4)
CVE-2026-34481 Published on April 10, 2026

Apache Log4j JSON Template Layout: Improper serialization of non-finite floating-point values in JsonTemplateLayout
Apache Log4j's JsonTemplateLayout https://logging.apache.org/log4j/2.x/manual/json-template-layout.html , in versions up to and including 2.25.3, produces invalid JSON output when log events contain non-finite floating-point values (NaN, Infinity, or -Infinity), which are prohibited by RFC 8259. This may cause downstream log processing systems to reject or fail to index affected records. An attacker can exploit this issue only if both of the following conditions are met: * The application uses JsonTemplateLayout. * The application logs a MapMessage, or logs an object directly (e.g., via Logger.info(Object), which wraps it in an ObjectMessage), where the message contains an attacker-controlled floating-point value. Users are advised to upgrade to Apache Log4j JSON Template Layout 2.25.4, which corrects this issue. Note: The fix released in version 2.25.4 did not cover all affected code paths. CVE-2026-49844 was assigned to the remaining issue, which concerns the MapMessage.asJson() serialization in Apache Log4j API and is fixed in versions 2.25.5 and 2.26.1.

Vendor Advisory Vendor Advisory Vendor Advisory NVD

Vulnerability Analysis

CVE-2026-34481 can be exploited with network access, and does not require authorization privileges or user interaction. This vulnerability is consided to have a high level of attack complexity. The potential impact of an exploit of this vulnerability is considered to have no impact on confidentiality and integrity and availability.

Attack Vector:
NETWORK
Attack Complexity:
HIGH
Privileges Required:
NONE
User Interaction:
NONE

Timeline

Vulnerability reported by Ap4sh and ethicxz

Candidate patch internally shared by Piotr P. Karwasz 22 days later.

Fix shared publicly by Piotr P. Karwasz as pull request #4080 14 days later.

Fix verified by the reporter 1 day later.

Log4j 2.25.4 released 3 days later.

Weakness Type

What is an Output Sanitization Vulnerability?

The software prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.

CVE-2026-34481 has been classified to as an Output Sanitization vulnerability or weakness.


Products Associated with CVE-2026-34481

You can be notified by email with stack.watch whenever vulnerabilities like CVE-2026-34481 are published in these products:

 
 
 

Affected Versions

Apache Software Foundation Apache Log4j JSON Template Layout:

Exploit Probability

EPSS
0.69%
Percentile
49.06%

EPSS (Exploit Prediction Scoring System) scores estimate the probability that a vulnerability will be exploited in the wild within the next 30 days. The percentile shows you how this score compares to all other vulnerabilities.