The Apache Logging Services PMC has received the security report
referenced below. After analysis, we classified it as HARDENING: not a
vulnerability, but a defense-in-depth improvement worth making. In the
interest of transparency, and so that the community and other
researchers can benefit from the analysis, we are disclosing a summary
of it.
Report reference (Logging Services PMC / security archive):
https://lists.apache.org/thread/hrbrto3hv695oyh66y8dfpodxf5tr57p
Reporter: 刘春燕 (Liu Chunyan), Fudan University
Disposition: HARDENING -- not a vulnerability; no CVE; tracked in a
public issue
TLP:CLEAR (this message may be redistributed without restriction)
The reporter was informed of this classification and of our intent to
publish this summary.
== Summary of the report ==
`org.apache.logging.log4j.kit.json.JsonReader` in Log4j Kit 3.0.0-beta3
parses nested JSON arrays and objects recursively without a
nesting-depth limit. An application that passes attacker-controlled JSON
to `JsonReader.read(String)` can therefore be made to fail with a
`StackOverflowError`: with a 1 MB thread stack, a document nested 5,000
levels deep is enough. The reporter asked for a CVE.
== PMC assessment ==
This is NOT a vulnerability. `JsonReader` is an internal component of
Log4j, whose only purpose is to parse Log4j's own configuration: JSON
configuration files, the configuration of
`MutableThreadContextMapFilter`, property mappings, and the templates of
JSON Template Layout. These are supplied by the operator and are trusted
input under our threat model; no logged content is ever passed to
`JsonReader`:
https://logging.apache.org/security.html#threat-common-sources-configuration
The same behavior was found by OSS-Fuzz in the Log4j 2 copy of the
parser in September 2024, and was considered expected at the time, for
the same reason:
https://issues.oss-fuzz.com/issues/370272570
As explained in our recent analysis of sonatype-2026-006746, Log4j
contains several internal components, such as a timestamp formatter, a
JSON parser, or a string interpolator, that are public for technical
reasons only. They are not meant to be used by applications and are not
designed to be secure beyond the way Log4j itself uses them:
https://lists.apache.org/thread/l3fntng0b7d6t8xw5yt1r0zynnnpy4tr
Applications that need to parse untrusted JSON should use a library
designed for that purpose, which offers configurable limits on nesting
depth and document size.
== Hardening ==
We nevertheless agree that the parser should fail cleanly. Since Log4j
configuration files are never deeply nested, `JsonReader` will reject
documents above a fixed nesting depth with an
`IllegalArgumentException`, like any other malformed input. In Log4j
3.x, `JsonReader` also moved to `org.apache.logging.log4j.kit.json`, an
exported package of Log4j Kit, which may give the impression that it is
a general-purpose parser; we will document that it is internal and
intended only for trusted input. Both changes are tracked in:
https://github.com/apache/logging-log4j2/issues/4463
== References ==
Threat model:
https://logging.apache.org/security.html
OSS-Fuzz issue 370272570:
https://issues.oss-fuzz.com/issues/370272570
Analysis of sonatype-2026-006746 (internal components):
https://lists.apache.org/thread/l3fntng0b7d6t8xw5yt1r0zynnnpy4tr
Questions and follow-up are welcome on this list or GitHub Discussions.
On behalf of the Apache Logging Services PMC,
Piotr P. Karwasz
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]