SSRF (Server-Side Request Forgery)
Last updated
Was this helpful?
Last updated
Was this helpful?
A Server-Side Request Forgery (a.k.a. SSRF) is a web vulnerability allowing attackers to make the server-side application do certain requests. This vulnerability can lead to unauthorized actions, Sensitive Information Disclosure and even RCE (Remote Code Execution).
Testers need to find input vectors and fields that could be used for publishing or importing data from a URL (e.g. GET
and POST
parameters).
With http://some.website/index.php?url=https://someother.website/index.php
, and url
being the vulnerable parameter, the following basic payloads can help a tester fetch content of files, scan ports, access filtered resources and so on.
To scan for a specific range of private IP addresses (other than localhost
), Use burp suite intruder that can fetch all of IP addresses in the internal network that is targeted.
In order to conduct SSRF attacks properly, there may be use cases where filters need to be bypassed
Some applications block input containing hostnames like 127.0.0.1
and localhost
, or sensitive URLs like /admin
. In this situation, you can bypass the filter using various techniques :
Using an alternative IP representation such as :
Obfuscating string using URL encoded, even double URL encoded sometimes.
Registered your own domain name that resolved the localhost
IP address.
A blind SSRF vulnerability is a type of vulnerability that arises when an application makes a request to an external resource using user-supplied input, but the application does not return the response to the user.
It can be achieved to gain full RCE (Remote Command Execution).
In order to identify a potential SSRF vulnerability and exploit, multiple tools can be used to pingback the request and see the response.
The configuration below is insecure and allows to connect to an arbitrary backend, since the SNI field value is used directly as the address of the backend.
With this insecure configuration, it is possible to exploit the SSRF vulnerability simply by specifying the desired IP or domain name in the SNI field. For example, the following command would force the server to connect to internal.host.com
:
It is possible to use SSRF that return the command output inside an out of band connection as follows.
The following "URL Format Bypass" cheatsheet gives lots of examples to bypass filters:
In the case the argument is strictly validated and doesn't allow for bypasses relying on pattern validation, if one of the whitelisted app's pages is vulnerable to an , it could be used to make the SSRF possible anyway.
An extension to add to Burp Suite, called "", that adds non-invasive payloads into outgoing HTTP requests' headers in order to detect SSRF vulnerabilities if and when the target pingbacks to the collaborator endpoint.
An effective way to abuse blind SSRF is to combine it with a shellshock vulnerability (). See the following resource for more details: . The "" extension can be used to detect and abuse this as well.
More information about this on .
(Python) is a tool used to ease the exploitation of SSRFs. (Python) can be used as well to gain RCE (Remote Code Execution) by generating Gopher payloads.