Server-Side Request Forgery

high Web Application Scanning Plugin ID 112439

Synopsis

Server-Side Request Forgery

Description

Web applications often rely on network requests to query external resources and retrieve data in order to process it.

A Server-Side Request Forgery (SSRF) vulnerability exists when an attacker is able to control these outbound requests and send it to a resource he owns, to the localhost itself, or to a private host in the target application internal network.

By injecting a specific request and using various protocols (like HTTPS or Gopher for example), the attacker can leverage this vulnerability to try gaining access to sensitive data, performing unauthorized modifications or getting remote code execution in the target environment.

Depending on the web application configuration, the vulnerability may be of three types:

- Blind : the application executes the malicious request but does not return any response to the attacker. The exploitation is difficult as the attacker has to only rely on his own knowledge of the target to conduct his attack.

- Half-blind : the malicious request is executed and the response is partially returned to the the attacker. For example, the application may return different error messages related to the status of the outbound request. The exploitation remains difficult, however the attacker can gather information to help conducting his attack further.

- Non-blind : The application returns the full content of the response to the malicious request. The exploitation is easier and generally makes the impact of this vulnerability more critical.

The scanner has been able to detect a Server-Side Request Forgery vulnerability by injecting a crafted request in the target application which performed an external request and returned a partial or full response.

Solution

The mitigation mainly depends on the application purpose and design but it is generally recommended to apply the defense in depth principle and enforce controls at both application and network layers.
In the application, inputs are processed by a parser which can be abused in various cases. It is recommended to avoid allowing the user to send full URLs to the application and to validate hostnames or IP addresses against a whitelist, if applicable, prior performing the request. Otherwise, using a blacklist is a solution to prevent requests to the localhost and all the assets of the internal infrastructure. As applications sometimes use a library such as libcurl for performing the requests, ensure that the component is up-to-date to avoid exploitation of a security vulnerability in the parser itself.
At the network layer, an approach is to implement network segregation to control and limit traffic between the hosts of the infrastructure and use security services like firewalls or web proxies to enforce the network restrictions.

See Also

https://resources.infosecinstitute.com/the-ssrf-vulnerability

https://owasp.org/www-community/attacks/Server_Side_Request_Forgery

https://www.blackhat.com/docs/us-17/thursday/us-17-Tsai-A-New-Era-Of-SSRF-Exploiting-URL-Parser-In-Trending-Programming-Languages.pdf

https://www.bugcrowd.com/resources/webinars/server-side-request-forgery

https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html

Plugin Details

Severity: High

ID: 112439

Type: remote

Published: 6/9/2020

Updated: 6/2/2022

Scan Template: api, scan, pci

Risk Information

CVSS v2

Risk Factor: High

Base Score: 7.5

Vector: AV:N/AC:L/Au:N/C:P/I:P/A:P

CVSS Score Source: Tenable

CVSS v3

Risk Factor: High

Base Score: 7.3

Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L

CVSS Score Source: Tenable

Reference Information