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 containing an attacker-controlled floating-point value.
Users are advised to upgrade to Apache Log4j JSON Template Layout 2.25.4, which corrects this issue.
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
Want to know whenever a new CVE is published for Apache Log4j Layout Template Json? stack.watch will email you.
Affected Versions
Apache Software Foundation Apache Log4j JSON Template Layout:- Version 2.14.0 and below 2.25.4 is affected.
- Version 3.0.0-alpha1, <= 3.0.0-beta3 is affected.
Exploit Probability
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.