Medium severity · published Apr 10, 2026
CVE-2026-40021
Apache Log4net: Silent log event loss in XmlLayout and XmlLayoutSchemaLog4J due to unescaped XML 1.0 forbidden characters
5.3
CVSS
0.8%
EPSS
No
On KEV
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.
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
None
Confidentiality
None
Integrity
Low
Availability
None
Scope
Unchanged
Exploitation
Is it being used?
Exploit prediction (EPSS)0.8% · higher than 55% of CVEs
Exploited in the wildNo evidence yet
CISA KEVNot listed
Ransomware campaign useNot known
Affected products
Which versions
AL
Apache Log4net · Apache Software Foundation
before 3.3.0 · source: vendor
LO
Log4net · Apache
before 3.3.0 · source: NVD
References
NVD
https://nvd.nist.gov/vuln/detail/CVE-2026-40021
CVE.org
https://www.cve.org/CVERecord?id=CVE-2026-40021
Issue Tracking
https://github.com/apache/logging-log4net/pull/280
Mailing List
https://lists.apache.org/thread/q8otftjswhk69n3kxslqg7cobr0x4st7
Product
https://logging.apache.org/cyclonedx/vdr.xml
Product
https://logging.apache.org/log4net/manual/configuration/layouts.html
Vendor Advisory
https://logging.apache.org/security.html#CVE-2026-40021
Mailing List
http://www.openwall.com/lists/oss-security/2026/04/10/11
More from Apache Log4net
9.8
CVE-2018-1285
Apache log4net versions before 2.0.10 do not disable XML external entities when parsing log4net configuration files
5.3
CVE-2026-105244
Apache log4net: RemoteSyslogAppender silently deletes non-ASCII content
5.3
CVE-2026-105243
Apache log4net: Oversize EventLogAppender record silently discarded
5.3
CVE-2026-105242
Apache log4net: Request validation failure drops the event in the aspnet-request converter
5.3
CVE-2026-105241
Apache log4net: Unencodable content discards a whole SmtpPickupDirAppender batch
