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

Published Apr 10, 2026
·
Updated

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.

Affected Software

2 affected components
Apache log4net<3.3.0
Apache log4net<3.3.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade Apache Log4net to a version that resolves this vulnerability.

    Fixed in 3.3.0

Event History

Apr 10, 2026
CVE Published
via MITRE·03:44 PM
Data Sourced
via MITRE·03:44 PM
DescriptionWeakness
Data Sourced
via NVD·04:16 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-40021?

The CVE-2026-40021 vulnerability is classified as a medium severity issue due to silent log event loss.

2

How do I fix CVE-2026-40021?

To address CVE-2026-40021, upgrade Apache Log4net to version 3.3.0 or later.

3

What are the potential impacts of CVE-2026-40021?

CVE-2026-40021 can lead to the loss of critical log events if unescaped XML characters are present.

4

Which versions of Apache Log4net are affected by CVE-2026-40021?

Apache Log4net versions prior to 3.3.0 are affected by CVE-2026-40021.

5

What components of Log4net are impacted by CVE-2026-40021?

CVE-2026-40021 specifically impacts the XmlLayout and XmlLayoutSchemaLog4J components.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203