Short answer: AWS SSRF is a server-side request forgery flaw in an application hosted on AWS that lets an attacker make your server call an address they choose, most often the instance metadata service at 169.254.169.254, which can return temporary credentials for the instance’s IAM role.

Requiring IMDSv2, validating the final destination of every outbound request and keeping that role narrow close most of that path. SSRF checks are part of the OWASP Top 10 coverage in our web application and API tests, which typically cost $2,500 to $5,500. In practice the SSRF that matters rarely sits in an obvious “fetch this URL” box: in our own webhook case study, a private IP typed in directly was blocked, and a redirect to the same kind of target was not.

What is SSRF, and why is it worse in the cloud?

Server-side request forgery happens when an application takes a URL or host from a user and fetches it from its own servers. The request now comes from inside your network, with your server’s identity, and it can reach places the attacker can’t: internal APIs, admin panels, databases with an HTTP interface and the instance metadata service, which answers only from inside the machine. OWASP gave the weakness its own category, A10:2021, in the 2021 Top 10. The 2025 edition maps the same weakness, CWE-918, into A01 Broken Access Control, which is a fair description of what it does: it walks past a boundary you thought was closed.

In a data center, SSRF usually means internal network access. In the cloud it often means credentials. AWS, Azure and Google Cloud each run a metadata service that answers only from inside the machine, and the OWASP SSRF Prevention Cheat Sheet lists 169.254.169.254 for all three. On AWS, that service hands the workload temporary credentials for the IAM role attached to the instance. An attacker who reads them can call cloud APIs with the role’s permissions from anywhere, for as long as the credentials stay valid. The SSRF itself is the door. The role is what decides whether the attacker finds an empty corridor or your storage, queues and secrets. What else an AWS test covers, and what the AWS policy allows, is in our AWS penetration testing guide.

Azure’s Instance Metadata Service sits at the same address and adds a gate: requests must carry a Metadata: true header and must not carry an X-Forwarded-For header. Its identity endpoint issues tokens for managed identities, so the stakes are the same as on AWS. Our guide to Azure penetration testing covers how we test managed identities and their permissions.

Five-step cloud SSRF chain from a user-supplied URL to role credentials, showing which fix breaks each step and that IMDSv2 covers only one
IMDSv2 breaks only the metadata step; destination checks, egress limits and a narrow role stop the same SSRF earlier or limit what it can reach.

Where does SSRF hide in cloud applications?

SSRF lives in features that make the server talk to the outside world on a user’s behalf, especially the ones that run later, in a background worker, where nobody watches the response. These are the six entry points we map first in any cloud or API scope, from webhooks and URL imports to PDF generators and link previews:

SSRF sourceRisk in a cloud accountFix we recommend
Webhooks and callback URLsA background worker follows a redirect to the metadata address or an internal API; the result is never shown, so the flaw stays blind and unnoticed.Disable automatic redirects or revalidate every hop; give the worker its own network with egress limited to the internet.
Import from URL (files, feeds, images)The server fetches and stores the response, so metadata output or an internal page can be read back by the attacker.Allowlist source hosts where possible; otherwise route fetches through an egress proxy that can’t reach internal or link-local ranges.
PDF generators and HTML renderersA headless renderer loads images, frames and stylesheets referenced in user-supplied HTML, including internal and link-local addresses.Render in a separate account or project with no role and no internal routes; allow only HTTP and HTTPS schemes.
Link previews and URL unfurlingAny URL a user posts is fetched by the server with the application’s network position.Resolve the name, validate every resolved IP, connect only to the validated IP and block private, loopback and link-local ranges.
Tenant-configured SSO or identity metadata URLsAn admin-settable URL is fetched by the backend that runs with the main application role.Validate when the URL is used, not only when it is saved; restrict to known identity provider hosts.
Webhooks with custom headers or methodsIf users can set headers and the method, header-based metadata protections stop helping.Fix the method server side, strip user headers that matter to internal services, isolate the sender.

