SSRF
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
Server-Side Request Forgery (SSRF) vulnerabilities come in two main types: In-Band SSRF and Blind SSRF.
In-Band SSRF occurs when the server responds with the resources specified by the attacker. The attacker supplies a payload, and the server makes the request, responding with information served from the specified URL.
Intercepted Request:
POST api/v1/store/products
headers...
{
"inventory": "http://store.com/api/v3/inventory/item/12345"
}
Attack:
POST api/v1/store/products
headers...
{
"inventory": "http://localhost/secrets"
}
Response:
HTTP/1.1 200 OK
{
"secret_token": "crapi-admin"
}
In this example, the server makes a request to the specified URL (http://localhost/secrets
) and responds with the information from that URL.
Blind SSRF occurs when the server makes a request from user input but does not send information from the specified URL back to the user. The attacker won't receive a direct response, and to confirm the attack, they need control over a web server to capture the request made by the target server.
Intercepted Request:
POST api/v1/store/products
headers...
{
"inventory": "http://store.com/api/v3/inventory/item/12345"
}
Attack:
POST api/v1/store/products
headers...
{
"inventory": "http://localhost/secrets"
}
Response:
HTTP/1.1 200 OK
{}
In this case, the server makes the request, but the response doesn't contain information from the specified URL. To confirm the attack, the attacker would need to control a web server and check for incoming requests.
To test Blind SSRF, tools like Burp Suite Collaborator or external services like http://webhook.site can be used. These services provide a unique URL, and any requests made to this URL can be monitored.
Set up a test payload, including the unique URL from the testing service.
Send the payload to the target and check the testing service for any incoming requests.
When targeting an API for SSRF vulnerabilities, look for requests that:
Include full URLs or URL paths in POST bodies or parameters.
Include URLs in headers (e.g., Referer).
Allow user input that may result in the server retrieving resources.
Proxy the target requests through a tool like Burp Suite.
Send the request to the Repeater tool to understand the typical response.
For Blind SSRF, use services like http://webhook.site to monitor incoming requests.
Use tools like Pitchfork in Burp Suite to pair valid input with SSRF payloads.
Review responses for anomalies, unexpected status codes, or response lengths.
Confirm Blind SSRF attacks by checking the testing service for incoming requests.