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-attachment-crlf — CakePHP 5.4.2 - High - Remote - CRLF - attachment Content-Type and Content-ID leftover | Kitploit
Tools/GitHubGitHub/abraxas/cakephp-attachment-crlf
Vulnerability AnalysisExploitationWeb Application ExploitationSecurity VirtualizationWeb SecurityPenetration Testing
GitHubabraxas/cakephp-attachment-crlf

cakephp-attachment-crlf

CakePHP 5.4.2 - High - Remote - CRLF - attachment Content-Type and Content-ID leftover

View Repository
1521 days agoNot yet reviewed
Share

Abraxas Labs - cakephp-attachment-crlf

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

Write-up: https://abraxaslabs.tech/research/cakephp-attachment-crlf

cakephp-attachment-crlf

Class: MIME-part header injection Reach: Remote

CakePHP 5.4.2 (887b641) - Cake Software Foundation

5.4.2 already strips ", \r, and \n from multipart name= / filename= (FormDataPart::_headerParameterToString). That is the control. Content-Type and Content-ID were left as raw concatenation. Message::setAttachments copies an UploadedFile client media type into that type field with no extra filter.

An app that attaches a user upload, or that passes a user contentId, puts those bytes on the MIME part. getBodyString() then shows a second header line under that part.

IDno CVE yet
ClassMIME-part header injection
ReachRemote (app that attaches a user upload or a user contentId)
CWECWE-93
CVSSMedium: 5.4 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N
ProductCakePHP
Affected5.4.2 (887b641de9f7aba06071f98f17edcbc573cbcf63)
Authapplication that attaches a user upload (UploadedFile client MIME) or a user contentId
LicenseGNU Affero GPL v3.0
Lab127.0.0.1 only

What an attacker can do

Someone who can influence attachment metadata the app passes into Message::setAttachments / addAttachment can inject MIME-part headers.

PrivilegeMethod / sinkKindLab-proven or inferred
Extra Content-Type header linesetAttachments with 'mimetype' => "text/plain\\r\\nX-Injected: …"Integrity of MIME part headersLab-proven. Witness line present
Extra Content-ID header line'contentId' => "cid@…>\\r\\nX-Injected: …" (inline part)Integrity of MIME part headersLab-proven. Witness line present
Same injection via upload MIMEUploadedFile::getClientMediaType() copied onto mimetypeIntegrity of MIME part headersLab-proven. Witness line present
filename= CRLFattachment name with CR/LFClosedLab-proven closed. 5.4.2 strip holds
Envelope RCPT / Bcc via this sinkMIME part headers in the bodyClosedThat is SmtpTransport pair-only strip, a sibling
SMTP sendlab calls getBodyString() onlyClosedNo transport, no shell

Inferred from the same concat, not demonstrated: a crafted type or contentId that includes a multipart boundary could split the message into extra parts in a receiving MUA. I did not send mail.

Same pin leftovers: window SQLi, collate SQLi, cache unserialize.

How I found it

I pinned cakephp/cakephp 5.4.2 after the bakery note that multipart Content-Disposition filename= injection was fixed. _headerParameterToString is the sanitizer:

$transliterated = Text::transliterate(str_replace(['"', "\r", "\n"], '', $value));

__toString() still does:

if ($this->type) {
    $out .= 'Content-Type: ' . $this->type . "\r\n";
}
if ($this->contentId) {
    $out .= 'Content-ID: <' . $this->contentId . ">\r\n";
}

Message::setAttachments copies the upload client type with no strip. attachFiles / attachInlineFiles then call $part->type($fileInfo['mimetype']) and $part->contentId($fileInfo['contentId']).

Wrong turns already recorded: treating envelope RCPT as this leftover (the extra line is in the body); claiming filename= still injects (it does not); sending SMTP; a reverse shell. Theatre.

Lab

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

or

cd lab
./run.sh

Target only http://127.0.0.1:19460. PHP 8.3, CakePHP tag 5.4.2 cloned at build. lab_server.php exposes Message::setAttachments. Four cases: filename control, mimetype, contentId, UploadedFile media type.

SUCCESS cakephp-attachment-crlf how=live pin=5.4.2 sha=887b641de9f7aba06071f98f17edcbc573cbcf63 mimetype=yes contentId=yes upload=yes filename-stripped=yes CAKEPHP-ATTACHMENT-CRLF-WITNESS

The fix

Run type, contentId, and transferEncoding through the same " / \r / \n strip as _headerParameterToString. Reject the value if it still contains a line break after strip. Cover UploadedFile client MIME and explicit mimetype / contentId in the mailer tests, not only filename=.

References

  • github.com/cakephp/cakephp tag 5.4.2 (887b641de9f7aba06071f98f17edcbc573cbcf63)
  • FormDataPart.php · Message.php
  • Nearby patched: 5.4.2 bakery filename= strip
  • Same pin: cakephp-window-sqli · cakephp-collate-sqli · cakephp-cache-unserialize
  • CWE-93

License

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

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    786
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    506
  • 3

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    429
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    345
  • 5

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    262
  • 6

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    256

Explore all tools

Browse our collection of tools

View all tools →