Server-Side Request Forgery (SSRF)

The server fetches a URL or contacts a host chosen by the user, so an attacker can make it send requests to internal systems or cloud services it can reach.

SeverityHigh
CVSS 3.17.2 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N Open in the calculator
CVSS 4.06.9 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N Open in the calculator
CWECWE-918: Server-Side Request Forgery (SSRF)
OWASP Top 10A01:2025 Broken Access Control
MITRE ATT&CKT1190 Exploit Public-Facing Application, T1552.005 Cloud Instance Metadata API, T1046 Network Service Discovery
CategoryInput Validation

Description

The application makes HTTP or other network requests to an address that the user supplies or influences, for example when importing a file or image from a URL, generating a link preview, calling a webhook, rendering a page to PDF, or passing a host name or path to a back-end service. The request comes from the server, so it can reach systems that the attacker cannot: services bound to the loopback interface, hosts on the internal network, and the cloud instance metadata service at 169.254.169.254.

An attacker can therefore use the server to reach systems behind the perimeter: reading data from internal web services and administration interfaces that trust requests from the internal network, scanning internal hosts and ports, and, on cloud platforms, querying the instance metadata service to obtain temporary credentials for the server's cloud identity. The impact depends on what the server can reach and whether responses are returned to the attacker; full responses, a metadata service that accepts simple requests and internal services without authentication raise it considerably.

SSRF typically shows itself on a test when a URL pointing to a server under the tester's control receives a request from the application, which Burp Suite reports as an external service interaction, and is then confirmed by targeting internal addresses and comparing responses, error messages and timings. In blind cases the response is never returned, and only timing or out-of-band interactions show that requests are made. Filters that block internal addresses are often incomplete and can be bypassed with alternative IP notations, DNS names that resolve to internal addresses, redirects from an allowed host, or differences between URL parsers.

Remediation

Control where the server's outbound requests can go:

  • Where the destinations are known in advance, allow only those: map user choices to fixed URLs, or check the scheme, host and port of each request against an exact allowlist.
  • Where arbitrary URLs must be fetched, allow only http and https, resolve the host name, refuse the request if any resolved address is in a loopback, private, link-local or other internal range, and connect to the address that was checked, so that a DNS change between the check and the request cannot redirect it. Disable automatic following of redirects, or repeat the check for each one.
  • Do not return raw responses or detailed connection errors from fetched resources to the user.
  • Send outbound requests through an egress proxy or network segment that cannot reach internal ranges or the metadata service.
  • On cloud platforms, require the token-based version of the metadata service where available (IMDSv2 on AWS), and give the server's cloud identity only the permissions it needs.

Confirm the fix by repeating the original requests against internal addresses, alternative IP notations and redirecting URLs, and checking that each is refused.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Web Applications Findings

Every Web Applications finding