Skip to main content

Apache Log4Net CVE-2026-40021

| EUVDEUVD-2026-21488 MEDIUM
Improper Encoding or Escaping of Output (CWE-116)
2026-04-10 apache GHSA-4f7c-pmjv-c25w
6.3
CVSS 4.0 · Vendor: apache
View

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding for downstream
Impact

This vulnerability presents a low-to-moderate real-world risk despite a CVSS 6.3 score. The attack vector is network-accessible (AV:N), but attack complexity is high (AC:H), indicating exploitation requires specific preconditions or extensive attacker influence over log inputs. The impact is limited to integrity of the logging system itself (SI:L-silent loss of information) with no confidentiality, availability, or system compromise. EPSS or KEV status was not provided in the input; however, the exploitation requirement is narrow: an attacker must both gain the ability to inject characters into MDC or identity fields AND the application must be configured to use XmlLayout or XmlLayoutSchemaLog4J. Organizations using JSON, CSV, or plain text layouts are unaffected. The real risk lies in scenarios where log tampering is a threat model (e.g., highly regulated environments, incident response chains of custody) rather than as a direct attack vector on application availability or confidentiality.

Exploit ScenarioDerived

An attacker with the ability to influence application-level context data (such as user identifiers, session data, or request parameters that populate MDC) injects a character forbidden by XML 1.0 (e.g., a control character). When the application logs this event using XmlLayout, serialization fails silently and the log entry is dropped entirely, allowing the attacker to obscure their activity from audit logs without triggering visible errors or alerts. For example, a web application that logs user actions via MDC could be exploited by an authenticated user injecting a null byte or other control character into a request parameter, causing subsequent log records for that session to vanish from the audit trail. No public proof-of-concept code has been identified, and the attack requires deliberate configuration of XML layouts combined with attacker control over log input sources.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Apr 10, 2026

Apache Log4net versions before 3.3.0 fail to sanitize XML 1.0-forbidden characters in MDC property keys and values, as well as identity fields, causing serialization exceptions that silently drop log events when XmlLayout or XmlLayoutSchemaLog4J are in use. An attacker who can influence these fields can suppress individual audit log records, impairing detection of malicious activity. No public exploit code or active exploitation has been confirmed; patch is available from the vendor.

RemediationAI

Vendor-released patch: Apache Log4net 3.3.0. Upgrade to version 3.3.0 or later immediately to receive the fix for improper character sanitization in XML serialization. For organizations unable to upgrade immediately, review logging configuration to determine if XmlLayout or XmlLayoutSchemaLog4J are in active use; if not required, disable these layout types and use alternative serialization formats (JSON, CSV, or plain text). Ensure input sources for MDC properties and identity fields are validated or restricted to prevent injection of XML-forbidden characters. Refer to the vendor advisory at https://logging.apache.org/security.html#CVE-2026-40021 and the upstream fix (GitHub PR #280) for additional context.

Affected VersionsENISA

Apache log4net 0 <3.3.0

Affected Packages

nuget log4net fix: 3.3.0
euvd apache_log4net fix: 3.3.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in nuget, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Apache Log4net is a .NET-based logging framework that provides structured logging output in multiple formats, including XML. The XmlLayout and XmlLayoutSchemaLog4J serializers convert log events to XML but do not validate or escape characters that violate the XML 1.0 specification (defined at https://www.w3.org/TR/xml/#charsets). The vulnerability stems from incomplete input sanitization (CWE-116: Improper Encoding or Escaping of Output) in the handling of Mapped Diagnostic Context (MDC) properties and identity fields, which may be populated from user-controlled or attacker-influenced sources. When a forbidden character is encountered during serialization, the exception causes the entire log event to be silently dropped rather than being safely encoded or rejected.

Know when Apache Log4Net gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (apache) PRIMARY 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
SUSE 3.7 LOW
AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N
Red Hat 5.3 MEDIUM

Primary rating from Vendor (apache).

CVSS VectorVendor: apache

Attack Vector
Network
Attack Complexity
High
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
None
Subsequent system: Confidentiality
None
Subsequent system: Integrity
Low
Subsequent system: Availability
None

Lifecycle Timeline

2
Patch released
Apr 10, 2026 - 16:00 nvd
Patch available
CVE Published
Apr 10, 2026 - 15:44 nvd
MEDIUM 6.3

DescriptionCVE.org

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.

Threat Intelligence Overview

EPSS Score
0.1%
Top 69% exploitable
Data Quality
8 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

32
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +32
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

Related Vulnerabilities in Apache Log4net and Log4cxx XML Layout Injection

View all 2

Vendor StatusVendor

SUSE

Severity: Low

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy