CVE-2026-40021: Apache Log4net · Improper Encoding or Escaping of Output
Affects Apache Log4netSource CVE Database V5
Not known to be exploited · CVSS 6.3 Medium : upgrade to 3.3.0 when convenient.
Data as of 30 Oct 2026, 06:59 UTC
- EPSS
- 0.7% chance of exploitation in 30 days – higher than 55% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
- Patch
- Available – fixed in 3.3.0
CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:L/SA:NExploitation evidence
Disclosed: evidence found.
CVE published 10 Apr 2026
Detectable: no evidence on record.
No public nuclei template indexed
Weaponized: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 29 Oct 2026.
What to do
Upgrade Apache Log4net and log4net to 3.3.0.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| Apache Software FoundationApache Log4net | Affected
| Fixed in
|
NuGetlog4netpkg:nuget/log4netOther threats | Affected
| Fixed in
|
NuGetlog4netpkg:nuget/log4netOther threats | Affected
| Fixed in
|
CPE configurations (1)
cpe:2.3:a:apache:log4net:*:*:*:*:*:*:*:*
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
Users should upgrade to Apache Log4net version 3.3.0, which fixes this issue by properly sanitizing forbidden XML characters. No other mitigation or temporary workaround is indicated. Patch status is not explicitly stated but the vendor advises upgrading to 3.3.0 as the fix.
Description
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.
References
- github.com/apache/logging-log4net/pull/280 (opens in a new tab)
- logging.apache.org/security.html (opens in a new tab)
- logging.apache.org/cyclonedx/vdr.xml (opens in a new tab)
- logging.apache.org/log4net/manual/configuration/layouts.html (opens in a new tab)
- lists.apache.org/thread/q8otftjswhk69n3kxslqg7cobr0x4st7 (opens in a new tab)
- openwall.com/lists/oss-security/2026/04/10/11 (opens in a new tab)