Tag: SSRF

  • What Is SSRF? Server-Side Request Forgery Explained with Examples and How to Prevent It

    Server-side request forgery is one of those bugs that looks small on the surface and turns out to be serious underneath. A feature that fetches a link preview or imports an image from a URL seems harmless, but if the server will fetch any address you give it, an attacker can use your own server to reach systems that were never meant to be public. In this guide we explain what server-side request forgery (SSRF) is, the main types with simple examples, what attackers can do with it, how testers find it, and how to prevent it.

    What is server-side request forgery (SSRF)?

    Server-side request forgery (SSRF) happens when an application takes a URL or address from the user and makes a request to it from the server, without properly checking where that request is going. The attacker cannot reach your internal network directly, but your server can. So the attacker asks your server to make the request for them.

    Think of it like asking a receptionist to fetch a document. Visitors are not allowed into the back office, but if the receptionist will fetch anything a visitor asks for, the visitor can get documents from the back office without ever walking in.

    SSRF had its own category (A10) in the OWASP Top 10 2021, is grouped under Broken Access Control in the 2025 edition, and is a separate item (API7) in the OWASP API Security Top 10 (2023), because modern apps and APIs fetch remote URLs all the time.

    A simple example

    Imagine a shop that lets users add a product image by pasting a link:

    POST /api/products/123/image
    {"image_url": "https://cdn.example.com/shoe.png"}

    The server downloads the image from that URL and saves it. A normal user pastes an image link and everything works. Now an attacker sends this instead:

    POST /api/products/123/image
    {"image_url": "http://localhost:8080/admin/users"}

    If the server fetches the address without checks, it is now talking to its own admin panel on localhost, a service that is only reachable from inside the server. Depending on how the feature works, the response may be shown back to the attacker, stored as the “image”, or leak through an error message.

    Where SSRF usually hides

    Any feature where the server fetches something based on user input is a candidate:

    • Link previews and URL unfurling in chats and comments
    • “Import from URL” for images, files, documents and feeds
    • Webhooks, where users enter a callback URL that your server calls
    • PDF and screenshot generators that render a page or HTML the user controls
    • Integrations that connect to a user-supplied server, such as an SMTP, FTP or database host
    • XML and document parsers that follow external references
    • API parameters that take a full URL, a hostname or an IP address

    The main types of SSRF

    1. Basic (in-band) SSRF

    The server fetches the attacker’s URL and returns the response to them. This is the easiest to spot and the most damaging, because the attacker can read internal pages directly.

    2. Blind SSRF

    The server makes the request but does not show the response. The attacker cannot read the data, but they can still confirm the request happened, for example by pointing it at a server they control and watching for the incoming connection. Blind SSRF is often used to scan internal networks, by timing how long requests take or comparing error messages for open and closed ports.

    3. Semi-blind SSRF

    Only part of the response leaks, such as a status code, a response time, an error message or a page title. That can still be enough to map internal services.

    What attackers can do with SSRF

    • Reach internal admin panels and services that trust any request coming from inside the network, such as dashboards, monitoring tools and internal APIs.
    • Steal cloud credentials. Cloud servers have a metadata service at a special internal address, 169.254.169.254 on AWS, Azure and Google Cloud. On older setups, a request to it from the server can return temporary access keys for the cloud account. This is the path behind several well-known cloud breaches, including the 2019 Capital One incident.
    • Scan the internal network to find which hosts and ports exist behind the firewall.
    • Bypass IP allowlists, because the request comes from a trusted server address.
    • Pivot to other attacks against internal services that were never hardened because they were “not exposed to the internet”.

    How security testers find SSRF

    In a penetration test we look for every place the server fetches something on the user’s behalf, then check what it will and will not fetch:

    1. Map the inputs. Find parameters named like url, link, callback, webhook, image, feed, host or redirect, plus any field that accepts a full URL.
    2. Confirm the server makes the request. Point the input at a testing endpoint we control and check for the incoming connection. Burp Suite Professional’s Collaborator is the usual tool for this, especially for blind SSRF.
    3. Try internal targets in a safe, agreed way: localhost, 127.0.0.1, private ranges like 10.0.0.0/8 and 192.168.0.0/16, and the cloud metadata address.
    4. Test the filters. Many apps block the obvious strings but miss other ways of writing the same address, such as decimal or IPv6 forms of an IP, redirects from an allowed domain to an internal one, or a domain name that resolves to an internal address.
    5. Check other URL schemes such as file:// and gopher://, which some libraries still support.

    Every SSRF finding in our reports includes the exact request, what the server could reach, the business impact, and clear fix steps.

    How to prevent SSRF

    1. Use an allowlist, not a blocklist

    Decide exactly which domains or hosts the feature needs to reach and reject everything else. Blocklists that try to ban localhost and private IPs are easy to get around.

    2. Validate the resolved IP address, not just the text

    Resolve the hostname, check that the resulting IP is not private, loopback, link-local or otherwise internal, then connect to that same checked IP. This stops tricks where a harmless-looking domain points to an internal address, including DNS rebinding.

    3. Do not follow redirects blindly

    Disable automatic redirects, or re-validate the destination of every redirect against the same rules.

    4. Allow only the schemes you need

    For most features that means https only. Turn off file, gopher, ftp and anything else in your HTTP client.

    5. Do not return raw responses

    If the feature fetches an image, check that the response really is an image and return only what the user needs. Never pass internal error messages or full response bodies back to the user.

    6. Protect cloud metadata

    On AWS, require IMDSv2, which needs a session token and blocks simple SSRF requests to the metadata service. Give servers only the cloud permissions they actually need, so stolen credentials are worth less.

    7. Isolate the fetching service

    Run URL-fetching features in a separate service or network segment that has no route to internal systems, and use firewall rules to block outbound traffic to internal ranges.

    Quick SSRF checklist for developers

    • Does every feature that fetches a URL use a strict allowlist of hosts?
    • Is the resolved IP checked against private, loopback and link-local ranges before connecting?
    • Are redirects disabled or re-validated?
    • Are only https (and http if truly needed) allowed?
    • Are raw responses and detailed errors kept away from users?
    • Is IMDSv2 enforced and are cloud permissions kept to the minimum?
    • Is the fetching service blocked from reaching internal networks?

    Frequently asked questions

    Is SSRF only a problem in the cloud?

    No. Any server that can reach internal systems is at risk, including on-premises networks. The cloud makes it more serious because of the metadata service and the credentials it can expose.

    Can a web application firewall stop SSRF?

    A WAF can block some obvious payloads, but it cannot know which internal addresses your app is allowed to reach. Proper validation in the application and network isolation are the real fixes.

    How is SSRF different from an open redirect?

    An open redirect sends the user’s browser to another site. SSRF makes your server send the request. The two are often combined: an allowed domain with an open redirect can be used to slip past an SSRF allowlist.

    Do APIs need SSRF testing too?

    Yes. Webhooks, integrations and import features are very common in APIs, which is why SSRF has its own place in the OWASP API Security Top 10.

    Get your application tested

    At Bugfynd we test web applications, APIs and thick client apps for SSRF and the rest of the OWASP Top 10 with manual testing, not just scanners, and every finding comes with clear fix steps and a free retest. See what you receive in our sample pentest reports, or learn to find these bugs yourself in our web application pentesting course, taught in English and Telugu, with a new batch starting 7 December 2026.

    Questions or a project to discuss? Email contact@bugfynd.com or message us on WhatsApp.