Apache Log4net 3.3.0 Unsanitized XML in XmlLayout Suppresses Logs
CVE-2026-40021 Published on April 10, 2026

Apache Log4net: Silent log event loss in XmlLayout and XmlLayoutSchemaLog4J due to unescaped XML 1.0 forbidden characters
Apache Log4net's XmlLayout https://logging.apache.org/log4net/manual/configuration/layouts.html#layout-list and XmlLayoutSchemaLog4J https://logging.apache.org/log4net/manual/configuration/layouts.html#layout-list , in versions before 3.3.0, fail to sanitize characters forbidden by the XML 1.0 specification https://www.w3.org/TR/xml/#charsets in MDC property keys and values, as well as the identity field that may carry attacker-influenced data. This causes an exception during serialization and the silent loss of the affected log event. An attacker who can influence any of these fields can exploit this to suppress individual log records, impairing audit trails and detection of malicious activity. Users are advised to upgrade to Apache Log4net 3.3.0, which fixes this issue.

Vendor Advisory Vendor Advisory Vendor Advisory NVD

Timeline

Vulnerability reported by f00dat

Fix shared publicly by Jan Friedrich as pull request #280 7 days later.

Log4net 3.3.0 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-40021 has been classified to as an Output Sanitization vulnerability or weakness.


Products Associated with CVE-2026-40021

Want to know whenever a new CVE is published for Apache Log4net? stack.watch will email you.

 

Affected Versions

Apache Software Foundation Apache Log4net:

Exploit Probability

EPSS
0.12%
Percentile
30.90%

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.