Skip to content

OAuth 2.0 & SAML Saldırıları

SSO difficulty: orta-zor

Tek oturum açma (SSO) protokolleri OAuth 2.0/OIDC ve SAML; karmaşık akışları nedeniyle zengin bir zafiyet yüzeyi sunar. Hedef genelde kod/token/assertion’ı çalmak veya doğrulamasını atlatmaktır.

1) /authorize?client_id&redirect_uri&response_type&scope&state
2) Kullanıcı IdP'de onaylar
3) redirect_uri?code=...&state=... (veya implicit: #access_token=)
4) Client code → /token ile access_token / id_token alır
redirect_uri gevşek doğrulama → kod/token saldırgana
state eksik → login CSRF / hesap bağlama
response_type=token (implicit) → fragment sızıntısı
PKCE yok / atlanıyor → kod interception
scope aşırı geniş + refresh token sızıntısı
client_secret public client'ta
  1. redirect_uri test — tam eşleşme mi?

    https://client.com/callback
    https://client.com/callback/../../@attacker.com
    https://client.com.attacker.com/callback
    https://attacker.com/?https://client.com/callback
    https://client.com/callback?next=https://attacker.com
  2. state test — state kaldır / sabitle; account linking CSRF.

  3. Token sızıntısı — Referer, history, post_logout_redirect , deep link, log.

  4. code reuse / prediktable — aynı code iki kez; kısa code brute.

  5. id_token — JWT ( aud , iss , alg ).

redirect_uri#access_token=...&token_type=Bearer
# XSS veya open redirect ile fragment çalınabilir
□ authorization'da code_challenge yokken token kabul
□ plain metodu + tahmin
□ S256 challenge proxy ile eşleştirme
□ client_id değiştir → başka uygulamanın callback'i
□ Mixed redirect_uri (http vs https)
□ path traversal / subdomain on registered URI
□ "pre-registration" bypass: ek query string ignore
Assertion = XML; NameID = kullanıcı kimliği
IdP imzalar → SP doğrular
- İmza doğrulaması kapalı / kısmi → NameID=admin
- Signature Wrapping (XSW): imzalı bloğu koru, işlenen assertion'ı değiştir
- Comment injection: user<!--x-->admin@x.com
- Replay: eski Assertion (NotOnOrAfter yok)
- Audience / Recipient kontrolü eksik
- XXE in SAML XML parse
Terminal window
<saml:Subject>
<saml:NameID>admin@victim.com</saml:NameID>
</saml:Subject>
İmzalı Assertion A (user=attacker) dokunulmaz
İşlenen kopya B'de NameID=admin
SP yanlış node'u doğrular / yanlış node'u kullanır
→ admin oturumu
[ ] redirect_uri tüm bypass listesi
[ ] state yok/sabit
[ ] PKCE zorunlu mu
[ ] id_token JWT saldırıları
[ ] SAML imza strip
[ ] SAML XSW / comment
[ ] Assertion replay
[ ] Open redirect zinciri
Client open redirect + OAuth redirect_uri
→ auth code attacker'a
→ token exchange (public client) / code leak impact
SAML Raider → strip signature → NameID admin
→ SP admin paneli