# CVE-2026-40021: Apache Log4net log suppression in XmlLayout

Source: https://junglewise.ai/threats/cve-2026-40021-apache-log4net-log-suppression-in-xmllayout  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-04-10. Updated: 2026-05-11  
License: CC BY 4.0 with a link back

CVE-2026-40021 · Severity: medium · CVSS 5.3 · Published 2026-04-10

Apache Log4net fails to sanitize XML-forbidden characters in certain fields, leading to serialization exceptions and silent loss of log events.

Technologies: [Apache Log4net](https://junglewise.ai/threats/technologies/log4net), [log4net (NuGet)](https://junglewise.ai/threats/technologies/nuget-log4net). Vendors: [Apache](https://junglewise.ai/threats/vendors/apache), [NuGet](https://junglewise.ai/threats/vendors/nuget).

## Quick answers

**Is CVE-2026-40021 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-40021 being exploited in the wild.

**How severe is CVE-2026-40021?** Medium severity, with a CVSS score of 5.3, published 10 April 2026.

**Which products and versions are affected?** log4net (NuGet) ECOSYSTEM:introduced=0,fixed=3.3.0.

**Is there a fix for CVE-2026-40021?** Yes. log4net (NuGet): upgrade to 3.3.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**Am I affected by CVE-2026-40021?** Check whether you run Apache Log4net or log4net (NuGet) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- log4net (NuGet): upgrade to 3.3.0 or later

  ```sh
  dotnet add package log4net --version 3.3.0
  ```


## Affected products

- Apache Log4net
- log4net (NuGet) ECOSYSTEM:introduced=0,fixed=3.3.0

## Identifiers

- CVE-2026-40021
- GHSA-4f7c-pmjv-c25w

## References

- [https://api.github.com/users/FreeAndNil](https://api.github.com/users/FreeAndNil)
- [https://github.com/FreeAndNil](https://github.com/FreeAndNil)
- [https://api.github.com/users/FreeAndNil/gists%7B/gist_id%7D](https://api.github.com/users/FreeAndNil/gists%7B/gist_id%7D)
- [https://api.github.com/users/FreeAndNil/repos](https://api.github.com/users/FreeAndNil/repos)
- [https://avatars.githubusercontent.com/u/43271715?v=4](https://avatars.githubusercontent.com/u/43271715?v=4)
- [https://api.github.com/users/FreeAndNil/events%7B/privacy%7D](https://api.github.com/users/FreeAndNil/events%7B/privacy%7D)

## Related threats

- [Apache log4net improper character escaping in RemoteSyslogAppender](https://junglewise.ai/threats/cve-2026-105244-improper-encoding-or-escaping-of-output-vulnerability-in-the)
- [Apache log4net insufficient logging in EventLogAppender](https://junglewise.ai/threats/cve-2026-105243-insufficient-logging-vulnerability-in-the-eventlogappender-of)
- [Apache log4net improper handling of exceptions in aspnet-request pattern converter](https://junglewise.ai/threats/cve-2026-105242-improper-handling-of-exceptional-conditions-vulnerability-in-the)
- [Apache log4net improper Unicode encoding in SmtpPickupDirAppender](https://junglewise.ai/threats/cve-2026-105241-improper-handling-of-unicode-encoding-vulnerability-in-the)
- [Apache log4net null byte handling in OutputDebugStringAppender](https://junglewise.ai/threats/cve-2026-105240-improper-neutralization-of-null-byte-or-nul-character)
