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

- Severity: Medium 6.3 (CVSS:4.0, scored by apache) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.91%, higher than 61% of CVEs (2026-12-01)
- Published: 2026-04-10T15:44:17.451Z
- Modified: 2026-10-26T21:10:00.170Z
- Also known as: GHSA-4f7c-pmjv-c25w
- Weaknesses: CWE-116
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: apache

## 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.

(As written by CVE List.)

## Affected

- log4net: before 3.3.0
- log4net (NuGet): before 3.3.0
- apache log4net: before 3.3.0

## Every score

- apache: CVSS:4.0 6.3 Medium `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`
- GitHub: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`
- GitHub: CVSS:4.0 Medium `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`
- NVD: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`

## References

- <https://github.com/apache/logging-log4net/pull/280> (issue-tracking, patch, web)
- <https://logging.apache.org/security.html#CVE-2026-40021> (vendor-advisory, web)
- <https://logging.apache.org/cyclonedx/vdr.xml> (product, vendor-advisory, web)
- <https://logging.apache.org/log4net/manual/configuration/layouts.html> (product, related, web)
- <https://lists.apache.org/thread/q8otftjswhk69n3kxslqg7cobr0x4st7> (mailing-list, vendor-advisory, web)
- <http://www.openwall.com/lists/oss-security/2026/04/10/11> (mailing-list, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-40021> (advisory)
- <https://github.com/apache/logging-log4net> (package)

## Sources

- CVE List: [CVE-2026-40021](https://www.cve.org/CVERecord?id=CVE-2026-40021), CVE Terms of Use, modified 2026-04-10
- GitHub Advisory Database: [GHSA-4f7c-pmjv-c25w](https://github.com/advisories/GHSA-4f7c-pmjv-c25w), CC-BY-4.0, modified 2026-05-05
- NVD: [CVE-2026-40021](https://nvd.nist.gov/vuln/detail/CVE-2026-40021), Public domain, modified 2026-10-26

---

Page: https://cve.day/CVE-2026-40021 · Whole record: https://cve.day/CVE-2026-40021.json · Rebuilt by cve.day 2026-11-25T22:59:18.503Z
