/

CVE-2026-34478

Severity:

HIGH RISK

(7.5)

Log Injection and Improper Output Handling in Apache Log4j

CVE-2026-34478

Analyzed

Vulnerability type

Category:

Log Injection and Improper Output Handling

CWE:

CWE-117, CWE-684

Impact:

Log Injection and Log Integrity Compromise

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Apache Log4j Core's Rfc5424Layout in versions 2.21.0 through 2.25.3 can allow log injection when CRLF sequences are not properly escaped due to silently renamed configuration attributes.

Deployments using Rfc5424Layout directly with stream-based syslog (TCP or TLS) may emit unframed or unescaped log messages, enabling attackers to inject forged log entries or manipulate log structure if they can influence logged data.

Affected context

This vulnerability occurs in applications using Apache Log4j Core 2.21.0–2.25.3 that:

  • Configure Rfc5424Layout directly for stream-based syslog logging, and
  • Rely on configuration attributes such as newLineEscape or useTlsMessageFormat for safe framing and newline escaping.

The issue is tied to configuration attributes that were silently renamed, so existing configurations may appear valid while no longer enforcing newline escaping or TLS-specific framing. Configurations using SyslogAppender are not affected, as its attribute names remained stable.

Exploit preconditions

  • Attack surface: Log messages transmitted over syslog streams (TCP or TLS) using Rfc5424Layout directly.
  • Required access: Ability to control or significantly influence data that gets logged (e.g., user-supplied fields, headers, parameters, protocol messages).
  • Trigger point: Emission of log events containing attacker-controlled input that includes newline (\n) or CRLF (\r\n) sequences.
  • Why exploitation is possible: Due to undocumented configuration attribute renames, newline escaping and TLS message framing may silently stop working. This allows raw CRLF sequences and unframed messages to be sent, enabling an attacker to inject additional syslog records or modify log structure by crafting malicious log content.

Why this happens

The underlying problem is a combination of improper output neutralization and incorrect resolution of security-relevant configuration attributes.

From a CWE perspective:

  • CWE-117 (Improper Output Neutralization for Logs): The newLineEscape mechanism that should neutralize newline characters is effectively disabled when the attribute is silently renamed, so logging output may contain unescaped CRLF sequences.
  • CWE-684 (Incorrect Provision of Associated Security Function): The security behavior associated with configuration options (newLineEscape, useTlsMessageFormat) is not correctly applied because the system no longer recognizes the documented attribute names. As a result, developers believe they have enabled safe framing and escaping, but the logging system operates in a less secure mode (unframed TCP with no newline escaping).

Abstractly, this reflects a bug class where security guarantees depend on configuration keys; changing or misaligning those keys silently disables protections while leaving configurations looking syntactically correct.

Potential impact

  • Attackers may inject fake or misleading log entries by smuggling CRLF sequences into logged fields.
  • Log records can be prematurely terminated, with additional attacker-controlled lines appended as separate syslog events.
  • Security monitoring, compliance auditing, or incident response processes can be misled by fabricated or manipulated log messages.
  • Correlation and parsing tools that assume well-framed RFC5424 or TLS-framed messages may misinterpret or discard records, degrading visibility.
  • Downstream systems that trigger alerts or actions based on logs may be influenced by crafted entries.

General mitigation guidance

Mitigation generally focuses on restoring predictable, safe log framing and enforcing robust output neutralization for log data:

  • Prefer logging configurations and appenders that apply safe defaults for framing and escaping (e.g., use higher-level appenders like SyslogAppender where feasible, rather than direct Rfc5424Layout configuration).
  • Ensure that configuration attributes controlling newline escaping, framing, and TLS usage are correctly named, documented, and consistently applied across environments.
  • Reduce trust in log input: validate, normalize, or constrain user-controllable fields before logging, especially when logs are fed into downstream security or analytics pipelines.
  • Use layouts or encodings that inherently avoid ambiguous line breaks or framing issues (for example, structured formats like JSON in combination with transport-level framing).
  • Apply least-privilege principles to systems that consume logs so that incorrect or malicious log content cannot directly compromise higher-value systems.

How teams detect issues like this

Detection efforts can focus on both configuration reviews and behavioral signals in log streams:

  • Configuration analysis:
  • Review Log4j configurations for use of Rfc5424Layout and confirm that security-relevant attributes (newline escaping, TLS framing) are valid for the version in use.
  • Use static configuration linters or CI checks to flag unknown or deprecated configuration attributes that appear to control security functions.
  • Code review signals:
  • Direct use of low-level layouts for syslog without accompanying tests or documentation about expected framing/escaping behavior.
  • Assumptions in code comments or docs that rely on specific configuration keys for security-sensitive behavior.
  • Runtime and log stream monitoring:
  • Inspect syslog traffic for unexpected embedded newlines, multiple syslog messages within a single frame, or malformed RFC5424 records.
  • Use log-parsing tools or SIEM rules to detect anomalies such as log entries starting with user-controlled prefixes or unexpected header patterns.
  • Automated configuration and dependency review tools can assist by highlighting known risky combinations of Log4j versions and layout settings.

Sources

SourceLink
github.comgithub.com/apache/logging-log4j2/pull/4074
lists.apache.orglists.apache.org/thread/3k1clr2l6vkdnl4cbhjrnt1nyjvb5gwt
logging.apache.orglogging.apache.org/cyclonedx/vdr.xml
logging.apache.orglogging.apache.org/log4j/2.x/manual/layouts.html#RFC5424Layout
logging.apache.orglogging.apache.org/security.html#CVE-2026-34478
openwall.comopenwall.com/lists/oss-security/2026/04/10/7

Frequently asked

questions

It can be, if remote users or services can control fields that are logged through the affected Rfc5424Layout. In such cases, attackers may insert CRLF sequences to forge or manipulate syslog records transmitted over the network.

An attacker typically only needs the ability to influence log content—for example, by sending crafted requests, messages, or headers that the application logs without sufficient sanitization. Direct access to the logging infrastructure is not required.

Ensure that the logging configuration uses correct and current attribute names so that newline escaping and the intended framing mode are actually enforced. Favor secure-by-default appenders or layouts (such as SyslogAppender with well-documented options) and verify behavior in tests by examining actual log output.

Treat logging configuration as security-sensitive: avoid relying on undocumented or unstable attribute names, add automated checks for unknown configuration keys, and include log behavior validation in regression tests. Additionally, consistently neutralize or constrain user-controlled data before logging, especially when logs cross trust boundaries or feed into security tooling.

Find out what's already
exploitable in your codebase.