Server-Side Request Forgery (SSRF) attacks, listed in the OWASP top 10, allow us to abuse server functionality to perform internal or external resource requests on behalf of the server. We usually need to supply or modify URLs used by the target application to read or submit data. Exploiting SSRF vulnerabilities can lead to:
- Interacting with known internal systems
- Discovering internal services via port scans
- Disclosing local/sensitive data
- Including files in the target application
- Leaking NetNTLM hashes using UNC Paths (Windows)
- Achieving remote code execution
Suppose we are assessing such an API residing in
http://<TARGET IP>:3000/api/userinfo
.
Let us first interact with it.
API is expecting a parameter id
.
Since we are assessing for SSRF currently, we will first set up Netcat listener:
Now let’s try the following command, pointing towards our listener:
We notice an error about the id parameter being invalid, and we also notice no connection being made to our listener.
Let’s try base64 encoding and sending it again:
When you make the API call, you will notice a connection being made to your Netcat listener. The API is vulnerable to SSRF.
As time allows, try to provide APIs with input in various formats/encodings.