# CVE-2026-40021: Apache Log4net: Silent log event loss in XmlLayout and XmlLayoutSchemaLog4J due to unescaped XML 1.0 forbidden characters

- Priority: **Routine**
- Reason: Not severe (CVSS 6.3, network access); no exploitation reported by the 5 checked sources
- Next step: Fix in the normal cadence
- Status: published
- Published: 2026-04-10 · Modified: 2026-04-10
- Aliases: UBUNTU-CVE-2026-40021, DEBIAN-CVE-2026-40021, GHSA-4f7c-pmjv-c25w
- Record: https://cvemate.com/vulnerability/CVE-2026-40021 · JSON: https://cvemate.com/vulnerability/CVE-2026-40021/json

## Description

```text
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.
```

## Signals

- CVSS: 6.3 medium (v4.0, CVE.org) CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:L/SA:N
- EPSS: 0.913%, percentile 61.303%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 0

## Affected

- apache software foundation apache log4net: \< 3.3.0
- apache log4net: \< 3.3.0
- debian log4net (Debian): All versions (No fix recorded) \| \< 1.2.10+dfsg-10
- ubuntu log4net (Ubuntu): All versions (No fix recorded)
- NuGet log4net (NuGet): \< 3.3.0

## References

- <https://github.com/apache/logging-log4net/pull/280>
- <https://logging.apache.org/security.html#CVE-2026-40021>
- <https://logging.apache.org/cyclonedx/vdr.xml>
- <https://logging.apache.org/log4net/manual/configuration/layouts.html>
- <https://lists.apache.org/thread/q8otftjswhk69n3kxslqg7cobr0x4st7>
- <http://www.openwall.com/lists/oss-security/2026/04/10/11>
- <https://ubuntu.com/security/CVE-2026-40021>
- <https://www.cve.org/CVERecord?id=CVE-2026-40021>
- <https://security-tracker.debian.org/tracker/CVE-2026-40021>
- <https://nvd.nist.gov/vuln/detail/CVE-2026-40021>
- <https://github.com/apache/logging-log4net>

---

Data as of 2026-12-05T06:34:25.490Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
