🖥️
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
  • API Nedir?
  • Yöntemler
  • Recon
  • Postman Toplama
  • Swagger Toplama
  • Dökümantasyon Sayfası
  • Parametre Ekleme
  • Server Side Paramater Pollution
  • HTTP Method Değiştirme
  • Broken Object Level Authorization (BOLA)
  • Broken Authentication
  • Broken Object Property Level Authorization
  • Unrestricted Resource Consumption
  • Broken Function Level Authorization
  • Unrestricted Access to Sensitive Business Flows
  • Server Side Request Forgery
  • Security Misconfiguration
  • Improper Inventory Management
  • Unsafe Consumption of APIs
  • Mass Assignment
  • Önlemler
  • Kaynaklar

Was this helpful?

  1. Web Application Pentesting

API Testing

PreviousClickjackingNextBroken Link Hijacking

Last updated 13 days ago

Was this helpful?

API Nedir?

  • API'ler (Uygulama Programlama Arayüzleri) yazılım sistemlerinin ve uygulamaların iletişim kurmasını ve veri paylaşmasını sağlar.

  • Tüm dinamik web siteleri API'lerden oluşur, bu nedenle SQL enjeksiyonu gibi klasik web güvenlik açıkları API testi olarak sınıflandırılabilir.

Yöntemler

Recon

Github'da arama yaparak bu api için bir sızmış bilgi veya kaynak kod varmı diye bakabiliriz.

Postman Toplama

Postmanda proxy ayarlayın ve foxyproxy ile bütün istekleri postman'a yönlendirin.

Swagger Toplama

mitmweb
mitmproxy2swagger -i flows -o spec.yml -p http://api.example.com -f flow

Dökümantasyon Sayfası

Api'nin dökümantasyon veya listeleme sayfasına erişip erişilemediğini kontrol edebiliriz.

/api/update/user -> 200 OK
/api -> 200 OK
/swagger

Parametre Ekleme

Eğer bir api'ye istek atılırken bir nesne gönderiliyor ise bu nesneye yeni parametreler ekleyerek göndermeyi deneyebiliriz.

Bu gönderilmeyen parametreler genellikle başka GET isteklerinde görülebilir.

POST /api/checkout
{
    "product_id":"1",
    "quantity":1
}
POST /api/checkout
{
    "product_id":"1",
    "quantity":1,
    "price":0
}

Server Side Paramater Pollution

Eğer sunucu tarafı parametreleri ayıran & karakterini doğru işlemiyorsa sunucuda çalışan koddaki parametreleri değiştirebiliriz.

POST /api/resetPassword HTTP/2

username=administrator

Öncelikle %26 ile bir parametre eklemeye çalışıyoruz. Eğer sunucu bir hata veriyorsa zafiyet vardır.

POST /api/resetPassword HTTP/2

username=administrator%26foo=bar

Sonrasında %23 karakteri ile sunucuya hata verdirip gizli bir parametre var mı diye kontrol ediyoruz. Eğer varsa muhtemelen hata mesajında yazar.

POST /api/resetPassword HTTP/2

username=administrator%23

Bulduğumuz parametreyi %26 ile ekleyip düzenleyebiliriz.

POST /api/resetPassword HTTP/2

username=administrator%26password=pass123

HTTP Method Değiştirme

Eğer bir api isteği bir http methodu ile yapılıyor ise diğer http methodları denenebilir.

GET /api/user/1 -> 200 OK
PUT /api/user/1 -> 200 OK
GET
POST
HEAD
PUT
TRACE
OPTIONS
DELETE
COPY
DEBUG
MOVE
PATCH
TRACK
UPDATE

Broken Object Level Authorization (BOLA)

Saldırganın kendine ait olmayan bir veriye erişmesini sağlar. Eğer uygulamada düzgün erişim kontrolu yapımıyorsa ortaya çıkar. Web güvenliğinde biz bu zafiyeti IDOR olarak biliriz.

/api/v1/options/100 -> 200 OK
/api/v1/options/101 -> 200 OK

Broken Authentication

Eğer aşağıdaki kurallar yok ise brute force denenebilir.

Broken Object Property Level Authorization

Unrestricted Resource Consumption

Broken Function Level Authorization

Unrestricted Access to Sensitive Business Flows

Server Side Request Forgery

POST /api/v1/getPhoto HTTP/2
{
    "url":"https://example.com/image.png"
}

POST /api/v1/getPhoto HTTP/2
{
    "url":"file:///etc/passwd"
}

Security Misconfiguration

GET /api/v1/getProduct/1 HTTP/2

GET /api/v1/getProduct/1'+OR+1=1--+- HTTP/2

Improper Inventory Management

Eski api versiyonları halen silinmemiş olabilir. Bu api servislerinde bırakılmış kritik bilgiler olabilir.

GET /api/v2/customers/deleted HTTP/2 -> 403 
GET /api/v0/customers/deleted HTTP/2 -> 200 OK

Unsafe Consumption of APIs

Mass Assignment

Mass Assignment zafiyeti, kullanıcıdan gelen verilerin doğrudan model nesnelerine atanarak yetkisiz alanların güncellenmesi riskidir.

Bu gizli parametreleri bulmak için Arjun veya ParamMiner kullanılabilir

POST /api/v1/register HTTP/2
{
    "username":"john",
    "password":"password123"
}

POST /api/v1/register HTTP/2
{
    "username":"john",
    "password":"password123",
    "is_admin":true
}

Önlemler

  • API'nizin herkesin erişimine açık olmasını istemiyorsanız belgelerinizin güvenliğini sağlayın.

  • İzin verilen HTTP yöntemlerinden oluşan bir izin listesi uygulayın.

  • Her istek veya yanıt için içerik türünün beklendiğini doğrulayın.

  • Bir saldırgan için yararlı olabilecek bilgileri vermekten kaçınmak için genel hata mesajları kullanın.

  • Yalnızca mevcut üretim sürümünde değil, API'nizin tüm sürümlerinde koruyucu önlemler kullanın.

Kaynaklar

Swagger Editor:

Portswigger Academy:

HTB API Attacks:

APISEC University:

🕸️
https://editor.swagger.io/
https://portswigger.net/web-security/api-testing
https://academy.hackthebox.com/course/preview/api-attacks
https://www.apisecuniversity.com/courses/api-penetration-testing