CakePHP: SmtpTransport vulnerable to CRLF header injection
Impact
Custom mail headers added with Message::setHeaders() or addHeaders() do not have CRLF replaced allowing header injection if user controlled data is added to message headers without stripping CRLF bytes.
Source excerpt · OSVAffected packages
Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.
| Affected range | Recorded fix |
|---|---|
| From 4.5.0 before 4.5.12Ecosystem versions | 4.5.12 |
| From 4.6.0 before 4.6.5Ecosystem versions | 4.6.5 |
| From 5.0.0 before 5.1.9Ecosystem versions | 5.1.9 |
| From 5.2.0 before 5.2.14Ecosystem versions | 5.2.14 |
| From 5.3.0 before 5.3.7Ecosystem versions | 5.3.7 |
Version evidence: OSV · GHSA-2qh5-382h-3jpc
View original version evidence (60 explicit versions)
Original source description
Impact
Custom mail headers added with Message::setHeaders() or addHeaders() do not have CRLF replaced allowing header injection if user controlled data is added to message headers without stripping CRLF bytes.
Patches
5.3.7, 5.2.14, 5.1.9, 4.6.5, 4.5.12 contain fixes for this issue.
Workarounds
You can strip CRLF bytes from email header values before setting header values.
References
- Security advisory github.com/cakephp/cakephp/security/advisories/GHSA-2qh5-382h-3jpc
- Security advisory nvd.nist.gov/vuln/detail/CVE-2026-77634
- Patch github.com/cakephp/cakephp/commit/08188962bcd99a95da1e49f62e786f2d688f1e41
- Patch github.com/cakephp/cakephp/commit/2afe42b02d8ddc5d442bca5e8bb61910a727646e
- Patch github.com/cakephp/cakephp/commit/3e09dae6cbdc983754fa3a8e6aae74da102a3ea1
- Patch github.com/cakephp/cakephp/commit/b67b622457362b075bb37e625a82af73a0b3c9c3
- Source reference github.com/cakephp/cakephp