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-61815 Overview
CVE-2026-61815 is a Carriage Return Line Feed (CRLF) header injection vulnerability [CWE-93] in the zbateson/mail-mime-parser PHP library. The library serves as an alternative to PHP's imap* functions for parsing and building RFC 822 messages. Versions prior to 3.0.6 and 4.0.2 interpolate attachment filenames into Content-Type and Content-Disposition header values without stripping CR/LF sequences. An attacker who controls a filename can inject arbitrary MIME headers, including a forged Bcc: recipient that silently exfiltrates copies of outgoing mail. The tainted filename can originate from parsed inbound messages, so any application that re-attaches or forwards parsed attachments is exposed.
Critical Impact
Attackers can inject arbitrary email headers through crafted attachment filenames, enabling silent message exfiltration via forged Bcc: headers in applications that build or forward MIME messages.
Affected Products
- zbateson/mail-mime-parser versions prior to 3.0.6 (3.x branch)
- zbateson/mail-mime-parser versions prior to 4.0.2 (4.x branch)
- zbateson/mail-mime-parser 1.x and 2.x branches (end-of-life, will not receive patches)
Discovery Timeline
- 2026-09-24 - CVE-2026-61815 published to NVD
- 2026-09-30 - Last updated in NVD database
Technical Details for CVE-2026-61815
Vulnerability Analysis
The vulnerability resides in how zbateson/mail-mime-parser serializes attachment filenames into MIME part headers. When the library constructs a message, it writes the filename directly into both the Content-Typename= parameter and the Content-Dispositionfilename= parameter. Neither path strips or encodes CR (\r) or LF (\n) characters before serialization. A filename containing \r\n therefore terminates the current header line and begins a new one that the attacker fully controls.
The attack surface expands because untrusted filenames routinely enter the library through parsed inbound mail. An application that calls getFilename() on a parsed attachment and reuses the value when constructing an outbound message propagates the injection without any local string concatenation. The resulting message contains attacker-authored headers that downstream Mail Transfer Agents (MTAs) process as if the application had generated them.
Root Cause
The root cause is missing input sanitization on the filename field during header serialization. The library trusts the string returned by getFilename() and writes it verbatim into header value positions where CRLF carries structural meaning per RFC 822. This matches [CWE-93: Improper Neutralization of CRLF Sequences].
Attack Vector
An attacker sends an email with a crafted attachment filename containing CRLF sequences followed by injected header lines. A victim application parses the message with zbateson/mail-mime-parser, re-attaches the file to a new outbound message, and serializes it. The forged headers (for example, Bcc: attacker@example.com) are emitted by the sending MTA, causing silent recipient addition, header spoofing, or MIME structure manipulation. The attack requires no authentication and no user interaction on the vulnerable server.
See the GitHub Security Advisory GHSA-36h5-qg4p-q2qf for the maintainer's technical analysis.
Detection Methods for CVE-2026-61815
Indicators of Compromise
- Outbound messages containing unexpected Bcc:, Cc:, or Reply-To: headers that do not match application logic.
- Mail server logs showing deliveries to recipients not referenced in application-level send calls.
- Inbound messages with attachment filenames containing raw \r\n byte sequences or non-printable control characters.
- Multiple Content-Type or Content-Disposition headers within a single MIME part boundary.
Detection Strategies
- Inspect SMTP relay logs for envelope recipients that do not appear in the message's visible To:/Cc: headers.
- Scan parsed inbound mail for attachment filenames matching the regex /[\r\n]/ before passing them to downstream functions.
- Use composer audit or Software Composition Analysis (SCA) tooling to flag installations of zbateson/mail-mime-parser below 3.0.6 or 4.0.2.
Monitoring Recommendations
- Alert on process-level outbound email volume spikes from applications that forward or re-attach parsed messages.
- Monitor web application logs for mail-handling endpoints receiving attachments with suspicious filename byte patterns.
- Correlate MTA queue entries with application send events to identify recipients injected outside the application layer.
How to Mitigate CVE-2026-61815
Immediate Actions Required
- Upgrade zbateson/mail-mime-parser to 3.0.6 or 4.0.2 using composer update zbateson/mail-mime-parser.
- Migrate off the 1.x and 2.x branches, which are end-of-life and will not receive patches.
- Audit application code for calls to getFilename() whose return value is reused in constructed messages.
- Review recent outbound mail logs for evidence of forged Bcc: or Cc: recipients.
Patch Information
The maintainer released fixes in versions 3.0.6 and 4.0.2. Both releases strip CR and LF characters from filenames before serializing them into Content-Type and Content-Disposition headers. Refer to the GitHub Security Advisory GHSA-36h5-qg4p-q2qf for release notes and commit references.
Workarounds
- Strip CR and LF from any filename before passing it to attachment APIs: preg_replace('/[\r\n]+/', ' ', $filename).
- Apply the same sanitization to values returned by getFilename() before reusing them in outbound messages.
- Reject or quarantine inbound messages whose attachment filenames contain control characters at the mail gateway layer.
# Upgrade to a patched release
composer require zbateson/mail-mime-parser:^4.0.2
# or for the 3.x branch
composer require zbateson/mail-mime-parser:^3.0.6
# Verify installed version
composer show zbateson/mail-mime-parser | grep versions
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

