Apache Log4net: Silent log event loss in XmlLayout and XmlLayoutSchemaLog4J due to unescaped XML 1.0 forbidden characters
CVE-2026-40021Published 10 Apr 2026, 15:44 UTC
Real-world risk
1.1/ 10Low
Routine
PreliminaryFrom the CVSS vector only · confidence low
CVSS
6.3
scored by the vendor (CNA), CVSS 4.0
In plain words
No plain-language summary yet. The original description is below.
Original description (from apache)
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.
Am I affected?
| Product | Affected versions (from the sources) | Fixed in |
|---|---|---|
| Apache log4netNiche | < 3.3.0 | 3.3.0 |
What to do
Update to a fixed version: 3.3.0.
Why this score
| Factor | Value | Evidence | × |
|---|---|---|---|
| Impact | MinorReflected XSS, CSRF with low effect, open redirect, minor leak | From the CVSS vector | 0.30 |
| Attacker position | InternetAnyone on the Internet can reach a typical deployment | From the CVSS vector | 1.00 |
| Privileges needed | NoneNo account | From the CVSS vector | 1.00 |
| Victim interaction | NoneNothing | From the CVSS vector | 1.00 |
| Configuration | DefaultOut-of-the-box installs are vulnerable | From the CVSS vector | 1.00 |
| Reliability | HardNarrow race, needs an extra info leak, needs a man-in-the-middle position, or must be chained with another bug | From the CVSS vector | 0.45 |
Threat level T1: Nothing known (× 0.85)
The default for a new disclosure
EPSS 0.9% chance of exploitation in 30 days (percentile 61), as of 2026-12-04.
The arithmetic
- Prerequisites multiplied together0.450
- Threat T1: Nothing known0.850
- 10 × impact 0.3 × prerequisites 0.45 × threat 0.851.147
- Rounded to one decimal between 0.1 and 101.1
Exploitation and evidence timeline
- 10 Apr 2026 Published
- 3 Dec 2026 Risk 1.1 (cvss fallback)
Weakness
CWE-116
References
- https://github.com/apache/logging-log4net/pull/280patch
- https://logging.apache.org/security.html#CVE-2026-40021vendor-advisory
- https://logging.apache.org/cyclonedx/vdr.xmlvendor-advisory
- https://logging.apache.org/log4net/manual/configuration/layouts.htmlrelated
- https://lists.apache.org/thread/q8otftjswhk69n3kxslqg7cobr0x4st7vendor-advisory
- http://www.openwall.com/lists/oss-security/2026/04/10/11
- CVE-2026-40021 on CVE.org