Server-Side Request Forgery

SSRF coerces a server into issuing requests to a destination the attacker chooses, so the attacker borrows the server’s network position and trust relationships — reaching loopback, internal services, and cloud control planes the perimeter was supposed to hide.

What it is

The root cause is a trust boundary confusion: an application exposes a feature that fetches a remote resource, and the destination of that fetch is influenced by untrusted input. The server, not the attacker, opens the socket, so the request inherits the server’s identity — its source IP, its place inside the firewall, its loopback interface, and any ambient credential (an instance role, a service-account token) the network grants by position rather than by proof. SSRF does not exploit the URL parser or the HTTP client itself; it abuses the application’s willingness to point that client wherever input says. CWE-918; OWASP API7:2023; MITRE ATT&CK T1552.005 when it ends in credential theft.

The bug is defined by a validate-to-fetch gap: whatever check sits between input and the socket either does not exist, inspects the wrong thing (URL text instead of the connected peer), or runs at the wrong time (at config or at validation, not at connect). Every bypass class below is a different way that gap opens.

Why it matters

Impact is set by what the fetcher can reach and what identity it carries, not by the response body. The ladder:

  • No reflection (blind). Internal port scanning / XSPA, service discovery, DoS against internal endpoints. See Blind SSRF.
  • Full read. The response comes back to the attacker — internal admin pages, config, secrets.
  • Credential theft. The fetcher runs inside a cloud workload and reads the instance/task/pod identity from the metadata service — the single highest-value outcome. See Cloud Metadata Service Exploitation.
  • RCE. Protocol smuggling to an unauthenticated internal service (Redis, Memcached, FastCGI) or a vulnerable internal app. See Gopher Protocol SSRF.

Severity rose sharply with cloud: a harmless-looking avatar proxy on an over-permissioned EC2 box is account takeover (the Capital One Breach lesson). Programs price it accordingly — Meta caps SSRF at $40k and pays a bonus for full HTTP-request control, a deduction for rate-limited/delayed sinks ([[raw/bugbounty.meta.com/meta-bug-bounty-ssrf-payout-guidelines-3221|Meta SSRF payout guidelines]]). It is actively exploited at scale: CISA has added Oracle EBS, GitLab, and SonicWall SSRF flaws to KEV, and GreyNoise observed a coordinated multi-CVE SSRF surge in March 2025 echoing Capital One.

How it works

