Skip to content
KitploitKITPLOIT
StrumentiExploitsBlog
Log in
Invia
StrumentiExploitsBlog
Invia

Strumenti di Hacking, PenTest e Cybersecurity per il tuo Arsenale di Sicurezza!

Kitploit è una directory di strumenti di hacking, cybersecurity e pentesting. Scopri gli ultimi aggiornamenti dei progetti per trovare vulnerabilità, analizzare sistemi, automatizzare i test e rafforzare la tua sicurezza.

FeedContattoPrivacy© 2026 Kitploit

Directory degli strumenti

Categorie

Vedi tutte le categorie
Loading categories
cakephp-trusted-proxies — CakePHP 5.4.2 - Alto - Remoto - Proxy - trustedProxies rispetta X-Forwarded-* da qualsiasi REMOTE_ADDR | Kitploit
Strumenti/GitHubGitHub/abraxas/cakephp-trusted-proxies
Analisi delle VulnerabilitàExploitSfruttamento di Applicazioni WebVirtualizzazione per la SicurezzaSicurezza WebPenetration Testing
GitHubabraxas/cakephp-trusted-proxies

cakephp-trusted-proxies

CakePHP 5.4.2 - Alto - Remoto - Proxy - trustedProxies rispetta X-Forwarded-* da qualsiasi REMOTE_ADDR

Vedi Repository
156 giorni faNon ancora revisionato

Più Popolari

Vedi tutti →

Scopri gli strumenti più utilizzati dalla nostra community.

Esplora tutti gli strumenti

Sfoglia la nostra collezione di strumenti

Vedi tutti gli strumenti →
Condividi

Abraxas Labs - cakephp-trusted-proxies

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

Write-up: https://abraxaslabs.tech/research/cakephp-trusted-proxies

cakephp-trusted-proxies

Classe: bypass del redirect HTTPS / spoofing IP-host Portata: Remota

CakePHP 5.4.2 (887b641) - Cake Software Foundation

HttpsEnforcerMiddleware con trustedProxies => ['10.0.0.1'] chiama setTrustedProxies, che imposta trustProxy = true e non confronta mai la lista con REMOTE_ADDR. Dopo di che, scheme(), host() e clientIp() rispettano gli header dell'attaccante X-Forwarded-Proto / X-Forwarded-For / X-Forwarded-Host / X-Real-IP.

Il middleware predefinito ha trustedProxies null e non abilita questo comportamento. Il caso esposto è la configurazione documentata per il load-balancer. Un client HTTP non autenticato che non è il proxy elencato può saltare il redirect HTTPS e falsificare l'IP del client e l'Host.

IDnessuna CVE al momento
Classebypass del redirect HTTPS / spoofing IP-host
PortataRemota (HTTP non autenticato; app con trustedProxies impostato)
CWECWE-441, CWE-346
CVSSAlto: 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N
ProdottoCakePHP
Affetto5.4.2 (887b641de9f7aba06071f98f17edcbc573cbcf63)
Authnessuna. App con HttpsEnforcerMiddleware trustedProxies impostato
LicenzaGNU Affero GPL v3.0
Labsolo 127.0.0.1

Cosa può fare un attaccante

Richiede un'app che abbia abilitato trustedProxies (tipico enforcement HTTPS tramite reverse-proxy). Non è necessario connettersi da un IP proxy elencato.

PrivilegioMetodo / sinkProvato in lab o dedotto
Saltare il redirect HTTPS / il percorso HSTSGET / HTTP con X-Forwarded-Proto: httpsProvato in lab. 200, scheme=https, witness nel JSON
Falsificare clientIp()X-Forwarded-For: 203.0.113.50Provato in lab. client_ip=203.0.113.50
Falsificare host()X-Forwarded-Host: spoof.invalidProvato in lab. host=spoof.invalid
Falsificare tramite X-Real-IPX-Real-IP: 198.51.100.9Provato in lab. client_ip=198.51.100.9
Aggirare ACL IP / rate limit basati su clientIp()Stesso spoofingDedotto. Il valore predefinito remote_addr di RateLimitMiddleware non è questa vulnerabilità
Controllo negativoStessi header forwarded su /control (senza trustedProxies)Provato in lab. Ancora 301 verso https

Chiuso su questo residuo: trustedProxies => null predefinito; REMOTE_ADDR stesso è ancora l'IP del bridge Docker nel lab (192.168.208.1, non il 10.0.0.1 elencato). Non è RCE. Non è un bug del cookie-jar.

Come l'ho trovato

Ho fissato 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 lo chiama ogni volta che trustedProxies non è nullo. Gli IP elencati vengono poi usati come array_diff sulla catena XFF, non come controllo del peer che si connette.

Vicoli ciechi già registrati: considerare il middleware predefinito come questo residuo (non lo è); definire il bug di x-forwarded-for in RateLimitMiddleware lo stesso problema (la bakery 5.4.1 ha già spostato quel valore predefinito su remote_addr); sostenere che REMOTE_ADDR stesso sia stato falsificato. Teatro: una reverse shell.

Lab

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

o

cd lab
./run.sh

Composer cakephp/cakephp 5.4.2 in PHP 8.3. App minimale: / usa trustedProxies => ['10.0.0.1']; /control no. HTTP su loopback a 127.0.0.1:19430.

  1. GET / senza header forwarded -> 301 https.
  2. GET /control con proto/for/host/real-ip -> 301 https.
  3. GET / con X-Forwarded-Proto: https -> 200, scheme https, trust_proxy=true, REMOTE_ADDR non è 10.0.0.1.
  4. GET / con XFF + Host -> client_ip=203.0.113.50, host=spoof.invalid.
  5. GET / con 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

La correzione

Considerare gli header inoltrati solo quando REMOTE_ADDR è presente nella lista dei proxy attendibili (Symfony isFromTrustedProxy()). Una lista vuota non deve abilitare la fiducia.

Riferimenti

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

Licenza

GNU Affero GPL v3.0. Vedi LICENSE. Solo laboratorio loopback. Nessuna garanzia.

Scarica lo strumento