Server-side request forgery (SSRF) is a vulnerability in which an attacker tricks a server into making a request to a destination the attacker chooses. It happens when an application fetches a URL supplied by a user without checking where that request may go. The server can then reach internal services, localhost, and cloud metadata endpoints that the attacker cannot reach directly.
Key takeaways
- SSRF lets an attacker borrow your server's network position, identity, and trust to reach internal systems.
- In the cloud, SSRF can steal temporary credentials from the metadata service at 169.254.169.254.
- The reliable fix is layered: allow-lists where possible, resolved-IP checks, redirect re-checks, IMDSv2, and least privilege.
Your server fetches things all the time: profile pictures, webhook payloads, link previews, imported feeds. SSRF turns that ordinary feature into an open door. An attacker supplies a URL, your server follows it, and suddenly the attacker is reaching systems that were never meant to face the internet.
What is SSRF?
Server-side request forgery, or SSRF, is a flaw where an application fetches a URL that a user can influence without restricting where that request may go. The attacker cannot reach the target directly, so they borrow the server's network position, identity, and trust to reach it for them.
OWASP describes it plainly: an attacker can abuse functionality on the server to read or update internal resources, by supplying or modifying a URL that the code running on the server will read. The request leaves from your server, not from the attacker's machine, so it passes firewalls that would stop the attacker.
MITRE catalogs the weakness as CWE-918: Server-Side Request Forgery. It is a base weakness, and it sits in the OWASP Top 10 story too: SSRF was A10 in the 2021 list, and in the 2025 edition OWASP maps CWE-918 into A01 Broken Access Control. The move reflects framing, not a lower risk.
How does an SSRF attack work?
An SSRF attack follows four steps: the application offers a feature that fetches a URL, the attacker supplies a malicious URL, the server makes the request with its own privileges, and the attacker reads or uses the result. The feature itself is usually legitimate.
Common entry points are easy to recognize once you look for them. A profile-picture upload that fetches an image from a URL, a link-preview feature, an RSS or feed importer, a PDF generator that loads a web page, a webhook configuration, and an API that accepts a callback URL are all classic SSRF surfaces.
The attacker then points that feature at something interesting. Typical targets include http://localhost/admin, internal services on private addresses such as 10.0.0.0/8 or 192.168.0.0/16, databases with HTTP interfaces, and the cloud metadata service at http://169.254.169.254/.
SSRF vs CSRF: what is the difference?
SSRF and CSRF sound similar but attack opposite ends. SSRF tricks the server into making a request, while CSRF tricks a user's browser into making a request. In SSRF, the request carries the server's trust; in CSRF, it carries the victim's session.
| SSRF | CSRF | |
|---|---|---|
| Who makes the request | Your server | The victim's browser |
| Whose trust is abused | The server's network position and cloud role | The victim's logged-in session and cookies |
| Typical target | Internal services, localhost, cloud metadata | State-changing actions on a site the victim uses |
| Typical entry point | URL-fetching features, webhooks, imports | A malicious page or link the victim visits |
| Main fix | Allow-lists, resolved-IP checks, IMDSv2 | Anti-CSRF tokens, SameSite cookies |
Both flaws come from trusting a request that the user influenced. The difference is where the request originates, and therefore what it can reach. Keep the two names straight when you write a report or a fix, because the controls are different.
What are the types of SSRF?
SSRF is usually split into basic SSRF, where the response is visible, and blind SSRF, where it is not. Both are dangerous, and blind SSRF is often missed because testers see no data come back.
Basic SSRF
In basic SSRF, data from the forced back-end request is reflected in the application's front end. The attacker asks the server to fetch an internal page and the application shows the result, for example by displaying the fetched image or page content.
Blind SSRF
In blind SSRF, the application makes the back-end request but does not show the response. The attacker confirms the attack through timing, out-of-band callbacks to a server they control, or side effects such as a triggered email or a changed record.
Blind SSRF is commonly used to scan internal networks. The attacker tries many internal addresses and ports, and watches which ones respond quickly, slowly, or not at all. That timing alone can map an internal network.
Other SSRF variants
SSRF is not limited to HTTP. The first request is usually HTTP, but the server-side request can use other protocols and schemes, including file://, gopher://, dict://, FTP, and SMTP. A file:// URL can read local files, which turns an SSRF flaw into a local file disclosure.
Why does the cloud make SSRF worse?
The cloud makes SSRF worse because the server's network position now comes with an identity. Cloud servers can ask the metadata service for temporary credentials, and those credentials can open storage, databases, and other cloud services.
OWASP's SSRF page names cloud metadata as a key target: cloud services provide a REST interface at http://169.254.169.254/ where configuration and sometimes authentication keys can be extracted. On AWS, the instance metadata service returns the name of the attached IAM role, then temporary credentials for that role.
That is why the same bug has a very different impact in the cloud. On a traditional server, SSRF might read an internal admin page. On a cloud server with a broad IAM role, it can hand the attacker the keys to your storage buckets. The fix therefore has two halves: stop the request, and limit what a successful request could reach.
What are real examples of SSRF?
The best-known SSRF case is the 2019 Capital One breach, in which an SSRF flaw was used to reach the AWS metadata service and steal temporary credentials. It shows how a single URL-handling bug can become a breach of more than 100 million records.
Capital One, 2019
In 2019, Capital One disclosed a breach affecting about 106 million credit card applicants in the US and Canada. A former AWS engineer exploited an SSRF vulnerability in a web application firewall running on an EC2 instance, then used it to query the AWS metadata service at 169.254.169.254.
The metadata service returned temporary credentials for the instance's IAM role. That role had broad access, and the attacker used the credentials to access more than 700 S3 buckets containing credit applications, including about 140,000 Social Security numbers and 80,000 bank account numbers, according to case reporting. Capital One later paid an $80 million regulatory penalty.
The lesson is not only about SSRF. The SSRF opened the door, but the over-permissioned IAM role decided how far the attacker could go. Fix both, or the next flaw in the chain will do the same job.
Other places SSRF shows up
SSRF has appeared in image-processing services, PDF generators, link previewers, and webhook features across many products. PortSwigger's SSRF guidance notes that attackers also use SSRF to scan internal systems, read files through file:// URLs, and trigger requests to internal services that were never meant to be exposed.
Security teams also see SSRF in modern AI features. An AI agent with a fetch tool is an SSRF surface: if a prompt can steer the tool to an internal URL, the agent will fetch it. The same controls apply — narrow tools, allow-lists, and least privilege — and they must not rely on the model to judge safety.
How do you detect SSRF?
Detect SSRF by looking for user input that reaches an outgoing request, then testing whether the server will fetch internal destinations. Code review, dynamic testing, and logging all have a role, and none of them is enough alone.
- Code review: search for HTTP clients that take a URL from user input, webhook handlers, and URL-fetching features. Follow the data from the request to the outgoing call.
- Static analysis: taint-tracking tools can follow input from a request to the URL of an outgoing request. CWE-918 rates static analysis as highly effective for this weakness.
- Dynamic testing: in a test environment you control, point the feature at your own internal test server, localhost, and the metadata address, and see whether the server reaches them.
- Logging: log outbound requests from application servers, including destination host and IP. An application server calling 169.254.169.254 or a private address is a finding, not normal traffic.
Our security headers checker will not find SSRF for you — it lives in application logic, not in headers.
Use the SSL checker as part of a wider website check, and test URL-handling features separately.
How do you prevent SSRF?
No single control prevents SSRF. The reliable approach is layered: restrict destinations in code, back that up in the network, and limit what a successful request could reach. The OWASP SSRF Prevention Cheat Sheet is the best single reference for this.
1. Allow-list destinations where you can
If your application only talks to known hosts — one media host, one partner API — keep an allow-list and refuse everything else. Better still, let the user pick an identifier and build the URL in your code, so the scheme, host, and port all come from you.
2. Validate the resolved IP address
When any public URL must be allowed, such as for link previews, check the address the socket will actually use, not just the string the user typed. Resolve the hostname, then block private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), loopback (127.0.0.0/8, ::1), and link-local (169.254.0.0/16, fe80::/10).
This matters because deny-lists of hostnames fail. An attacker can register a domain that resolves to 127.0.0.1, use DNS rebinding to change the answer after your check, or encode the address as a decimal or IPv6 form. OWASP is blunt: deny-lists are bypass-prone, so prefer allow-lists.
3. Block dangerous schemes and re-check redirects
Allow only http and https, and only the ports you expect. Reject file://, gopher://, ftp://, and dict://. Disable redirect following in your HTTP client, or re-validate every redirect hop through the same checks, because an allow-listed URL that redirects to 169.254.169.254 defeats a hostname-only check.
4. Harden the cloud and the network
On AWS, require IMDSv2 and disable IMDSv1, following the AWS guidance on configuring the instance metadata service. Give each server the smallest cloud role it needs, and block metadata and private ranges at the network layer too, so an application bug is not the last line of defense.
Route user-driven fetches through an isolated outbound proxy with its own allow-list, separate from your internal service traffic. That way a successful SSRF has nothing valuable to reach, even if a check is bypassed.
What is the SSRF prevention checklist?
Use this checklist in code review and before shipping any feature that fetches a URL. If you cannot tick every box, the feature is not ready.
- Redesign first: can users pick an ID instead of supplying a URL?
- Allow-list: scheme, host, and port are explicit where the destination set is known.
- Resolved-IP check: private, loopback, and link-local addresses are blocked after DNS resolution.
- Redirects: redirect following is disabled, or every hop is re-validated.
- DNS rebinding: the check runs on the address used at connection time, not on a separate lookup.
- Cloud: IMDSv2 is required, IMDSv1 is disabled, and cloud roles follow least privilege.
- Network: outbound traffic from application servers is restricted, and metadata addresses are blocked.
- Logging: outbound requests are logged, and calls to internal or metadata addresses alert.
For a wider starting point, our small business cybersecurity checklist covers these controls alongside backups, updates, and device security. SSRF is one pattern to trace in every security code review.
The bottom line
SSRF is simple to explain and easy to miss: your server fetches a URL the attacker chose, and the server's trust does the rest. In the cloud, that can mean stolen credentials and breached storage, as Capital One showed.
Fix it in layers — allow-lists, resolved-IP checks, redirect re-checks, IMDSv2, and least privilege — and test URL-fetching features as carefully as you test logins. You can start by checking your own site's basic posture with the free security headers checker.
Frequently asked questions
What is SSRF in simple terms?
SSRF is when an attacker gets your server to make a request to a destination they choose. Your application fetches a URL from user input without checking it, so the server reaches internal systems, localhost, or cloud metadata that the attacker cannot reach directly.
What is the difference between SSRF and CSRF?
SSRF tricks the server into making a request, while CSRF tricks a user's browser into making a request. In SSRF the request comes from your server with its trust and network access. In CSRF the request comes from the victim's browser with their cookies and session.
Is SSRF still in the OWASP Top 10?
SSRF was its own category, A10, in the OWASP Top 10 2021. In the 2025 edition there is no standalone SSRF category. OWASP maps CWE-918 into A01 Broken Access Control, so it was merged rather than removed, and the risk is unchanged.
What is blind SSRF?
Blind SSRF is SSRF where the application does not show you the response from the internal request. The attacker still causes the request, and can confirm it worked through timing, out-of-band callbacks, or side effects such as a password reset email being triggered.
What is the cloud metadata address attackers target?
On AWS, Google Cloud, and Azure, the instance metadata service is reachable at 169.254.169.254. It can return temporary credentials for the server's cloud role. That is why SSRF in the cloud is often a credential-theft problem, not just a data-reading problem.
How do you prevent SSRF?
Use an allow-list of destinations where possible, and let users pick an identifier while your code builds the URL. Otherwise validate the resolved IP address, block private, loopback, and link-local ranges, re-check redirects, require IMDSv2, and give the server least-privilege cloud permissions.
Can a WAF stop SSRF?
A web application firewall can help, but it is not a reliable fix on its own. SSRF is a flaw in how the application handles user-supplied URLs, so the fix belongs in the application code and the network layer. A WAF should be an extra layer, not the only control.
How do you test for SSRF safely?
Test only on systems you own or have written permission to test. Use your own internal test server and a public collaborator-style endpoint you control, and try internal addresses such as localhost and 169.254.169.254 to see whether the server reaches them. Never probe someone else's production systems.
Sources
- OWASP — Server Side Request Forgery
- OWASP Cheat Sheet Series — Server-Side Request Forgery Prevention Cheat Sheet
- MITRE CWE — CWE-918: Server-Side Request Forgery (SSRF)
- AWS — Use IMDSv2
- PortSwigger — What is SSRF (Server-side request forgery)?
- BreachSense — Capital One Data Breach: How 106 Million Records Were Stolen
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against the OWASP SSRF pages and prevention cheat sheet, MITRE CWE-918, and AWS IMDSv2 documentation.
How we write and fact-check →