The last row is the one teams miss. A “test your integration” button that lets a partner choose headers turns a limited SSRF into a full one.

What does IMDSv2 actually stop?

IMDSv2 changes the metadata service from a simple GET into a session. Software on the instance first sends an HTTP PUT request, receives a secret token and then presents it in the X-aws-ec2-metadata-token header on every metadata call. AWS documents three further protections: sessions last up to six hours and a token works only on the instance where the session started; the PUT response carrying the token leaves with a hop limit of 1 by default, so it can’t cross a router, NAT device or extra container network hop; and IMDSv2 won’t issue a token to a caller that sends an X-Forwarded-For header, which stops requests relayed by proxies that add that header.

That defeats the SSRF we find most often: one where the attacker controls only the URL and the server sends a plain GET. It does not fix the SSRF. Three cases stay open in our experience:

  • Full-control SSRF: features that let the user pick the method and headers can send the PUT that returns a session token, then attach that token to the credential request, the same way the server would.
  • Everything else internal: IMDSv2 protects one endpoint. Internal APIs, admin consoles and service dashboards behind the same SSRF are untouched, and container platforms expose their own credential endpoints, which the OWASP cheat sheet lists next to the metadata address.
  • A raised hop limit: teams sometimes raise the hop limit so containers can reach metadata. If you did, check what an SSRF inside a container can now reach.

Our verdict: require IMDSv2 and turn IMDSv1 off on every instance once you’ve confirmed nothing on it still makes IMDSv1 calls; after that check it is a configuration change with almost no downside. Treat it as a seatbelt. The repair lives in the code that makes the outbound request and in the network that request can use.

How do we test for SSRF in a cloud penetration test?

You judge an SSRF test by its map of outbound features and the evidence behind each finding. The order of work in a grey box engagement is stable:

  1. Map outbound features: every place the application fetches, posts to or renders something from a user-controlled location, including background jobs, scheduled imports and admin settings.
  2. Prove the request leaves: point the feature at a controlled external endpoint and record a unique marker, so even a blind, asynchronous SSRF leaves proof.
  3. Test the validation, not the input box: redirects and redirect chains, names that resolve to internal addresses, DNS rebinding between check and use, IPv6 and alternate address notations, as the OWASP cheat sheet describes them.
  4. Reach only what the rules of engagement allow: we agree before the test whether testers may query the metadata service and which internal test endpoint they may use. If a credential is reachable, we record proof, stop and report it during testing as a critical finding so it can be rotated.
  5. Follow the path in the cloud: with read access to the configuration we check the instance’s metadata settings, the role’s permissions and the egress rules, because those decide the real severity.

Each finding is written in the format of our sample penetration test report: the request, the response or out-of-band evidence, reproduction steps and the fix. A cloud test usually takes 8 to 15 tester-days depending on accounts, services and identity model.

What did a real SSRF look like in our testing?

From our testing: in a grey box webhook SSRF case study, a logistics platform let partners register a webhook destination and send a test notification. Typing a private IP address as the destination was blocked, so the boundary looked enforced. The tester then pointed the webhook at a controlled public endpoint that returned a redirect. The background delivery worker followed it to the agreed internal test endpoint without revalidating the destination: the app checked the first address, not the final one reached by its HTTP client. A unique marker recorded by the internal endpoint, matched with the worker’s log entry, confirmed the connection. The public API only acknowledged that the delivery job was accepted, so the report separated confirmed SSRF from unproven data retrieval; no broad internal scan was run and no infrastructure credentials were retrieved.

The team first restricted the worker’s outbound access to internal networks, then disabled automatic redirects, strengthened destination validation, gave the worker its own network controls and logged rejected attempts. The retest, six business days later, replayed the original redirect, IPv4 and IPv6 destinations, multi-step redirects and legitimate deliveries. Effort: 6 tester-days, plus 1 for the retest.

