githubEdit

SSRF

Manipulate a web application into making requests to arbitrary URLs from the server.


URL Schemes

Scheme
Use Case

http:// / https://

Access internal endpoints, bypass WAFs

file://

Read local files (LFI)

gopher://

Send arbitrary bytes (POST requests, DB queries)


Confirm SSRF

# Start listener
nc -lnvp 8000

# Inject your URL in vulnerable parameter
http://YOUR_IP:8000/ssrf

If you receive a connection, SSRF is confirmed.


Internal Port Scan

Generate Ports Wordlist

Fuzz Open Ports


Enumerate Internal Endpoints


Local File Inclusion via SSRF


Curl Argument Injection (Multiple URL Abuse)

When the backend uses curl and passes user input directly, curl's multiple URL feature can be abused.

LFI via Multiple URLs

Curl processes multiple space-separated URLs. If input isn't properly sanitized:

Example exploitation:

This works because curl treats http://127.0.0.1 and file:///etc/passwd as two separate requests.

File Exfiltration via --data @

Abuse curl's --data @filename option to POST file contents to attacker:

Example:

The target server will POST the contents of /etc/passwd to your listener.

Other Useful Curl Arguments

Detection

Look for User-Agent in requests:

This indicates curl is making backend requests and may be vulnerable to argument injection.


Gopher Protocol (Send POST Requests)

Use gopher to send arbitrary HTTP requests (e.g., POST with body).

Manual Gopher URL

Note: URL-encode the gopher URL twice when injecting into a POST parameter.

Gopherus (Generate Gopher URLs)


Blind SSRF

No response reflected, but can still:

  • Port scan (different error messages for open/closed)

  • Enumerate files (different errors for existing/non-existing)

  • Send payloads to internal services blindly

Detect Open Ports (Blind)

Look for different error messages:

  • Closed port: Something went wrong!

  • Open port: Date unavailable (or different error)


SSRF Bypass Techniques

Localhost Alternatives

URL Encoding

Double URL Encoding

Decimal IP

Hex IP

DNS Rebinding

Point a domain to internal IP after initial DNS check passes.


Cloud Metadata Endpoints

AWS

GCP

(Requires header: Metadata-Flavor: Google)

Azure

(Requires header: Metadata: true)


Common SSRF Parameters

Last updated