Server-Side Request Forgery (SSRF), is a vulnerability that allows an attacker to induce the server-side of the application to make requests to arbitrary locations, leading to unauthorized access to internal services or files within the application or even external functions of other services.
Examples of this vulnerability are:
However, this vulnerability is not limited to HTTP protocol, you can perform requests to different protocols such as
Finally, this vulnerability is hard to find in the wild and requires manual analysis to find a valid input. So there is no special trick to finding them.
Commonly, most applications with SSRF behaviour are built with defences trying to prevent malicious exploitation. In order to bypass these defences, there are several approaches.
Some applications might block input containing hostnames like
localhost, which can be circumvented using the following techniques:
- Alternative representation of
127.0.0.1: 2130706433, 017700000001, 127.1
- Registering a domain/subdomain that resolves into 127.0.0.1.
- Obfuscate the blocked string using URL encoding or case variation.
In this case, the application only allows input that contains, begins or ends with a certain string. In this case, you can circumvent the filter with the following techniques:
- URL encoding.
- Combinations of all of the above.