One attacker-influenced URL reaches whatever the server can route to:

  • The server over loopback — admin interfaces that trust 127.0.0.1/localhost, local-recovery paths that skip auth (stockApi=http://localhost/admin).
  • Internal back-ends on RFC1918 / cluster-DNS ranges — databases, caches, dashboards, other microservices.
  • Cloud and orchestration control planes — instance metadata, kubelet, API server. See SSRF in Kubernetes and Containers.
  • External third parties, where requests appear to originate from the victim org.

Variants, each with a dedicated page:

Where to find it

Fetch sinks are rarely labeled “fetch URL.” Look for any feature that retrieves or renders a remote resource on the server’s behalf:
Typical entry points named across bug-bounty methodology: PDF generation, link previews, image processing, webhooks (LostSec guide).

  • Webhooks, callbacks, “test URL” buttons, integration configs — Webhook SSRF.
  • Document/report renderers — HTML-to-PDF, headless Chrome, invoice/certificate export — SSRF in PDF and HTML Renderers. The “ultimate SSRF sink”: any injected src/href becomes an outbound request, and most run with file:// access.
  • Image and media pipelines — avatar “import from URL”, SVG rasterizers, ImageMagick/FFmpeg, image proxies/resizers (Thumbor, imgproxy, Next.js /_next/image) — SSRF in Image and Media Processors.
  • Routing / SSR URL reconstruction from Host / X-Forwarded-* headers — Host Header SSRF.
  • AI/agent stacks — RAG fetchers, scrapers, vision-language image loaders, MCP tool endpoints, reachable directly or via indirect prompt injection — SSRF in AI Agents and LLM Tools.
  • Also: link unfurling/URL preview, RSS/import-by-URL, OpenAPI $ref dereferencing, XML parsers resolving external entities, GraphQL create-from-URL.
  • Identity and SSO plumbing — URLs taken from IdP claims or SSO config: Zipline fetched the OIDC picture claim into the stored avatar (full read) (Zipline); Langfuse’s GitHub Enterprise SSO baseUrl skipped outbound-URL validation and sign-ins sent stored OAuth client credentials to it (Langfuse).
  • Connectivity checks — “test connection” for LDAP/SMTP/relay settings dial arbitrary host:port (MailAssure).
  • Validators borrowed from another context — an RFC 8252 OAuth redirect-URI validator (which allows http://127.0.0.1:<port>) reused for webhook URLs (Traewelling).

Hunt by parameter name too — url, uri, dest, redirect, target, file, callback, webhook, image, return_url are classic. The F5 EC2 campaign fuzzed exactly dest,file,redirect,target,uri,url.

How to test

  1. Confirm a server-side fetch. Point a candidate sink at a unique Out-of-Band Detection canary (Burp Collaborator / interactsh). A callback from the server (check source IP/UA/ASN — beware link-unfurler and scanner false positives) proves the sink. A DNS-only hit still proves the lookup fired; DNS+HTTP is the unambiguous bar. Typical sinks are URL preview, image/document import, webhook validation and remote file processing. A callback alone proves server-side fetching but not internal reach, so on authorized targets use a designated internal test service rather than probing unrelated hosts or metadata (P2 SSRF report template).
  2. Reach loopback and private space. Try localhost, 127.0.0.1, 0.0.0.0, 169.254.169.254, and RFC1918 hosts; look for admin/internal responses, or infer reachability from a status/timing/size oracle (Blind SSRF).
  3. If filtered, work the bypasses in order: alternate IP encodings → parser differentials → open redirect → DNS rebinding (see below).
  4. Escalate to cloud metadata, internal APIs, and protocol smuggling.

Checklist: server-side fetch confirmed OOB · loopback/private reachable · response reflected or an oracle identified · scheme allowlist probed (gopher/file/dict) · redirect-following tested · metadata endpoint tested (incl. IPv6 [fd00:ec2::254] and header-gated GCP/Azure) · HTTP method/header control assessed (decides IMDSv2 reachability).

Exploitation and escalation

  • Internal port scan / service discovery — sweep RFC1918 + loopback; even a blind, GET-only primitive yields XSPA and can reach read-only admin endpoints (Envoy, Prometheus). See Blind SSRF, SSRF in Kubernetes and Containers.
  • Cloud credential theft — the main event. Read the workload’s temporary IAM/OAuth credentials from Cloud Metadata Service Exploitation; whether IMDSv2 stops you depends on whether your primitive controls HTTP method and headers.
  • Protocol smuggling → RCE — a gopher://-capable client writes raw CRLF-delimited bytes to Redis/Memcached/FastCGI/SMTP on localhost (Gopher Protocol SSRF); tooling: Gopherus, SSRFmap.
  • Local file read — a permissive client (libcurl, Java URL, a renderer) resolving file:///jar:/netdoc: leaks /etc/passwd, SSH keys, /proc/self/environ, cloud creds (Local File Read via SSRF).
  • Blind → full read — chain a blind SSRF into a second internal SSRF/open-redirect gadget, or exfil via an error/response-header oracle (an $8k K8s bounty turned one reflected header into an internal infra map).
  • Chaining — SSRF rarely stops at itself. Orange Tsai chained two SSRFs + CRLF injection + Memcached/Marshal deserialization into GitHub Enterprise RCE ([[raw/blog.orange.tw/how-i-chained-4-vulnerabilities-on-github-enterprise-from-ssrf-executi-242|GitHub Enterprise SSRF→RCE chain]], $12.5k); Oracle EBS chained SSRF → CRLF → path traversal → unsafe XSLT → RCE.

Bypassing defenses

Blocklists lose because the validator and the HTTP client disagree on where the request lands. The failure classes:

  • Alternate IP encodings — decimal/dword (2130706433), octal, hex, short forms, IPv4-mapped IPv6 ([::ffff:127.0.0.1]), wildcard-DNS (127.0.0.1.nip.io). IP Address Encoding Bypasses.
  • URL parser differentials — @/userinfo, backslashes, fragments, scheme-regex and prefix-match divergence; the guard reads one host, the client dials another. URL Parser Differentials.
  • DNS rebinding — TOCTOU between the validator’s resolve and the client’s resolve (TTL 0, or an A-vs-AAAA split with a single-stack resolver). DNS Rebinding.
    A resolving guard that then hands the hostname to the client is still two lookups; a 2026 wave of AI/MCP and CMS fetchers shipped exactly this (IBM mcp-context-forge CVE-2026-53708, Craft CMS CVE-2026-27127, LibreTV CVE-2026-123207) (xalgorix, LibreTV).
  • Open redirect — a validated first hop 30x-redirects to an internal target that is never re-checked; also switches scheme (https→gopher/file). Open Redirect to SSRF.
  • Header-derived base URL — Host/X-Forwarded-Host/custom X-*-Url steer routing-based SSRF. Host Header SSRF.
  • Partial control — path traversal and prefix/suffix breakout turn a fragment into a full destination. Partial SSRF.

Patches routinely fail by fixing the wrong layer: changedetection.io re-wired its check to urlparse().hostname (not the parser that dials), and Craft CMS’s string denylist fell to rebinding, then to an IPv6 literal.

Real-world cases

  • Capital One (2019) — misconfigured EC2 WAF → IMDSv1 → S3; ~106M records. The canonical case; drove IMDSv2. See Capital One Breach. [[raw/en.wikipedia.org/server-side-request-forgery-wikipedia-2635|Wikipedia — SSRF]]
  • Oracle EBS CVE-2025-61884 / -61882 — pre-auth SSRF in /configurator/UiServlet chained to RCE; exploited by Clop, CISA KEV. [[raw/bleepingcomputer.com/cisa-confirms-hackers-exploited-oracle-e-business-suite-ssrf-flaw-2292|CISA — Oracle EBS SSRF]] · [[raw/picussecurity.com/oracle-ebs-cve-2025-61882-pre-auth-ssrf-leads-to-rce-4628|Picus — Oracle EBS SSRF→RCE]]
  • GitLab CVE-2021-39935 — unauth SSRF via CI Lint API; CISA ordered federal patching of the five-year-old flaw. [[raw/bleepingcomputer.com/cisa-warns-of-five-year-old-gitlab-flaw-exploited-in-attacks-2569|CISA — GitLab SSRF]]
  • SonicWall SMA1000 CVE-2026-15409/-15410 — SSRF in a zero-day chain, exploited by ransomware (UTA0533, INC), CISA KEV. [[raw/bleepingcomputer.com/cisa-sonicwall-sma1000-flaws-now-exploited-by-ransomware-gangs-11775|CISA — SonicWall SMA1000]]
  • Grafana CVE-2025-4123 — plugin open redirect + double-encoded path traversal → full-read SSRF + ATO; mass recon preceded a coordinated surge. [[raw/medium.com/grafana-cve-2025-4123-full-read-ssrf-account-takeover-3235|Grafana full-read SSRF]] · [[raw/greynoise.io/new-ssrf-exploitation-surge-echoes-2019-capital-one-breach-3315|GreyNoise — SSRF surge]]
  • Harbor webhooks (GHSA-2phj-cp9f-qq6w) — any project creator reaches IMDS; 6,370 instances pre-fix. See Webhook SSRF. [[raw/ox.security/ssrf-in-harbor-webhooks-exposes-cloud-credentials-12462|OX — Harbor webhook SSRF]]
  • mcp-atlassian CVE-2026-27826/-27825 — header-controlled base URL SSRF chained to RCE as root; 4M+ downloads. [[raw/arcticwolf.com/cve-2026-27825-critical-unauthenticated-rce-and-ssrf-in-mcp-atlassian-2644|Arctic Wolf — mcp-atlassian]]
  • Open-WebUI CVE-2026-87996 — Playwright TOCTOU/DNS-rebinding → AWS/GCP/Azure metadata into model chat. [[raw/sh3llc0d3.com/open-webui-toctou-dns-rebinding-ssrf-to-cloud-metadata-13399|Open-WebUI rebinding→metadata]]
  • ChatGPT Custom GPT Actions — HTTPS + custom-header abuse reached Azure metadata. [[raw/esecurityplanet.com/chatgpt-exploited-through-ssrf-flaw-in-custom-gpt-actions-2359|eSecurityPlanet — ChatGPT GPT Actions SSRF]]
  • Yahoo Mail logoGrabber ($15k) — 302 to gopher://127.0.0.1:6379 → Redis → root. See Gopher Protocol SSRF. [[raw/sirleeroyjenkins.medium.com/just-gopher-it-escalating-a-blind-ssrf-to-rce-for-15k-1995|Just Gopher It]]
  • CVE-2025-51591 — generic app SSRF → AWS IMDS credential theft, in-the-wild IMDS fuzzing. [[raw/cybersecurity88.com/cve-2025-51591-ssrf-exploit-targets-aws-instance-metadata-service-3157|CVE-2025-51591 IMDS SSRF]] · [[raw/f5.com/campaign-targets-amazon-ec2-instance-metadata-via-ssrf-3230|F5 — EC2 IMDS campaign]]
  • Traewelling GHSA-4h3f-pf38-2rhj — any user’s OAuth-app webhook URL reached loopback/RFC1918; Guzzle followed redirects to IMDS; delivery status codes shown in webhook-stats gave a port/service oracle. See Webhook SSRF. advisory
  • N-able MailAssure CVE-2026-134624 (critical) — unrestricted destination in the relay LDAP-sync connection check: authenticated API users probe internal host:port reachability and send crafted data. GHSA-g4r8-gwqr-j289
  • Zipline < 4.8.3 CVE-2026-134805 — OIDC picture claim fetched by fetchToDataURL(); response readable as the avatar. GHSA-phxh-jprj-5xjw
  • Langfuse < 4.82.0 CVE-2026-134835 — org admin sets GitHub Enterprise SSO baseUrl to loopback/RFC1918/metadata; sign-ins carry stored OAuth client credentials there. GHSA-x63j-8x93-j642
  • LibreTV < 2.21.2 CVE-2026-123207 — checkUpstreamAllowed() bypassed by unpinned DNS in fetchWithSafeRedirects() (CWE-367). See DNS Rebinding. VulnCheck
  • WWBN/AVideo CVE-2026-43884 (CVSS 7.7) — isSSRFSafeURL() then file_get_contents() which follows redirects; 8 of 9 callers discarded the pinned $resolvedIP. See Open Redirect to SSRF. xalgorix
  • rConfig Core 8.2.19 – < 8.2.22 CVE-2026-135696 — the DeviceIpIsValid loopback guard checked only IP literals and passed unresolved hostnames. An authenticated user created a device whose hostname resolved to loopback, with device_port_override 6379, and config downloads then sent Redis inline commands, giving RCE. See Gopher Protocol SSRF. GHSA-3x54-whhw-vrq9
  • Interstellar < 6.3.0 CVE-2026-135161 (critical) — allow_loopback_ips / allow_private_ips were enabled in wisp-js at startup, and the wisp WebSocket bypassed the Express password middleware. Unauthenticated users could open raw TCP streams to loopback, internal hosts and cloud metadata. GHSA-fwx2-6rc7-c53f
  • Azure Machine Learning CVE-2026-118285 (critical) — SSRF that let an authorized attacker elevate privileges over a network; no further detail published. See SSRF in AI Agents and LLM Tools. GHSA-3726-7qv6-w947
  • OttoKit (SureTriggers) ≤ 1.1.42 CVE-2026-129029 — SSRF in the WordPress automation plugin; advisory without detail. GHSA-989h-wvwf-wg74
  • erxes insurance_api CVE-2026-134826 — unauthenticated GraphQL template mutations injected HTML that headless Chromium rendered in generateContractPDF, which pulled internal-network content into the PDFs. See SSRF in PDF and HTML Renderers. GHSA-m22g-6wm2-c3qq
  • CIMD (OAuth for MCP): the authorization server fetches an attacker-supplied client_id URL; Auth0 restricts it to HTTPS, no redirects, no internal IPs and a 5 KB response cap. (source)

Prevention

URL string-matching always loses — a text check never learns where the socket lands. Layer, in order of durability (see SSRF Prevention):

  1. Allowlist destinations where the fetcher needs only known hosts: take an IP/domain (not a whole URL), strict-compare, then build the request yourself with a fixed scheme/port/path. Don’t carry the user’s path/query across.
  2. Resolve-then-pin (the core control): resolve once (A and AAAA), reject private/loopback/link-local, connect to that exact IP, keep the hostname only for Host/SNI, and do not resolve again — disable redirects or re-run full validation per hop. Defeats rebinding and redirect bypasses together.
    Validate every A/AAAA answer (a rebinder can return a mix), pin one validated address with a custom resolver/transport that keeps the hostname for Host/SNI/cert checks (curl --resolve host:443:IP shows the behavior), and apply the same policy to retries and pooled/fallback connections (xalgorix).
  3. Validate at the point of use — inspect the connected peer (Guzzle ON_STATS.primary_ip, socket remote address), not a pre-flight resolve.
  4. Egress proxy (Stripe Smokescreen) for mature orgs: one CONNECT proxy with per-client host rules, then firewall direct egress.
  5. Harden metadata — require IMDSv2 (HttpTokens=required), disable IMDSv1, hop limit 1, or HttpEndpoint=disabled; deny 169.254.0.0/16, [fd00:ec2::254], Azure WireServer, Alibaba 100.100.100.200 at the network layer. Scope roles tightly — blast radius equals role reach.
  6. Authenticate internal services (zero-trust) — the most durable mitigation where IP/port can’t be filtered. A WAF rule is not the fix — in Capital One the WAF was the SSRF primitive.
  7. Anti-SSRF HTTP wrappers (Include Security SafeURL, Doyensec safeurl-go) hook the socket, but miss out-of-process sinks (renderers, media converters) — enforce via SAST. [[raw/blog.includesecurity.com/mitigating-ssrf-in-2023-30|Include Security — Mitigating SSRF in 2023]] · [[raw/goteleport.com/how-to-prevent-ssrf-attack-2489|Teleport — Prevent SSRF]]

For AI fetchers: run tools in a sandbox with no metadata service and no production credentials, egress-allowlist, and scan tool output for credential-shaped strings before it re-enters context (SSRF in AI Agents and LLM Tools).

Tools

  • Discovery / parameter finding: assetnote/surf (httpx-based internal-host probing, [[raw/github.com/assetnote-surf-186|assetnote/surf]]), See-SURF (crawl + Burp sitemap + AI payloads, [[raw/github.com/see-surf-tool-to-find-potential-vulnerable-ssrf-parameters-4781|See-SURF]]), autoSSRF (interactsh-backed smart fuzzing, [[raw/github.com/th0h0-autossrf-188|autoSSRF]]), lorsrf (OAST param spraying, [[raw/github.com/mindpatch-lorsrf-fast-cli-tool-to-find-the-parameters-that-can-be-used-76|lorsrf]]), SSRFPwned + GF patterns ([[raw/github.com/blackhatethicalhacking-ssrfpwned-185|SSRFPwned]]), ssrf-king Burp plugin ([[raw/github.com/ethicalhackingplayground-ssrf-king-ssrf-plugin-for-burp-automates-ssrf-1520|ssrf-king]]).
  • OOB confirmation: Burp Collaborator, interactsh, ssrf-sheriff (content-type-matched canary), Collaborator Everywhere. See Out-of-Band Detection.
  • Bypass generation: ipfuscator, Burp-Encode-IP, recollapse, PortSwigger URL-validation-bypass webapp; r3dir (hosted redirector), rbndr.us/1u.ms/nip.io for rebinding. See IP Address Encoding Bypasses, Open Redirect to SSRF.
  • Exploitation: Gopherus + SSRFmap (protocol payloads), ssrf_proxy (tunnel nmap/sqlmap through a blind SSRF, [[raw/github.com/github-bcoles-ssrf-proxy-ssrf-proxy-facilitates-tunneling-http-communi-1511|ssrf_proxy]]), Pacu (post-exploit AWS), k8s_ssrf_portscanner.
  • Defense: SafeURL / safeurl-go wrappers, Stripe Smokescreen egress proxy.

Sub-pages

  • Blind SSRF — no response body; confirm/escalate via OOB, timing, status and error oracles.
  • Partial SSRF — control only a URL fragment; break out of a fixed prefix/suffix via traversal or authority escapes.
  • Out-of-Band Detection — proving no-reflection bugs with DNS/HTTP canary callbacks (OAST); false-positive triage.
  • IP Address Encoding Bypasses — decimal/octal/hex/short/IPv6-mapped/wildcard-DNS forms that survive the resolver but dodge the regex.
  • URL Parser Differentials — validator-vs-client disagreement over the host (@, backslash, fragment, scheme regex).
  • DNS Rebinding — TOCTOU between validation and connect resolves; the A-vs-AAAA non-race sibling.
  • Open Redirect to SSRF — a validated URL that 30x-redirects to an internal target or switches scheme.
  • Gopher Protocol SSRF — raw TCP/CRLF to Redis/Memcached/FastCGI/SMTP, the usual blind-SSRF→RCE path.
  • Local File Read via SSRF — file:///jar:/netdoc:/dict: turning fetch into arbitrary file read.
  • Webhook SSRF — attacker-stored, server-executed callbacks; validate-at-config-not-at-send failures.
  • SSRF in PDF and HTML Renderers — HTML injection into server-side renderers; the “ultimate SSRF sink,” file://-capable.
  • SSRF in Image and Media Processors — SVG/ImageMagick/FFmpeg and image proxies fetching remote/local resources.
  • Host Header SSRF — routing/SSR URL reconstruction from Host/X-Forwarded-*.
  • SSRF in AI Agents and LLM Tools — URL-fetch tools and MCP servers, direct or via indirect prompt injection.
  • Cloud Metadata Service Exploitation — steering SSRF at IMDS/metadata to steal workload IAM/OAuth credentials (AWS/GCP/Azure/ECS/EKS).
  • IMDSv2 — AWS session-token hardening: what it stops (GET-only SSRF) and what still bypasses it (method+header control).
  • SSRF in Kubernetes and Containers — node metadata, SA tokens, kubelet/API-server/etcd, API-server-as-port-scanner.
  • Capital One Breach — the 2019 SSRF→IMDSv1→S3 reference case.
  • SSRF Prevention — allowlists, resolve-then-pin, egress proxying, metadata hardening, zero-trust.

See also: HTTP Request Smuggling

See also: Open Redirect

Sources