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-trusted-proxies — CakePHP 5.4.2 - High - Remote - Proxy - trustedProxies honors X-Forwarded-* from any REMOTE_ADDR | Kitploit
Tools/GitHubGitHub/abraxas/cakephp-trusted-proxies
Vulnerability AnalysisExploitationWeb Application ExploitationSecurity VirtualizationWeb SecurityPenetration Testing
GitHubabraxas/cakephp-trusted-proxies

cakephp-trusted-proxies

CakePHP 5.4.2 - High - Remote - Proxy - trustedProxies honors X-Forwarded-* from any REMOTE_ADDR

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-trusted-proxies

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

cakephp-trusted-proxies

Class: HTTPS redirect bypass / IP-host spoof Reach: Remote

CakePHP 5.4.2 (887b641) - Cake Software Foundation

HttpsEnforcerMiddleware with trustedProxies => ['10.0.0.1'] calls setTrustedProxies, which sets trustProxy = true and never compares the list to REMOTE_ADDR. After that, scheme(), host(), and clientIp() honor attacker X-Forwarded-Proto / X-Forwarded-For / X-Forwarded-Host / X-Real-IP.

Default middleware has trustedProxies null and does not enable this. The documented load-balancer setup is the exposed case. An unauthenticated HTTP client who is not the listed proxy can skip the HTTPS redirect and spoof client IP and Host.

IDno CVE yet
ClassHTTPS redirect bypass / IP-host spoof
ReachRemote (unauthenticated HTTP; app set trustedProxies)
CWECWE-441, CWE-346
CVSSHigh: 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N
ProductCakePHP
Affected5.4.2 (887b641de9f7aba06071f98f17edcbc573cbcf63)
Authnone. App set HttpsEnforcerMiddleware trustedProxies
LicenseGNU Affero GPL v3.0
Lab127.0.0.1 only

What an attacker can do

Needs an app that enabled trustedProxies (typical reverse-proxy HTTPS enforce). Does not need to connect from a listed proxy IP.

PrivilegeMethod / sinkLab-proven or inferred
Skip HTTPS redirect / HSTS pathGET / HTTP with X-Forwarded-Proto: httpsLab-proven. 200, scheme=https, witness in JSON
Spoof clientIp()X-Forwarded-For: 203.0.113.50Lab-proven. client_ip=203.0.113.50
Spoof host()X-Forwarded-Host: spoof.invalidLab-proven. host=spoof.invalid
Spoof via X-Real-IPX-Real-IP: 198.51.100.9Lab-proven. client_ip=198.51.100.9
Bypass IP ACL / rate limit keyed on clientIp()Same spoofInferred. RateLimitMiddleware default remote_addr is not this bug
Negative controlSame forwarded headers on /control (no trustedProxies)Lab-proven. Still 301 to https

Closed on this leftover: default trustedProxies => null; REMOTE_ADDR itself is still the Docker bridge IP in the lab (192.168.208.1, not the listed 10.0.0.1). Not RCE. Not a cookie-jar bug.

How I found it

I pinned cakephp/cakephp 5.4.2. ServerRequest::setTrustedProxies():

public function setTrustedProxies(array $proxies): void
{
    $this->trustedProxies = $proxies;
    $this->trustProxy = true;
    $this->uri = $this->uri->withScheme($this->scheme());
}

HttpsEnforcerMiddleware calls that whenever trustedProxies is non-null. The listed IPs are later used as an array_diff on the XFF chain, not as a check of the connecting peer.

Wrong turns already recorded: treating default middleware as this leftover (it is not); calling RateLimitMiddleware x-forwarded-for the same bug (5.4.1 bakery already moved that default to remote_addr); claiming REMOTE_ADDR itself was spoofed. Theatre: a reverse shell.

Lab

python3 cakephp-trusted-proxies-Abraxas-Labs.py

or

cd lab
./run.sh

Composer cakephp/cakephp 5.4.2 in PHP 8.3. Tiny app: / uses trustedProxies => ['10.0.0.1']; /control does not. Loopback HTTP at 127.0.0.1:19430.

  1. GET / no forwarded headers -> 301 https.
  2. GET /control with proto/for/host/real-ip -> 301 https.
  3. GET / with X-Forwarded-Proto: https -> 200, scheme https, trust_proxy=true, REMOTE_ADDR is not 10.0.0.1.
  4. GET / with XFF + Host -> client_ip=203.0.113.50, host=spoof.invalid.
  5. GET / with X-Real-IP -> client_ip=198.51.100.9.
SUCCESS cakephp-trusted-proxies pin=5.4.2 how=app remote-addr=192.168.208.1 listed-proxy=10.0.0.1 proto-bypass=200 control-redirect=301 client-ip=203.0.113.50 host=spoof.invalid x-real-ip=198.51.100.9 CAKEPHP-TRUSTED-PROXIES-WITNESS

The fix

Only honor forwarded headers when REMOTE_ADDR is in the trusted-proxy list (Symfony isFromTrustedProxy()). Empty list must not enable trust.

References

  • github.com/cakephp/cakephp tag 5.4.2 (887b641de9f7aba06071f98f17edcbc573cbcf63)
  • src/Http/ServerRequest.php · src/Http/Middleware/HttpsEnforcerMiddleware.php
  • CWE-441 · CWE-346

License

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

Download Tool