offsecnotes

SSRF

by frankheat

SSRF attack

SSRF attacks against the server itself

api=http://localhost/admin

SSRF attacks against other back-end systems

api=http://192.168.0.68/admin

Protocols

If you can control the protocol you can change it.

file://, sftp://, gopher://, etc.

Tip: With gopher in some case it is possible to get a shell. E.g. interacting with mysql, redis PostgreSQL, etc. https://github.com/tarunkant/Gopherus.


Blind

Difficult to exploit because you will be able to exploit only well-known vulnerabilities.

Detection: Out-of-band techniques


Bypass SSRF defenses

Blacklist-based

Whitelist-based

Bypassing SSRF filters via open redirection

  1. Identify endpoint with open redirect

    https://website.com/login?redirect=/my-account
  2. Have the server execute a request that performs a redirect

    # Original
    api=http://website.com/product?productId=6
    # Exploit
    api=http://website.com/login?redirect=http://192.168.0.68/admin

Finding hidden attack surface for SSRF