The vulnerability CVE-2026-41504 in Coraza's native audit-log format is a CRLF injection and log forgery issue. The root cause is the direct writing of attacker-controlled data into the line-based audit log without proper escaping of carriage return (\r) and newline (\n) characters. This allows an attacker to inject arbitrary lines into the audit log, making it possible to forge log entries, shift attribution, confuse SIEM correlation, and break log-parsing tools.
The analysis of the provided patch (commit a3079325547c7c1e08522aed4d6468f25d080e25) clearly shows that the internal/auditlog/formats.go file was modified. Specifically, the Format method of the nativeFormatter struct was the central point where these unescaped writes occurred. The patch introduces a logEscaper (a strings.NewReplacer) and applies logEscaper.Replace() to all previously raw-written attacker-controlled fields.
Each instance where res.WriteString() or fmt.Fprintf() was used to output potentially malicious input without sanitization within the nativeFormatter.Format function represents a vulnerable point. These include various parts of the audit log: transaction ID and IPs (Part A), request method, URI, protocol, and headers (Part B), request body (Part C), response body (Part E), response protocol and headers (Part F), error messages (Part H), and matched rule raw data (Part K).
Therefore, the auditlog.nativeFormatter.Format function is identified as the vulnerable function, as it contained all the direct write operations that lacked proper CRLF escaping. Triggering any of the described attack vectors (e.g., sending a request with CRLF in headers or body) would cause the nativeFormatter.Format function to process and write the malicious input to the log, leading to log forgery.