The non-obvious lesson: the previous checks ran when the partner saved the URL, while the request happened later, in another process. That engagement stopped at an agreed internal endpoint. In a cloud scope, the same gap is where we ask two more questions: can that worker reach the metadata address, and what could its role do? Those answers decide severity more than the SSRF itself. In the cloud, a single flaw matters less than where it lets you go next, which is also why our AWS penetration testing case study focuses on how a role reached secrets indirectly.

How do you fix SSRF in a cloud application?

Fix it in layers, because each layer fails differently:

  • Allowlist destinations: when the feature talks to known partners, accept only their hosts, and build the request yourself with a fixed scheme, port and path.
  • Validate the address you connect to: resolve the name, check every resolved IP and connect to that IP. OWASP notes that domain allowlisting alone does not prevent DNS rebinding.
  • Handle redirects deliberately: turn off automatic redirects or run the full validation again on every hop.
  • Block internal ranges: loopback, private ranges, IPv4 and IPv6 link-local, IPv6 unique local and IPv4-mapped addresses, after normalizing the address.
  • Require IMDSv2: turn IMDSv1 off and keep the hop limit at 1 unless a container genuinely needs more.
  • Segment the fetcher: give webhook senders, importers and renderers their own subnet or egress proxy with egress to the public internet only.
  • Use a separate account for risky workloads: a PDF renderer that processes untrusted HTML belongs in a separate account or project with no access to production.
  • Apply least privilege: give the workload role only what it needs, so stolen temporary credentials buy as little as possible.
  • Log and alert: log rejected destinations and metadata access from unexpected processes; an SSRF attempt is a precise signal.

For the code-level controls that sit next to these, our API security checklist covers input validation, authorization and outbound calls in one list.

Which SSRF fix should you apply first?

  • Choose IMDSv2 enforcement first when you run instances: it breaks the simplest path to credentials.
  • Choose a strict allowlist when the feature connects to a known set of partners, payment providers or identity providers.
  • Choose network isolation of the fetcher when users may enter any public URL, as in link previews and importers. Validation alone will eventually be bypassed there.
  • Choose a separate account or project for renderers that process untrusted documents.

We advise against relying on a deny-list of IP strings or a regular expression on the URL. OWASP calls deny-lists bypass-prone, and in our tests redirects, DNS names and alternate notations get around them. Our verdict: IMDSv2 first, isolation of the fetching component next, and an allowlist wherever your integrations allow one.

Do you need an API test or a cloud test to find SSRF?

Choose API penetration testing when the SSRF sources are in your API, such as webhooks, imports and integrations; a standard web application or API test is $2,500 to $5,500. Choose cloud penetration testing when you also need to know what a reached role, instance or network could do next; a complex cloud scope runs $5,000 to $12,000+, priced in tester-days. If your product has both, test them together in grey box: the SSRF is found in the application and its severity is decided in the cloud account. See pricing for how tester-days become a fixed price for the agreed scope, confirmed in writing before testing. A retest is available after fixes.

Fixed-price quote

Want your webhooks and imports tested for SSRF?

Tell us which features fetch user-supplied URLs and which cloud accounts they run in. You get a written scope, tester-days and a fixed price before testing starts.

Get a fixed-price quote

Sources: OWASP SSRF Prevention Cheat Sheet (allowlist, DNS rebinding, deny-list and metadata addresses); CWE-918 Server-Side Request Forgery; AWS Security Blog on IMDSv2 (session token, hop limit, X-Forwarded-For); Microsoft Learn: Azure Instance Metadata Service (header requirements); checked November 2026.

Pentestica - Your Trusted Partner in Penetration Testing

The Pentestica penetration testing team: 25 certified senior pentesters (OSCP, OSCE, CISSP) with 10+ years of offensive security operations and 500+ penetration tests behind them. Our testing is aligned with OWASP, PTES and NIST SP 800-115.