CVE-2026-40023
Received Received - Intake
XML Injection in Apache Log4cxx XMLLayout Causes Log Suppression

Publication date: 2026-04-10

Last updated on: 2026-04-21

Assigner: Apache Software Foundation

Description
Apache Log4cxx's XMLLayout https://logging.apache.org/log4cxx/1.7.0/classlog4cxx_1_1xml_1_1XMLLayout.html , in versions before 1.7.0, fails to sanitize characters forbidden by the XML 1.0 specification https://www.w3.org/TR/xml/#charsets in log messages, NDC, and MDC property keys and values, producing invalid XML output. Conforming XML parsers must reject such documents with a fatal error, which may cause downstream log processing systems to drop or fail to index affected records. An attacker who can influence logged data can exploit this to suppress individual log records, impairing audit trails and detection of malicious activity. Users are advised to upgrade to Apache Log4cxx 1.7.0, which fixes this issue.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-04-10
Last Modified
2026-04-21
Generated
2026-05-07
AI Q&A
2026-04-10
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 1 associated CPE
Vendor Product Version / Range
apache log4cxx to 1.7.0 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-116 The product 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.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

The vulnerability in Apache Log4cxx's XMLLayout, before version 1.7.0, is due to the failure to sanitize characters that are forbidden by the XML 1.0 specification in log messages, NDC, and MDC property keys and values. This results in invalid XML output.

Because conforming XML parsers must reject such invalid XML documents with a fatal error, downstream log processing systems may drop or fail to index affected log records.

An attacker who can influence the logged data can exploit this vulnerability to suppress individual log records, which impairs audit trails and the detection of malicious activity.

The issue was fixed in Apache Log4cxx version 1.7.0 by sanitizing illegal characters to ensure valid XML output.


How can this vulnerability impact me? :

This vulnerability can impact you by causing your logging system to produce invalid XML output, which conforming XML parsers will reject with fatal errors.

As a result, downstream log processing systems may drop or fail to index affected log records, leading to incomplete or missing logs.

If an attacker can influence the logged data, they can exploit this to suppress specific log entries, impairing audit trails and making it harder to detect malicious activity.


How can this vulnerability be detected on my network or system? Can you suggest some commands?

This vulnerability involves Apache Log4cxx versions before 1.7.0 producing invalid XML output due to unsanitized forbidden XML characters in log messages, NDC, and MDC property keys and values.

To detect this vulnerability on your system, you can inspect log files generated by Log4cxx for malformed XML entries or fatal XML parsing errors in downstream log processing systems.

Commands to help detect the issue might include searching logs for invalid XML characters or parsing errors. For example, you could use grep or xmllint to identify problematic log entries:

  • Use grep to find control or forbidden XML characters in log files: grep -P '[\x00-\x08\x0B\x0C\x0E-\x1F]' /path/to/logfile
  • Use xmllint to validate XML log files and detect fatal errors: xmllint --noout /path/to/logfile.xml

Note that the logs may not be complete XML files but fragments embedded in larger XML documents, so validation might require extracting or reconstructing the full XML context.


What immediate steps should I take to mitigate this vulnerability?

The primary mitigation step is to upgrade Apache Log4cxx to version 1.7.0 or later, where this issue has been fixed by sanitizing illegal XML characters in log output.

The fix involves replacing control characters in XML and HTML output with appropriate character references, ensuring well-formed XML logs and preventing parsing errors.

Until you can upgrade, consider implementing input validation or sanitization on data that is logged to prevent forbidden XML characters from being included.

Also, monitor your log processing systems for errors or dropped records that may indicate exploitation of this vulnerability.


How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

This vulnerability allows an attacker who can influence logged data to suppress individual log records by causing invalid XML output that conforming XML parsers reject with fatal errors. This suppression can impair audit trails and hinder detection of malicious activity.

Since audit trails are critical for compliance with common standards and regulations such as GDPR and HIPAA, which require accurate and complete logging for security monitoring and forensic analysis, this vulnerability can negatively impact compliance by enabling loss or omission of log records.

Therefore, failure to sanitize forbidden XML characters in logs may lead to incomplete or missing logs, undermining the integrity and reliability of audit logs required by these regulations.

Users are advised to upgrade to Apache Log4cxx 1.7.0, which fixes this issue by properly escaping forbidden XML characters, thereby helping maintain compliant and reliable logging.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart