Tutorial kelola bug untuk exploit
Belajar Hunting Bug dari HTTP Response Header
Panduan ringkas & praktis: cek header, pahami bug, dan contoh PoC menggunakan curl
.
Kenapa Header Penting?
Response header memberi petunjuk konfigurasi server — versi software, kebijakan CORS, setelan cookie, dan lainnya. Dalam hunting bug, header sering jadi first clue untuk menentukan langkah eksploitasi.
Checklist Cepat
- Server / X-Powered-By: versi terlihat → cocokkan dengan CVE.
- Access-Control-Allow-Origin: CORS misconfig dapat menimbulkan data leak.
- X-Content-Type-Options: jika hilang → potensi MIME sniffing & XSS via upload.
- Strict-Transport-Security: jika hilang → rentan SSL stripping.
- Set-Cookie flags: cek
HttpOnly
,Secure
,SameSite
.
Contoh Praktis: Ambil Header dengan curl
curl -I https://target.com
Missing X-Content-Type-Options
— PoC
Jika header ini hilang dan aplikasi punya upload, kamu bisa melakukan PoC XSS via file upload:
- Buat file
evil.jpg
berisi:<script>alert('XSS')</script>
- Upload ke target (halaman upload terbuka).
- Cek header file hasil upload:
curl -I https://target.com/uploads/evil.jpg
- Buka file di browser. Jika popup muncul, itu Stored XSS.
Contoh Response yang Perlu Diwaspadai
HTTP/1.1 200 OK Server: Apache/2.4.41 (Ubuntu) Content-Type: text/html Set-Cookie: PHPSESSID=...; Path=/
Trace Enabled (XST)
Jika server merespon TRACE
dengan 200
, maka server memantulkan header request — ini berpotensi menyebabkan cookie leak jika gabungan kondisi terpenuhi.
curl -v -X TRACE https://target.com
Cek CORS Misconfiguration
Contoh header berbahaya:
Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true
Jika kedua header di atas hadir bersamaan, attacker dapat menulis JS untuk baca data user yang sedang login.
Rangkuman Prioritas
- High CORS risky endpoints, TRACE + cookies present
- Medium Missing X-Content-Type-Options with upload
- Low Server version leak (tapi bisa tingkatkan jadi critical jika versi vulnerable)
Contoh Script: Quick Header Scanner (bash)
#!/bin/bash # Simple header checker TARGET="$1" if [ -z "$TARGET" ]; then echo "Usage: $0 https://target.com" exit 1 fi curl -s -I "$TARGET" | egrep -i 'server|x-powered-by|set-cookie|access-control|strict-transport-security|x-content-type-options' -n
Gunakan di lingkungan lab / CTF. Jangan uji ke sistem tanpa izin.
Template Laporan (PoC)
Title: Missing X-Content-Type-Options → Stored XSS (PoC) Target: https://target.com Steps: 1. Upload file evil.jpg (contains <script>...) 2. Access https://target.com/uploads/evil.jpg 3. Observe script execution Impact: Stored XSS → cookie theft / account takeover Recommendation: Add header X-Content-Type-Options: nosniff; validate upload MIME & sanitize files