Skip to content

[Sec] log4j: Improper serialization of non-finite floating-point values in JsonTemplateLayout #CVE-2026-34481 #25853

@wirror800

Description

@wirror800

Search before reporting

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

User environment

Broker version: 4.2.1

Issue Description

Apache Log4j’s JsonTemplateLayout, 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.

Remediation
Users are advised to upgrade to Apache Log4j JSON Template Layout version 2.25.4, which corrects this issue.

Error messages


Reproducing the issue

upgrade to Apache Log4j JSON Template Layout version 2.25.4

Additional information

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugThe PR fixed a bug or issue reported a bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions