Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
cakephp-smtp-crlf — CakePHP 5.4.2 - High - Remote - Header injection - SmtpTransport lone LF leftover of GHSA-2qh5 | Kitploit
Tools/GitHubGitHub/abraxas/cakephp-smtp-crlf
Vulnerability AnalysisExploitationWeb Application ExploitationSecurity VirtualizationWeb SecurityPenetration TestingEmail Security
GitHubabraxas/cakephp-smtp-crlf

cakephp-smtp-crlf

CakePHP 5.4.2 - High - Remote - Header injection - SmtpTransport lone LF leftover of GHSA-2qh5

View Repository
12 days agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

Abraxas Labs - cakephp-smtp-crlf

abraxaslabs.tech  ·  github.com/abraxas  ·  @abraxas_null  ·  [email protected]  ·  cakephp-smtp-crlf

cakephp-smtp-crlf

Class: Mail header injection Reach: Remote

CakePHP 5.4.2 (887b641) - Cake Software Foundation

GHSA-2qh5 / CVE-2026-77634 added str_replace("\r\n", '', $val) on SmtpTransport and MailTransport. That callback is a no-op for a bare LF or CR. Header names are still concatenated unsanitized. PHP mail() and the SMTP DATA we captured treat a bare LF as a new header line.

If an app copies user data into a custom header, an attacker can add Bcc, rewrite Subject, or break into the body by sending LF instead of CRLF. The announced fix does not stop that. Stock cakephp/app does not put request data into custom headers by itself.

IDno CVE yet
ClassMail header injection (lone LF leftover of GHSA-2qh5)
ReachRemote (same as GHSA-2qh5: app copies user data into Message::setHeaders)
CWECWE-93
CVSSHigh: 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
ProductCakePHP
Affected5.4.2 (887b641de9f7aba06071f98f17edcbc573cbcf63)
Authsame as GHSA-2qh5: app copies user data into Message::setHeaders / addHeaders
LicenseGNU Affero GPL v3.0
Lab127.0.0.1 only

What an attacker can do

Needs an application that puts request data into custom mail headers.

PrivilegeMethod / sinkLab-proven or inferred
Inject an extra Bcc: (or Cc: / To:) line into the SMTP DATA header blocksetHeaders(['X-Meta' => "ok\nBcc: [email protected]"]) then SmtpTransport::sendLab-proven. SMTP DATA and getHeadersString both show a new Bcc: line. Witness X-Oracle: CAKEPHP-SMTP-CRLF-WITNESS
Same injection through MailTransportSame callback in MailTransport::sendLab-proven on getHeadersString with the MailTransport include list and strip callback. This lab does not call PHP mail()
Lone CR as well as lone LFok\rBcc: ...Lab-proven. Pair-only strip leaves \r; header parsers that split on CR/LF treat it as a new line
Rewrite Subject or break into the bodyValue contains \nSubject: or \n\nInferred from the same concatenation. Lab injected Bcc / X-Oracle, not Subject
Extra envelope recipientInjected Bcc inside DATAInferred. Some MTAs re-parse DATA. Cake's RCPT TO still uses only setTo / setCc / setBcc on the Message object
Two-byte \r\n pairGHSA-2qh5 stripLab-proven closed. Control concatenates okBcc:...
Unauthenticated RCE on a skeleton appnot this leftoverClosed
Multipart filename= CRLF5.4.2 already strips "/\r/\nClosed

How I found it

I pinned cakephp/cakephp 5.4.2 after GHSA-2qh5, GHSA-fxf7, GHSA-vjqc, and the 5.4.2 filename= note. The transport tests only send "line one\r\nline two" and expect line oneline two.

SmtpTransport 5.4.2:

$headers = $message->getHeadersString(
    [...],
    "\r\n",
    function (string $val): string {
        return str_replace("\r\n", '', $val);
    },
);

MailTransport uses the same callback. Message::getHeadersString maps the callback over values, then does $key . ': ' . $val.

Wrong turns already recorded: treating GHSA-2qh5 as closed and walking away; calling PHP mail() in the lab (the oracle is SMTP DATA plus getHeadersString); inflating this to unauth RCE on a skeleton app. Theatre: a reverse shell.

Lab

python3 cakephp-smtp-crlf-Abraxas-Labs.py

or

cd lab
./run.sh

Composer cakephp/cakephp:5.4.2 in PHP 8.3. Loopback SMTP sink at 127.0.0.1:19410.

  1. Control: X-Meta = ok\r\nBcc: [email protected]\r\nX-Oracle: CAKEPHP-SMTP-CRLF-WITNESS. Result: one header X-Meta: okBcc: [email protected]: CAKEPHP-SMTP-CRLF-WITNESS.
  2. Case LF: same payload with \n only. Result: new Bcc: and X-Oracle: lines in SMTP DATA, Smtp getHeadersString, and Mail getHeadersString.
  3. Case CR: same with \r only. Same extra lines.
SUCCESS cakephp-smtp-crlf pin=5.4.2 control-crlf-stripped=yes lf-bcc=yes cr-leftover=yes how=smtp-data-bcc-line CAKEPHP-SMTP-CRLF-WITNESS

The fix

Strip or reject any \r or \n in header names and values (same as the 5.4.2 filename= sanitizer). Cover lone LF and lone CR in the transport tests, not only the \r\n pair.

References

  • github.com/cakephp/cakephp tag 5.4.2 (887b641de9f7aba06071f98f17edcbc573cbcf63)
  • src/Mailer/Transport/SmtpTransport.php · src/Mailer/Transport/MailTransport.php · src/Mailer/Message.php
  • Nearby patched (pair only): GHSA-2qh5-382h-3jpc / CVE-2026-77634
  • CWE-93

License

GNU Affero GPL v3.0. See LICENSE. Loopback lab only. No warranty.

Download Tool