Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-105239 Overview
CVE-2026-105239 is an improper neutralization of NUL character vulnerability [CWE-158] in the EventLogAppender of Apache log4net. When a logged message contains a NUL byte, the Windows ReportEventW API treats it as a string terminator and truncates the Event Log record at that offset. Any content the layout renders after the NUL, including exception text and trailing fields, is silently discarded. A party whose data reaches a log message can exploit this to hide the remainder of that record. The flaw affects Apache log4net from version 1.2.9 before 3.5.0, and only applications running on Windows that use EventLogAppender.
Critical Impact
Attackers who control any portion of logged input can truncate Windows Event Log entries, suppressing exception details and audit fields relied on by detection and forensics workflows.
Affected Products
- Apache log4net 1.2.9 through 3.4.x on Windows
- Applications using EventLogAppender to write to the Windows Event Log
- .NET applications that log attacker-influenced data via log4net on Windows
Discovery Timeline
- 2026-10-06 - CVE-2026-105239 published to the National Vulnerability Database (NVD)
- 2026-10-07 - Public discussion on the OpenWall oss-security list and Apache mailing list
- 2026-10-07 - Last updated in NVD database
Technical Details for CVE-2026-105239
Vulnerability Analysis
The EventLogAppender class in log4net passes layout-rendered strings to the Win32 ReportEventW function. ReportEventW expects null-terminated wide strings and stops reading at the first NUL character. log4net did not escape or neutralize NUL characters before handing the buffer to the API, so any \0 embedded in a message boundary-terminated the record early.
The commit message documents measured behavior: a 45 character message with a NUL at position 23 was stored as a 23 character prefix, with the remaining 22 characters silently dropped. WriteEntry does not raise an exception when this occurs, so neither the application nor the appender detects the truncation. The practical consequence is a log integrity issue affecting completeness, which maps to the integrity-only impact in the CVSS vector.
Root Cause
The root cause is missing neutralization of control characters at the appender boundary, specifically CWE-158 (Improper Neutralization of Null Byte or NUL Character). log4net trusted the input string to be free of embedded NUL bytes and relied on the Windows event logging API to persist the full payload. Because ReportEventW operates on C-style null-terminated strings, the first NUL byte dictates where the stored record ends regardless of the declared string length in managed code.
Attack Vector
An attacker needs only to influence a value that eventually reaches a log statement rendered by EventLogAppender. Common vectors include HTTP headers, request parameters, usernames, filenames, and other fields reflected into application logs. Inserting a NUL byte (\0 or %00 when URL-decoded) before the sensitive portion of the message truncates the Event Log entry, suppressing exception stack traces, correlation IDs, or additional context an analyst would rely on during triage.
+<?xml version="1.0" encoding="UTF-8"?>
+<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="https://logging.apache.org/xml/ns"
+ xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
+ type="fixed">
+ <issue id="315" link="https://github.com/apache/logging-log4net/pull/315"/>
+ <description format="asciidoc">
+ escape NUL characters in `EventLogAppender` content. `ReportEventW` takes a null terminated
+ string, so a NUL in logged content ended the stored record there and silently dropped whatever
+ the layout rendered after it, exception text and trailing fields included (CWE-158). `WriteEntry`
+ raises nothing, so the record simply stored short. Measured on Windows 11 build 26200: of a 45
+ character message with a NUL at 23, the 23 character prefix was stored and the rest was gone
+ (audit da18b6fd-f007)
+ </description>
+</entry>
Source: Apache log4net commit dc5855a
Detection Methods for CVE-2026-105239
Indicators of Compromise
- Windows Event Log records produced by a log4net source that terminate mid-message without the trailing fields defined by the application's layout pattern.
- Application-side logs showing an exception was raised while the corresponding EventLogAppender entry lacks the exception block.
- Inbound requests containing %00 or raw \\x00 bytes in parameters that are known to be logged.
Detection Strategies
- Audit log4net configuration files (log4net.config, App.config) for EventLogAppender entries and inventory applications on versions earlier than 3.5.0.
- Compare message lengths between EventLogAppender output and parallel file-based appenders to flag records that were truncated only in the Windows Event Log.
- Hunt for user-controlled input containing NUL bytes in web server, WAF, and reverse proxy logs preceding affected application calls.
Monitoring Recommendations
- Forward Windows Event Logs and application logs into a centralized data lake to enable cross-source correlation of truncated records.
- Alert on Event Log entries whose rendered body is shorter than the configured layout pattern baseline.
- Track installed versions of log4net.dll across the Windows estate to confirm patch coverage.
How to Mitigate CVE-2026-105239
Immediate Actions Required
- Upgrade Apache log4net to version 3.5.0 or later on all Windows hosts that use EventLogAppender.
- Inventory .NET applications shipping older log4net.dll assemblies and prioritize those that log attacker-controlled input.
- Validate that upstream input handling strips or encodes NUL bytes before data reaches logging calls.
Patch Information
The fix is tracked in Apache log4net pull request #315 and merged in commit dc5855a. The patch escapes NUL characters in EventLogAppender content before passing them to ReportEventW, preserving the full rendered message in the stored Event Log record. Users should upgrade to Apache log4net 3.5.0. Additional context is available in the Apache mailing list announcement and the OpenWall oss-security discussion.
Workarounds
- Switch to a non-affected appender such as RollingFileAppender or EventLogAppender wrapped by a custom layout that replaces \0 with a visible token until the upgrade is deployed.
- Add a sanitizing PatternLayout converter or IRawLayout wrapper that strips or replaces NUL characters in rendered messages.
- Enforce input validation at application entry points to reject or encode NUL bytes in fields that will be logged.
# Example NuGet upgrade command for the fixed release
dotnet add package log4net --version 3.5.0
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

