What Is SSRF (and Why Scrapers Must Block It)?
What is SSRF: the bug that turns any fetch-this-URL feature into a probe of your private network, the bypasses that work, and the fix.

On this page
In August 2026, attackers used an unauthenticated SSRF bug in MLflow’s webhook feature to pull cloud credentials out of publicly reachable ML servers within hours of the CVE going public. CVE-2026-64849, CVSS 9.3. The vulnerable feature had one job: accept a URL someone else typed in and fetch it later.
That is also a one-sentence job description for a web scraper. So what is SSRF, exactly? Server-side request forgery is the bug class where the attacker never attacks your server. They rent its network position.
What Is SSRF?
SSRF (server-side request forgery, CWE-918) is a vulnerability in which an attacker coaxes a server into making an HTTP request of the attacker’s choosing, usually to an address the attacker could never reach directly.
The name tells you the mechanics. Forgery: the request looks legitimate because your own server issues it. Server-side: it happens behind the firewall, from a machine with credentials. OWASP ranks it A10 in its 2021 Top 10, and the 2026 CVE feed says the ranking aged well: a pre-authentication SSRF in SonicWall’s SMA1000 appliance also landed this year, rated critical.
Your browser can’t reach 10.0.0.5 in your VPC. Your scraper, running on an instance inside that VPC, can. SSRF is the trick that points it there.
Why Scrapers Are the Textbook Target
A scraper’s contract is the attack surface: take a URL as input, fetch it from a machine with network privileges. The same contract powers link previewers, webhook monitors, import-by-URL importers, and PDF renderers. Any of them will cheerfully fetch whatever address you hand it.
Cloud hosting added the jackpot. AWS, Azure, Google Cloud, and Alibaba all put a metadata service one hop from every VM, and it hands out temporary credentials to the machine itself. A single blind SSRF against the right VM is no longer “I scanned an internal port.” It’s “I am this server’s IAM role now.”
Crawlers inherit all of this and add a twist. A crawler fetches URLs it finds in pages, so the attacker doesn’t need access to your queue at all. They plant a link on their own site, wait for your crawl to pass, and your request arrives from inside. Redirects extend the reach: a fetch that starts at a public URL ends wherever the redirect chain says it ends. If you’re building your own crawler, the SSRF guard isn’t a hardening extra. It’s step one.
The Payoff: Cloud Metadata Endpoints
The most common SSRF destination is 169.254.169.254, a link-local address every major cloud reserves for instance metadata: instance IDs, SSH keys, and the temporary IAM credentials the instance uses. Link-local means unreachable from outside the host. An SSRF bug makes it reachable.
Each cloud adds its own friction, which is why payload craft matters:
| Cloud | Metadata endpoint | Quirk the attacker must satisfy |
|---|---|---|
| AWS | 169.254.169.254 |
IMDSv2 (default on newly released instance types since mid-2024) requires a PUT-token request first |
| Azure | 169.254.169.254 |
requires the Metadata: true header |
| Google Cloud | metadata.google.internal |
requires the Metadata-Flavor: Google header |
| Alibaba Cloud | 100.100.100.200 |
different address, so naive scans miss it |
Those quirks raise the bar. They do not close the hole. Capital One’s 2019 breach went through a misconfigured web application firewall, hit the AWS metadata service for role credentials, and ended with data on about 100 million people and an $80 million fine from the OCC. MLflow’s maintainers had already added webhook URL validation in 3.10.0; CVE-2026-64849 was a bypass of that defense, exploited within hours of disclosure in August 2026. A fix at the header level is a speed bump. The fix that holds is at the fetcher.
The Bypasses That Break Naive Defenses
IP-literal tricks
127.0.0.1 has costumes: 2130706433 (decimal), 0x7f000001 (hex), 0177.0.0.1 (octal). A validator that string-matches loopback literals sees none of them. The defense is to resolve or parse everything into a real IP and judge the IP, never the string. Even that has a wrinkle: some parsers refuse integer-form IPv4, so http://2130706433/ becomes a hostname with no dots. A fail-closed resolver treats “no such host” as a rejection, which happens to be the right answer.
Redirect smuggling
The fetch starts at a URL that passes validation, then a 302 sends it to http://169.254.169.254/latest/meta-data/. This is precisely how MLflow fell: the URL was checked at webhook registration, and the delivery code followed redirects without re-checking. I tried to demo this class against httpbin’s redirect-to endpoint while writing this page, and httpbin itself now refuses: “Forbidden redirect target: redirect target is an internal address.” Even the test tooling treats the pattern as a live attack. The defense is boring and absolute: validate the destination of every redirect hop, not just the first URL.
DNS rebinding
The check happens at resolution time; the connection happens later. An attacker’s nameserver answers the first lookup with a public IP and the second with 10.0.0.5, and the fetcher connects somewhere it never validated. MLflow’s delivery code re-resolved hostnames without pinning the earlier answer, which is the textbook time-of-check-to-time-of-use gap. The defense is to re-verify the address you actually connected to, before writing a single request byte. Validating once is a security review. Validating at connect time is a policy.
One more trap sits underneath all three: the validator and the fetcher can parse the same URL differently (WHATWG URLs vs RFC 3986 disagree on enough edge cases to matter). Use one parser for both jobs, or the attacker will find the disagreement for you.
The Checklist
- Allowlist schemes:
httpandhttpsonly.file://and every exotic scheme stay off by default. - Block metadata and loopback hostnames explicitly:
localhost,*.localhost,metadata.google.internal, and their trailing-dot variants. - Resolve the hostname and require every returned address to pass a public-IP predicate (loopback, RFC1918 private, link-local, multicast, unspecified, and the IPv6 equivalents). Unresolvable is a rejection, not a pass.
- Re-validate every redirect hop and cap the chain length.
- After the socket connects, re-check the actual peer IP before sending anything.
- Add a deny-by-default egress rule from the fetcher to private ranges. When the code has a hole, the network is the backstop.
- For webhook-style features, allowlist destinations outright, and run on instances where the metadata service requires session tokens.
A Worked Example
Magpie, the scraper this site documents, keeps its fetch policy in about 180 lines of Go (fetch/ssrf.go in the core repo) and applies it to every fetch path, including the headless-browser one. I ran seven attacks through it today (v0.1.32), all from a plain terminal:
$ magpie scrape http://169.254.169.254/latest/meta-data/
Error: fetch: address "169.254.169.254" is not a public IP (exit 2)
$ magpie scrape http://127.0.0.1:9222/json
Error: fetch: address "127.0.0.1" is not a public IP (exit 2)
$ magpie scrape http://localhost:8080/
Error: fetch: host "localhost" is a blocked metadata/loopback name (exit 2)
$ magpie scrape http://metadata.google.internal/computeMetadata/v1/
Error: fetch: host "metadata.google.internal" is a blocked metadata/loopback name (exit 2)
$ magpie scrape http://2130706433/
Error: fetch: resolve "2130706433": lookup 2130706433: no such host (exit 2)
$ magpie scrape "http://[::1]:9222/json"
Error: fetch: address "::1" is not a public IP (exit 2)
$ magpie scrape file:///etc/hostname
Error: fetch: file:// blocked (set MAGPIE_ALLOW_FILE=1 to allow) (exit 2)
(abridged; every line ends with fetch: non-public address, and the exit code 2 is uniform because the CLI maps the whole class to a usage error.)
The structural moves map to the checklist. DNS answers: every resolved address must be public, and NXDOMAIN fails closed. Redirects: every hop re-validated, chain capped at 10. Rebinding: the transport re-checks the connected peer after the dial and refuses with dial peer … is not a public address (DNS rebind?) before any HTTP byte leaves.
The honest edges matter as much as the blocks. Magpie’s webhook delivery deliberately permits private peers, because a localhost receiver is the normal way to wire notifications on your own box; the guard targets fetched URLs, not operator-configured egress. MAGPIE_ALLOW_FILE=1 exists for local file scraping and says so in the error. Proxied connections skip the peer check because the proxy is the trusted peer, while the target URL still gets the full validation. Defaults deny; escapes are loud.
FAQ
What is SSRF in simple terms?
A bug that makes a server fetch an address the attacker picks. The server sits inside the network and holds credentials, so the attacker borrows its position instead of breaking through the perimeter. Think of it as a phishing attack aimed at a machine.
Is SSRF the same as CSRF?
No. CSRF tricks a victim’s browser into sending a request as an authenticated user; the target is a web app session. SSRF tricks a server into sending a request from its own network position; the target is whatever the infrastructure can reach. Different victims, different payoffs.
Why do attackers target 169.254.169.254?
It’s the cloud metadata service every major provider exposes on the link-local range. It answers only from the instance itself and hands out temporary IAM credentials to whoever asks. One successful SSRF there converts a web bug into a cloud account.
How do I test my scraper for SSRF?
Point it at http://127.0.0.1/, http://169.254.169.254/, http://[::1]/, file:///etc/passwd, the decimal form http://2130706433/, and a URL that redirects to each. Every one should fail closed with a rejection naming the address. Any success is a finding.
Does HTTPS or a WAF prevent SSRF?
Neither. HTTPS encrypts the attacker’s request like anyone else’s; a WAF sees only the first hop and can’t know that a legitimate-looking redirect ends at a metadata address. Validation belongs in the fetcher, at resolve time and again at connect time.
If you ship a fetch-anything feature this week: allowlist the scheme, require every resolved address to be public, re-validate every redirect hop, re-check the connected peer. Four checks, one afternoon, and your scraper stops being somebody’s metadata oracle.


