Skip to main content
Vulnerability Database/CVE-2026-41504

CVE-2026-41504: OWASP Coraza WAF Log Injection Vulnerability

CVE-2026-41504 is a log injection flaw in OWASP Coraza WAF allowing attackers to forge audit log entries through injected carriage returns and line feeds. This post explains its impact, affected versions, and mitigation steps.

Published:

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-41504 Overview

CVE-2026-41504 is a CRLF injection vulnerability in OWASP Coraza, a Go-based web application firewall (WAF) library compatible with ModSecurity. The flaw exists in the Native audit-log formatter located at internal/auditlog/formats.go. Affected versions range from 3.0.0 through versions prior to 3.8.0. The formatter writes attacker-influenced request and response fields without neutralizing carriage return (CR) or line feed (LF) characters. When SecAuditLogFormat Native is enabled, an attacker can inject line breaks that appear as forged lines inside a transaction record, misleading operators and line-oriented SIEM parsers.

Critical Impact

Attackers controlling request or response bodies, headers, error messages, or matched-rule data can forge audit log entries, undermining the integrity of security telemetry used by analysts and SIEM pipelines.

Affected Products

  • OWASP Coraza WAF versions 3.0.0 through 3.7.x
  • Any Go application embedding Coraza as a WAF library
  • Deployments using the SecAuditLogFormat Native configuration directive

Discovery Timeline

  • 2026-10-12 - CVE-2026-41504 published to NVD
  • 2026-10-13 - Last updated in NVD database

Technical Details for CVE-2026-41504

Vulnerability Analysis

The vulnerability is classified as a CRLF injection flaw [CWE-93: Improper Neutralization of CRLF Sequences]. Coraza's Native audit log formatter serializes transaction data into a line-oriented text format. The formatter concatenates attacker-controllable fields directly into output lines without escaping \r or \n characters. An attacker who inserts CRLF sequences into a monitored field can produce output lines that look like legitimate audit entries. These forged lines can mimic the format of rule matches, request headers, or error messages, polluting the integrity of recorded transactions.

Root Cause

The root cause is missing output neutralization in nativeFormatter. Attacker-influenced inputs — including request and response bodies, headers, error messages, and matched-rule data — are written verbatim into the audit log. Because the Native format uses newlines as record delimiters, injected CRLF sequences create the appearance of additional structured log entries within a single transaction record.

Attack Vector

Exploitation requires only the ability to send HTTP data that Coraza inspects and records. An attacker crafts a request containing CRLF sequences within a header value, body, or any field that triggers rule logging. When Coraza writes the transaction to the Native audit log, the CRLF survives into the output. The unpredictable transaction boundary limits full session impersonation, but an attacker can still inject convincing forged lines that mislead analysts or disrupt automated log parsing.

go
// Security patch in internal/auditlog/formats.go
// Source: https://github.com/corazawaf/coraza/commit/a3079325547c7c1e08522aed4d6468f25d080e25

	"github.com/corazawaf/coraza/v3/types"
)

// logEscaper neutralizes CR/LF sequences in attacker-controlled fields
// to prevent CRLF injection and log forgery in the Native audit log format.
// See GHSA-prpw-wwv7-xjjr.
//
// The backslash is escaped first so the mapping stays reversible: without it a
// real CR and the literal two-character input `\r` both render as `\r`, and a
// consumer that unescapes would turn the literal back into a line break --
// re-materialising the break this is meant to neutralise. Replacer makes a
// single left-to-right pass and never re-scans its own output, so escaping the
// backslash cannot double-escape.
var logEscaper = strings.NewReplacer(`\`, `\\`, "\r", `\r`, "\n", `\n`)

type nativeFormatter struct{}

type auditLogWithErrMesg interface{ ErrorMessage() string }

The fix introduces a strings.NewReplacer that escapes backslash first, then CR and LF, producing a reversible encoding that cannot be re-materialized into real line breaks by downstream consumers.

Detection Methods for CVE-2026-41504

Indicators of Compromise

  • Audit log entries containing unexpected line breaks within request header, body, or rule-match fields
  • Transaction records showing duplicated section markers or malformed field delimiters in the Native format
  • Log lines that appear outside the expected transaction boundary sequence used by Coraza

Detection Strategies

  • Parse existing Coraza Native audit logs for raw \r or \n sequences embedded within attacker-controlled fields prior to patching
  • Compare transaction section counts against expected Coraza Native format structure to flag anomalous records
  • Correlate inbound requests containing URL-encoded %0d%0a or raw CRLF payloads with subsequent audit log entries

Monitoring Recommendations

  • Instrument SIEM parsers to validate Coraza transaction boundaries and alert on structural anomalies
  • Monitor WAF request telemetry for payloads targeting header, body, or error-message fields with embedded control characters
  • Track Coraza library versions across deployed services to confirm patched builds are in production

How to Mitigate CVE-2026-41504

Immediate Actions Required

  • Upgrade Coraza to version 3.8.0 or later across all services embedding the library
  • Audit application dependency manifests (go.mod) for Coraza versions between 3.0.0 and 3.7.x
  • Review historical Native audit logs for suspected forged entries that may have influenced prior investigations

Patch Information

The vulnerability is fixed in Coraza v3.8.0. The patch introduces the logEscaper replacer in internal/auditlog/formats.go, which neutralizes CR, LF, and backslash characters before writing attacker-influenced fields. Reference the GitHub Security Advisory GHSA-prpw-wwv7-xjjr and the GitHub Release v3.8.0 for release notes and verification details.

Workarounds

  • Switch SecAuditLogFormat from Native to a structured format such as JSON, which encodes control characters as part of its serialization
  • Pre-filter inbound requests at an upstream proxy to reject headers and bodies containing raw CRLF sequences
  • Restrict log ingestion pipelines to validate record structure and quarantine malformed Coraza transactions pending review
bash
# Update Coraza to the patched release
go get github.com/corazawaf/coraza/v3@v3.8.0
go mod tidy

# Temporary mitigation: switch to JSON audit log format in coraza.conf
# SecAuditLogFormat Native
SecAuditLogFormat JSON

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

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.