Skip to content
SSRF Write-up Advanced

Four SSRF Bypasses in Four Months

The article describes four SSRF bypasses against applications that validate a hostname or URL before fetching it: DNS rebinding, IPv6-only hostnames, redirect chains that are not re-checked, and parser disagreements between the validating library and the HTTP client. In each case an attacker could make the server reach internal services such as cloud metadata endpoints and steal credentials or secrets.

medium.com

Published on medium.com

Ssrf

Mostafa Moradian, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 14 min read.

Context

This is a write-up about a class of vulnerability rather than a single target: server-side request forgery (SSRF), and specifically the pattern of "resolve the hostname, check it against a blocklist, then make the request". The author, Mostafa Moradian, uses four real advisories from the first half of 2026 to show that this pattern fails in at least four distinct ways, and then presents ressrf, a library he wrote that moves validation down to the DNS resolution and connection layer.

The four cases are:

CVE Product Bypass class
CVE-2026-27127 Craft CMS, February 2026 DNS rebinding
CVE-2026-27129 Craft CMS, February 2026 IPv6 / address encoding
CVE-2026-5921 GitHub Enterprise Server, April 2026, CVSS 9.5 Redirect chains
CVE-2026-25960 vLLM, 2026, CVSS 7.1 URL parsing inconsistency

The feature under discussion in every case is the same: an application fetches a URL supplied by a user, or renders external resources inline, and tries to stop that fetch from reaching internal services such as cloud metadata endpoints.

Setup

No accounts, roles or tooling are described for the individual advisories. The relevant preconditions, as the article presents them, are:

  1. The application accepts a hostname or URL from an untrusted source and makes an outbound request to it.
  2. The protection is a pre-flight check: resolve the hostname, compare the result against a blocklist of dangerous IPs, reject on match, otherwise hand the original string to an HTTP client.
  3. The HTTP client performs its own resolution, its own redirect following and its own URL parsing, independently of the check.

For the DNS rebinding case the attacker additionally controls an authoritative DNS server. For the IPv6 case they only need a hostname that has an AAAA record and no A record. For the redirect case they need a server that can return a 302. For the parser case they need an input on which two URL parsers disagree.

Finding it

The article frames the discovery as a structural observation rather than a single bug hunt. In February 2026 the Craft CMS team shipped a patch for an SSRF vulnerability. The fix resolved the hostname, checked it against a blocklist of cloud metadata IPs, and rejected on a match. On the same day, two independent bypasses were published against that patch: one used DNS rebinding so the same hostname resolved to different IPs at different times, and the other exploited the fact that the validator only understood IPv4 while AWS had an IPv6 metadata endpoint all along.

What made it look wrong is that the check and the request are two separate operations on two separate representations of the destination. The thing that was checked is not the thing that was connected to. The article generalises this into a single pattern, shown in the table below: every bypass exploits a gap between what the validator checks and what the network actually does.

Table listing four SSRF bypass techniques and the gap each exploits: DNS rebinding exploits the gap between DNS answers during validation and request; IPv6/encoding exploits the gap between address families the validator and network understand; redirect chains exploit the gap between the checked URL
Every SSRF bypass exploits the same pattern: a gap between what the validator checks and what the network actually does. From the original on medium.com

Exploitation

Step 1: DNS rebinding (CVE-2026-27127)

The developer calls gethostbyname($hostname), compares the result against a list of dangerous IPs, and rejects the request if it matches. The attacker runs a DNS server for evil.attacker.com that answers the first query with a safe IP and the second query with the metadata address. The TTL is zero, so nothing caches.

When the application receives http://evil.attacker.com/latest/meta-data/, the sequence is:

Text
Query 1 (validation):   evil.attacker.com → [redacted]          ✓ looks safeQuery 2 (Guzzle/curl):  evil.attacker.com → [redacted]  ← AWS IMDS

The first lookup is the one the validator sees, and it is safe. The second lookup is performed by Guzzle/curl when it actually makes the request, and it returns the AWS instance metadata address. The check passed, the request goes to the metadata service, and the attacker now has IAM credentials. This is a time-of-check-time-of-use race applied to DNS.

The advisory recommends CURLOPT_RESOLVE to pin the DNS resolution. That works for curl, but not for Guzzle in all configurations, for Python's requests library, for Go's net/http, or for any other HTTP client the application might switch to. The fix is tied to one client's API surface and has to be remembered on every request built from user input.

Step 2: IPv6 and address encoding (CVE-2026-27129)

Same application, same week, different bypass. The attacker does not need a custom DNS server, only a hostname that has an AAAA record and no A record.

The validation code calls gethostbyname(). PHP's documentation states that this function returns "the IPv4 address corresponding to a given Internet host name". If the hostname has no A record, it returns the hostname string unchanged, so the blocklist comparison becomes:

Text
in_array("fd00-ec2--254.sslip.io", ['[redacted]', '[redacted]', ...])

Validation passes. Guzzle, which uses libcurl, resolves AAAA records happily and connects to fd00:ec2::254, the IPv6 endpoint for AWS IMDS. Credentials are stolen.

The article lists the wider family of representations that break a validator which only understands one dialect:

  • 0177.0.0.1 for [redacted] in octal
  • 0x7f000001 for [redacted] in hex
  • ::ffff:[redacted] as IPv4-mapped IPv6
  • fd00:ec2::254 as native IPv6 for AWS IMDS
  • 2852039166 as the decimal encoding of [redacted]

If the validator speaks one dialect and the network stack speaks another, the attacker speaks both.

Step 3: Redirect chains (CVE-2026-5921)

GitHub Enterprise Server's notebook rendering service fetched external resources to display them inline. It checked the initial URL, then followed HTTP redirects without re-checking the destination. An attacker could host a notebook referencing a URL on their own server, which returned a 302 redirect to an internal service, and the renderer followed it.

The attacker could not read the response from internal services directly, because the content was rendered rather than returned raw. Instead they used a timing side channel: they pointed the redirect at an internal regex-based API, crafted queries that would match or not match specific characters of secret values, and measured differences in response time. Character by character, they extracted sensitive environment variables.

The obvious fix is to re-check after redirects, but HTTP clients abstract redirect following away. A URL is handed to requests.get() or http.Get() and the final response comes back; the intermediate hops are invisible unless the caller explicitly opts in to intercepting them.

Step 4: Two parsers, one URL (CVE-2026-25960)

vLLM's load_from_url_async method validated URLs before fetching them. Validation used urllib3.util.parse_url() to extract the hostname, checked it against an allowlist, and on success handed the URL to aiohttp for the request. aiohttp uses yarl internally, and urllib3 and yarl disagree about backslashes.

Given the URL https://httpbin.org\@evil.com/:

  • urllib3 treats \ as a literal character in the path and URL-encodes it to %5C. The hostname is httpbin.org, so validation passes.
  • yarl, used by aiohttp, treats \@ as a userinfo separator. The hostname becomes evil.com, and the request goes to the attacker.

Same bytes, two parsers, two interpretations. The attacker finds the input where they disagree. This is not a bug in either parser; both follow their own internally consistent logic. The vulnerability lives in the gap between them, because the application uses one parser to decide whether a URL is safe and a different parser to decide where to send the request. The article calls this the "two kings in one kingdom" problem: two authorities claim sovereignty over the same input, and when they disagree only the attacker benefits. Any time validation and execution parse the same input independently, there is a surface for parser differential attacks.

Root cause

The common root cause is that validation and use operate on different things. In the rebinding case the validator checks one DNS answer and the client uses another. In the IPv6 case the validator checks an IPv4-only view and the client uses the full address space. In the redirect case the validator checks the first URL and the client uses the final destination. In the parser case the validator checks one parser's hostname and the client uses another parser's hostname.

Ad-hoc fixes close each gap individually: pin DNS with CURLOPT_RESOLVE, add AAAA checks, intercept redirects, normalise URLs. Each fix is specific to one client, one language and one vulnerability, and the next gap opens the following quarter. The article quotes 0xdade: "Security is the side-effect of good engineering." The argument is that SSRF prevention is not a check bolted onto a request handler but a property of a design in which the unsafe state is unrepresentable.

Impact

In the two Craft CMS cases the stated outcome is theft of IAM credentials from the AWS instance metadata service. In the GitHub Enterprise Server case the attacker extracts sensitive environment variables from internal services through a timing side channel, one character at a time, without ever reading a raw response. In the vLLM case the request goes to the attacker's host because two URL parsers read the same input differently.

The impact depends on what the server can reach. Most examples involve cloud metadata endpoints or internal APIs, and the redirect case shows that even a service that only renders content can leak data through timing.

Fix

The article presents ressrf as the fix, built around one design decision: the library sits between the application and the network and validates the actual destination at the moment of connection, not a string representation of it. Four consequences follow.

  1. No second DNS lookup. The resolver resolves once, validates every returned address, and the connector dials only the validated SocketAddr:
Text
pub async fn resolve(&self, host: &str, port: u16) -> Result<ResolveResult, TcpGuardError> {    let addrs = self.dns.resolve(host, port).await?;    let mut validated = Vec::with_capacity(addrs.len());    for addr in &addrs {        match self.policy.is_network_allowed(&[addr.ip()]) {            Ok(()) => validated.push(*addr),            Err(_) => {  }        }    }    if validated.is_empty() {        return Err(TcpGuardError::AllBlocked { host: host.to_string() });    }    Ok(ResolveResult { addrs: validated, host: host.to_string() })}
Text
pub async fn connect(&self, host: &str, port: u16) -> Result<TcpStream, TcpGuardError> {    let resolved = self.resolver.resolve(host, port).await?;    for addr in &resolved.addrs {        match self.connect_addr(*addr, start).await {            Ok(stream) => return Ok(stream),            Err(e) => { last_err = Some(e); }        }    }    Err(last_err.unwrap_or_else(|| TcpGuardError::AllBlocked { host: host.to_string() }))}

There is no gap between validation and use, so the DNS answer cannot be swapped between the check and the handshake.

  1. One address representation. The CIDR engine normalises every address to 128 bits before comparison, mapping IPv4 to IPv6 with a +96 prefix adjustment, and rejects octal and hex at parse time:
Text
fn normalize_to_ipv6(ip: IpAddr, prefix_len: u8) -> Result<(Ipv6Addr, u8)> {    match ip {        IpAddr::V4(v4) => {            let mapped = v4.to_ipv6_mapped();            let adjusted = prefix_len + 96;            Ok((mapped, adjusted))        }        IpAddr::V6(v6) => Ok((v6, prefix_len)),    }}
Text
pub fn contains(&self, ip: IpAddr) -> bool {    let normalized = match ip {        IpAddr::V4(v4) => v4.to_ipv6_mapped(),        IpAddr::V6(v6) => v6,    };        normalized.octets().iter()        .zip(self.mask.iter())        .zip(self.network.iter())        .all(|((&octet, &mask), &net)| (octet & mask) == net)}
Text
fn reject_ambiguous_ipv4(s: &str) -> Result<()> {    for octet_str in s.split('.') {        if octet_str.is_empty() {            return Err(Error::Parse("empty octet in IPv4 address".into()));        }        if octet_str.starts_with("0x") || octet_str.starts_with("0X") {            return Err(Error::Parse("hex notation not allowed in IP addresses".into()));        }        if octet_str.len() > 1 && octet_str.starts_with('0') {            return Err(Error::Parse("leading zeros (octal notation) not allowed".into()));        }    }    Ok(())}

Whether the attacker supplies [redacted] or ::ffff:[redacted], both normalise to the same 128-bit value and the deny list catches them. The AWS cloud module also lists the IPv6 IMDS endpoint explicitly:

JSON
{  "deny_ranges": [    { "cidr": "[redacted]/32", "name": "IMDS (IPv4)" },    { "cidr": "fd00:ec2::254/128",  "name": "IMDSv2 (IPv6)" },    { "cidr": "[redacted]/32",   "name": "ECS task metadata" }  ]}

The DNS layer (tokio::net::lookup_host or hickory-resolver) returns both A and AAAA records and every returned IP is validated, so there is no IPv4-only view.

  1. Re-validate every hop. A RedirectValidator runs each redirect target through the full policy and enforces a maximum hop count:
Text
pub fn validate_hop(&self, target_url: &str) -> Result<(), HttpGuardError> {    let hop = self.hops.fetch_add(1, Ordering::Relaxed);    if hop >= self.redirect_policy.max_redirects {        return Err(HttpGuardError::TooManyRedirects { max: self.redirect_policy.max_redirects });    }        let validator = ressrf_core::UriValidator::default();    if let Err(_) = validator.validate_url(target_url, Some(&self.policy)) {        return Err(HttpGuardError::RedirectBlocked { hop: hop + 1, url: target_url.to_string() });    }        if let Some(scheme_end) = target_url.find("://") {        let scheme = &target_url[..scheme_end];        if self.policy.validate_scheme(scheme).is_err() {            return Err(HttpGuardError::RedirectBlocked { hop: hop + 1, url: target_url.to_string() });        }    }    Ok(())}

It plugs into client redirect hooks, for example in reqwest:

Text
use std::sync::Arc;let policy = Arc::new(policy);let validator = RedirectValidator::new(policy, RedirectPolicy::follow(10));let client = reqwest::Client::builder()    .redirect(reqwest::redirect::Policy::custom(move |attempt| {        match validator.validate_hop(attempt.url().as_str()) {            Ok(()) => attempt.follow(),            Err(_) => attempt.stop(),        }    }))    .build()?;

In the GitHub advisory's chain the initial URL passes because it points at the attacker's server, but the 302 target resolves to an internal IP and is blocked at hop 2. The timing side channel never operates because the connection to the internal service is never established.

  1. Be the resolver. For the parser differential, the policy is not a pre-flight check on a string that is then handed to a separate client. It integrates at the transport layer. The first defence is normalisation: before the URI validator extracts the authority, backslashes in the post-scheme portion are replaced with forward slashes.
Text
let (scheme, rest_owned) = if let Some(idx) = url.find("://") {    let scheme = &url[..idx];    let rest = &url[idx + 3..];    let rest_normalized = rest.replace('\\', "/");    (Some(String::from(scheme)), rest_normalized)} else {    (None, url.replace('\\', "/"))};

Given the vLLM payload https://httpbin.org\@evil.com/, the post-scheme portion httpbin.org\@evil.com/ becomes httpbin.org/@evil.com/. The host is unambiguously httpbin.org and /@evil.com/ is the path, so there is no ambiguity left for two parsers to disagree about.

The second defence catches userinfo-based bypasses that survive normalisation:

Text
fn has_userinfo_bypass(url: &str) -> bool {    let rest = if let Some(idx) = url.find("://") { &url[idx + 3..] } else { url };    let authority = rest.split('/').next().unwrap_or(rest);    let authority = authority.split('?').next().unwrap_or(authority);    let authority = authority.split('#').next().unwrap_or(authority);        if authority.contains('@') && authority.contains("%40") {        return true;    }        if let Some(encoded_at_pos) = authority.find("%40") {        let after = &authority[encoded_at_pos + 3..];        let after_host = if let Some(at_idx) = after.rfind('@') {            &after[at_idx + 1..] } else { after };        if after_host.contains('.') || after_host.contains(':') {            return true;        }    }    false}

The deepest defence is that the protocol adapters validate the resolved IP of whatever hostname the HTTP client actually connects to, not what a string parser thinks the hostname is. In the vLLM scenario, even if a URL confused the string-level validator, the adapter would still catch the connection to evil.com at DNS resolution: if it resolved to a blocked IP it would be blocked, and if it resolved to a safe IP the connection goes to a safe IP regardless.

Integration is a few lines per language:

Text
use ressrf_core::{PolicyBuilder, CloudProvider};use ressrf_tcp::SafeConnector;let mut builder = PolicyBuilder::external_only();builder.with_cloud(CloudProvider::Aws)    .with_cloud(CloudProvider::Azure)    .with_cloud(CloudProvider::Gcp);let policy = builder.build();let connector = SafeConnector::new(policy);let stream = connector.connect("example.com", 443).await?;
Text
policy, _ := ressrf.NewPolicyBuilder(ressrf.PresetExternalOnly).    WithCloudProviders("aws", "azure", "gcp").    Build(ctx)defer policy.Close(ctx)client := policy.HTTPClient(http.DefaultTransport)
Text
from ressrf import Policyfrom ressrf.protocols.http import SafeTransportpolicy = Policy.external_only(cloud=["aws", "azure", "gcp"])client = httpx.Client(transport=SafeTransport(policy))
Text
import { Policy, http } from "ressrf";const policy = await Policy.externalOnly({ cloud: ["aws", "azure", "gcp"] });const res = await http.safeFetch(url, { policy });

The ExternalOnly preset blocks IANA special-purpose ranges, cloud metadata endpoints and link-local addresses by default. Cloud modules add provider-specific deny ranges: AWS IMDS/ECS IPv4 and IPv6, Azure IMDS and Wireserver, GCP metadata. Allow lists can open holes for trusted internal services, and URL rules give path-level control. The Rust core is fuzz-tested weekly with three cargo-fuzz targets, all four language bindings run the same shared test vectors in CI, and the default deny list is sourced from IANA special-purpose registries and refreshed monthly by an automated workflow.

The article also credits prior work: Microsoft's AntiSSRF for the two-layer architecture of policy engine plus transport integration, whose IP range data and test suite seeded the initial test vectors; Stripe's Smokescreen as the reference architecture for an upcoming standalone proxy mode; and Arcjet for proving the Rust-core-compiled-to-WASM architecture in production.

An update at the top of the article notes that the Go binding now has a native port in pure Go, without WASM, under go-native/ressrf, with the same APIs and arguably faster.

Variants to test

  1. Rebinding against any resolve-then-request check. Point a hostname at an authoritative server you control with a zero TTL, answer the first query with a public IP and later queries with [redacted] or an internal address. A positive result is a request reaching the metadata service after the validator saw a safe answer.
  2. AAAA-only hostnames. Submit a hostname with only an AAAA record, such as one resolving to fd00:ec2::254, to any validator that uses an IPv4-only resolver. A positive result is the check passing while the client connects over IPv6.
  3. Alternative address encodings. Try octal (0177.0.0.1), hex (0x7f000001), decimal (2852039166) and IPv4-mapped IPv6 (::ffff:[redacted]) wherever an IP is accepted. A positive result is any encoding that reaches the target while the blocklist comparison misses it.
  4. Redirect to internal destinations. Host a URL that returns a 302 to an internal service and submit it to any feature that fetches external resources. A positive result is the client following the redirect without re-validating the target; a timing difference when the internal endpoint is regex-based confirms reachability even without a raw response.
  5. Parser differentials. Submit URLs containing backslashes, %40, @ and mixed userinfo, such as https://httpbin.org\@evil.com/, to features that validate with one library and fetch with another. A positive result is the validator reporting the benign host while the request lands on the attacker host.
  6. Redirect limits and scheme changes. Chain redirects past the configured maximum, or redirect from http to another scheme, to see whether hop counting and scheme validation are enforced on every target rather than only the first.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 35 min read.

What happened, in plain words

Imagine a company office with a helpful receptionist. You can hand the receptionist a note saying "please fetch me the document at this address", and the receptionist will go out, fetch it and bring it back. That is useful: the receptionist can reach places you cannot, like a locked archive room.

Now imagine a visitor writes on the note: "please fetch the document from the archive room". The receptionist, being helpful and not very suspicious, walks into the archive room and brings back the company's secret files. The visitor never entered the archive room. They just asked someone with access to go there for them.

That is the whole idea behind server-side request forgery, usually shortened to SSRF. A website sometimes needs to fetch something from the internet on your behalf: a picture to show inline, a page to preview, a file to import. If the website lets you choose the address, and it does not check carefully where that address leads, you can make the website's server visit places that only the server can reach. Those places are often internal: private company services, or a special cloud address that hands out access keys.

This article is about one particular way of trying to stop that, and why it keeps failing. The defence most applications use is a blocklist: a list of addresses that are forbidden, such as the cloud's secret key service. Before fetching, the application looks up the address, compares it to the list, and refuses if it matches. It sounds sensible. The author, Mostafa Moradian, shows four real security advisories from the first half of 2026 where this approach was bypassed, each in a different way, and then presents a library he wrote, called ressrf, that tries to remove the problem at a deeper level.

The four cases are:

Advisory Product How the check was bypassed
CVE-2026-27127 Craft CMS, February 2026 DNS rebinding
CVE-2026-27129 Craft CMS, February 2026 IPv6 and address encoding
CVE-2026-5921 GitHub Enterprise Server, April 2026, CVSS 9.5 Redirect chains
CVE-2026-25960 vLLM, 2026, CVSS 7.1 Two URL parsers disagreeing

A few words before we start, because they come up constantly.

An IP address is the numeric address of a computer on a network, like a postal address for machines. [redacted] is a special one used by Amazon Web Services (AWS), a large cloud provider. It is called the instance metadata service, or IMDS. A server running in AWS can ask that address for information about itself, including temporary credentials: secret strings that prove who the server is and let it use other AWS services. If an outsider can make your server fetch that address, the outsider can read those credentials and act as your server.

A hostname is the human-friendly name, like example.com. The Domain Name System, or DNS, is the internet's phone book: it translates hostnames into IP addresses. When a program wants to connect to example.com, it first asks DNS "what is the number for this name?", then connects to the number it got back.

A CVE is a public catalogue number for a known security flaw, so people can refer to the same bug unambiguously. CVSS is a score from 0 to 10 for how serious a flaw is; 9.5 is very serious.

A library is a bundle of ready-made code that programmers add to their own programs instead of writing everything from scratch. ressrf is such a library, written by the author, and it exists in several programming languages.

Finally, the pattern under discussion. In every one of the four cases, the application does three things in order: look up the hostname, check the result against the blocklist, then make the request. The author's argument is that this "resolve, check, request" pattern is broken by design, because the check and the request are two separate operations, and an attacker can arrange for them to see different things.

The setup: what an application has to be doing for this to matter

The article does not describe accounts or roles for any of the four advisories. What it does describe is the situation that has to exist:

  1. The application accepts a hostname or a web address from someone it should not trust, and makes an outgoing request to it. Think of a "paste a link and we will preview it" feature.
  2. The HTTP client (the part of the program that actually makes web requests) then does its own lookup, its own redirect following and its own address parsing, separately from the check.

That third point is the crack in the wall. The check and the request are performed by different pieces of software, on different versions of the same information.

For each of the four cases the attacker needs something slightly different. For the first, they need to control a DNS server, which is a computer that answers the phone book question for a domain they own. For the second, they only need a hostname that has an IPv6 address and no IPv4 address. For the third, they need a web server that can answer with a redirect. For the fourth, they need a piece of text that two different URL parsers read differently.

How the flaws were found

The article presents the four bypasses as a pattern rather than a single bug. In February 2026 the Craft CMS team released a patch for an SSRF vulnerability. Craft CMS is a content management system: software people use to build and run websites. The patch did the textbook thing: look up the hostname, check it against a blocklist of cloud metadata addresses, reject on a match.

On the same day, two independent bypasses were published against that patch. One used DNS rebinding, so the same hostname gave different IP addresses at different moments. The other exploited the fact that the check only understood IPv4 addresses, while AWS had an IPv6 metadata address available all along.

What made the pattern visible is that the check and the request operate on two separate representations of the destination. The thing that was checked is not the thing that was connected to. The article generalises this into one picture: every bypass exploits a gap between what the validator checks and what the network actually does.

Table listing four SSRF bypass techniques and the gap each exploits: DNS rebinding exploits the gap between DNS answers during validation and request; IPv6/encoding exploits the gap between address families the validator and network understand; redirect chains exploit the gap between the checked URL
Every SSRF bypass exploits the same pattern: a gap between what the validator checks and what the network actually does. From the original on medium.com

The table in that image lays out the four techniques and the gap each one uses. DNS rebinding exploits the gap between the DNS answer seen during validation and the one used for the request. IPv6 and encoding tricks exploit the gap between the address families the validator understands and the ones the network understands. Redirect chains exploit the gap between the checked URL and the final destination. The fourth, parsing inconsistency, exploits the gap between two parsers reading the same text.

Step 1: DNS rebinding (CVE-2026-27127)

The idea, from zero

Remember that DNS is a phone book. When your program asks "what is the number for evil.attacker.com?", the answer comes from a DNS server that the domain's owner controls. The owner can make that server answer however they like, and they can make it answer differently each time it is asked.

There is also a setting called TTL, short for time to live. It tells the asker how long they may keep the answer before asking again. A TTL of zero means "do not remember this at all, ask again next time".

So the attacker sets up a DNS server for evil.attacker.com with one odd behaviour: the first time it is asked, it gives a harmless public address. The second time it is asked, it gives the AWS metadata address. Because the TTL is zero, nothing is remembered in between.

The developer's code calls gethostbyname($hostname), compares the result against a list of dangerous IPs, and rejects the request if it matches. The code is clean, the tests pass, and it ships. But the check asks DNS once, and the HTTP client asks DNS again when it actually makes the request. Two questions, two answers.

The sequence

When the application receives http://evil.attacker.com/latest/meta-data/, this is what happens:

Text
Query 1 (validation):   evil.attacker.com → [redacted]          ✓ looks safeQuery 2 (Guzzle/curl):  evil.attacker.com → [redacted]  ← AWS IMDS

Line by line:

  • Query 1 (validation) is the lookup the security check performs. It asks the phone book for evil.attacker.com and gets [redacted], a harmless public address. The check compares it to the blocklist, finds no match, and lets the request through.
  • Query 2 (Guzzle/curl) is the lookup the HTTP client performs when it actually sends the request. Guzzle is a PHP library for making web requests, and curl is a widely used tool and library for the same job, which Guzzle uses underneath. This time the attacker's DNS server answers with [redacted], the AWS metadata address.
  • The arrow with ← AWS IMDS marks where the request actually lands: the cloud's secret key service.

The check passed. The request went to the metadata service. The attacker now has the server's cloud credentials.

In security terms this is a time-of-check-time-of-use problem, often shortened to TOCTOU. The thing you checked is not the thing you connected to, because the answer changed between the two moments. The article compares it to a magician's trick: while you are looking at one card, another is swapped in.

Why the obvious fix is fragile

The advisory recommends CURLOPT_RESOLVE, a curl setting that lets you pin a hostname to a fixed address so curl does not look it up again. That works for curl. It does not work for Guzzle in all configurations, for Python's requests library, for Go's net/http, or for whatever HTTP client the application switches to next year. The fix is tied to one client's settings, and a developer has to remember to apply it every single time a request is built from user input.

How ressrf closes this gap

The core idea is simple: look up the name once, check the addresses you got, then connect to exactly those addresses. No second lookup ever happens.

Text
pub async fn resolve(&self, host: &str, port: u16) -> Result<ResolveResult, TcpGuardError> {    let addrs = self.dns.resolve(host, port).await?;    let mut validated = Vec::with_capacity(addrs.len());    for addr in &addrs {        match self.policy.is_network_allowed(&[addr.ip()]) {            Ok(()) => validated.push(*addr),            Err(_) => {  }        }    }    if validated.is_empty() {        return Err(TcpGuardError::AllBlocked { host: host.to_string() });    }    Ok(ResolveResult { addrs: validated, host: host.to_string() })}

Line by line:

  • pub async fn resolve(...) declares a function called resolve that takes a hostname and a port number and returns either a result or an error. async means it can wait for slow network work without freezing everything else.
  • let addrs = self.dns.resolve(host, port).await?; performs the one and only DNS lookup and stores the list of addresses it got back. The ? means "if this failed, stop here and pass the error up".
  • let mut validated = Vec::with_capacity(addrs.len()); creates an empty list to hold the addresses that pass the check, sized for the number of addresses returned.
  • for addr in &addrs { goes through each address in turn.
  • match self.policy.is_network_allowed(&[addr.ip()]) asks the policy whether this address is allowed. The policy is the set of rules: which networks are off limits.
  • Ok(()) => validated.push(*addr), if the address is allowed, add it to the validated list.
  • Err(_) => { } if it is not allowed, do nothing: the address is silently dropped.
  • if validated.is_empty() { return Err(TcpGuardError::AllBlocked { ... }); } if every address was dropped, return an error saying everything was blocked.
  • Ok(ResolveResult { addrs: validated, host: host.to_string() }) otherwise return the surviving addresses, together with the hostname for reference.

Then the connector dials only those checked addresses:

Text
pub async fn connect(&self, host: &str, port: u16) -> Result<TcpStream, TcpGuardError> {    let resolved = self.resolver.resolve(host, port).await?;    for addr in &resolved.addrs {        match self.connect_addr(*addr, start).await {            Ok(stream) => return Ok(stream),            Err(e) => { last_err = Some(e); }        }    }    Err(last_err.unwrap_or_else(|| TcpGuardError::AllBlocked { host: host.to_string() }))}

Line by line:

  • pub async fn connect(...) is the function that opens the actual network connection.
  • let resolved = self.resolver.resolve(host, port).await?; calls the resolver above, so the addresses have already been checked before anything is dialled.
  • for addr in &resolved.addrs { tries each checked address in turn.
  • match self.connect_addr(*addr, start).await attempts to open a connection to that specific address.
  • Ok(stream) => return Ok(stream), if it works, hand back the open connection immediately.
  • Err(e) => { last_err = Some(e); } if it fails, remember the error and try the next address.
  • Err(last_err.unwrap_or_else(|| TcpGuardError::AllBlocked { ... })) if none worked, return the last error, or a "everything blocked" error if there was none.

There is no gap between checking and using. The DNS answer is checked, and the checked address is what the connection is made to. The magician has no window to swap cards.

The same pattern exists in every language binding. A binding is a version of a library packaged for a particular programming language. Here is the Go version:

Text
dialer := policy.SafeDialer()conn, err := dialer.DialContext(ctx, "tcp", "evil.attacker.com:80")

Line by line:

  • dialer := policy.SafeDialer() asks the policy for a dialler, a small object whose only job is to open connections safely.
  • conn, err := dialer.DialContext(ctx, "tcp", "evil.attacker.com:80") opens a connection to the hostname on port 80 using the TCP protocol. Because the dialler came from the policy, the lookup and the check happen inside it, and the connection goes to the checked address.

And the Python version:

Text
from ressrf.protocols.tcp import safe_getaddrinfoaddrs = safe_getaddrinfo(policy, "evil.attacker.com", 80)

Line by line:

  • from ressrf.protocols.tcp import safe_getaddrinfo imports the safe lookup function. getaddrinfo is the standard operating system call for turning a hostname into addresses; this is a wrapped version that applies the policy.
  • addrs = safe_getaddrinfo(policy, "evil.attacker.com", 80) performs the lookup under the policy and stores the checked addresses.

Step 2: The address you did not check (CVE-2026-27129)

The idea, from zero

There are two versions of the internet addressing system. IPv4 addresses look like [redacted]: four numbers separated by dots. IPv6 addresses are longer and look like fd00:ec2::254, written with colons and hexadecimal digits. Most computers and networks speak both, and a single hostname can have both an IPv4 address (called an A record in DNS) and an IPv6 address (called an AAAA record, pronounced "quad A").

This case is the same application, the same week, a different bypass. The attacker does not need a custom DNS server this time. They only need a hostname that has an AAAA record and no A record.

The validation code calls gethostbyname(). PHP's own documentation says this function returns "the IPv4 address corresponding to a given Internet host name". If the hostname has no IPv4 address, it does not fail: it returns the hostname text unchanged. So the blocklist comparison ends up comparing a hostname against a list of IP addresses, which can never match.

The comparison that always fails

Text
in_array("fd00-ec2--254.sslip.io", ['[redacted]', '[redacted]', ...])

Line by line:

  • in_array(...) is a PHP function that checks whether a value appears in a list.
  • "fd00-ec2--254.sslip.io" is the value being looked for. It is a hostname, not an address, because the lookup could not produce an IPv4 address and returned the name unchanged. sslip.io is a service that turns a name into an address by reading the name itself.
  • ['[redacted]', '[redacted]', ...] is the blocklist: the AWS metadata address and the ECS task metadata address, and more entries the article does not list.

The comparison is between a name and a set of numbers, so it finds nothing and validation passes. Then Guzzle, which uses libcurl underneath, happily looks up the AAAA record and connects to fd00:ec2::254, the IPv6 address of the AWS metadata service. Credentials are stolen.

The wider family of tricks

IPv6 is just one variant of a bigger problem: the same address can be written in many ways, and if your checker only understands one way of writing it, the attacker uses another.

  • 0177.0.0.1 is [redacted] written in octal, a base-8 number system. [redacted] is the "localhost" address, meaning the machine itself.
  • 0x7f000001 is the same address in hexadecimal, base 16.
  • ::ffff:[redacted] is an IPv4 address written in IPv6 notation, called IPv4-mapped IPv6.
  • fd00:ec2::254 is the native IPv6 address of the AWS metadata service.
  • 2852039166 is [redacted] written as one big decimal number.

If the checker speaks one dialect and the network speaks another, the attacker speaks both. The everyday comparison: a bouncer with a list of banned names who only reads English will let in the same person using a passport in another language.

How ressrf closes this gap

The address-matching engine, called the CIDR engine, converts every address into a single 128-bit form before comparing anything. A bit is a single zero or one; 128 bits is the width of an IPv6 address. IPv4 addresses are mapped into that form with a +96 adjustment, because an IPv4 address is 32 bits and 32 + 96 = 128.

Text
fn normalize_to_ipv6(ip: IpAddr, prefix_len: u8) -> Result<(Ipv6Addr, u8)> {    match ip {        IpAddr::V4(v4) => {            let mapped = v4.to_ipv6_mapped();            let adjusted = prefix_len + 96;            Ok((mapped, adjusted))        }        IpAddr::V6(v6) => Ok((v6, prefix_len)),    }}

Line by line:

  • fn normalize_to_ipv6(ip: IpAddr, prefix_len: u8) declares a function that takes an address and a prefix length. The prefix length says how many leading bits define a network, like how many digits of a postcode define a district.
  • match ip { chooses what to do depending on whether the address is IPv4 or IPv6.
  • IpAddr::V4(v4) => { handles the IPv4 case.
  • let mapped = v4.to_ipv6_mapped(); converts the IPv4 address into its IPv6-mapped form.
  • let adjusted = prefix_len + 96; shifts the prefix length by 96 bits to match the new width.
  • Ok((mapped, adjusted)) returns the converted address and adjusted prefix.
  • IpAddr::V6(v6) => Ok((v6, prefix_len)), an IPv6 address is already in the right form, so it is returned unchanged.

The containment check, which asks "is this address inside a forbidden range?", also converts the input first:

Text
pub fn contains(&self, ip: IpAddr) -> bool {    let normalized = match ip {        IpAddr::V4(v4) => v4.to_ipv6_mapped(),        IpAddr::V6(v6) => v6,    };        normalized.octets().iter()        .zip(self.mask.iter())        .zip(self.network.iter())        .all(|((&octet, &mask), &net)| (octet & mask) == net)}

Line by line:

  • pub fn contains(&self, ip: IpAddr) -> bool declares a function that answers yes or no for a given address.
  • let normalized = match ip { ... }; converts the address to the single 128-bit form, exactly as above.
  • normalized.octets().iter() walks through the address one byte at a time. An octet is a byte, eight bits.
  • .zip(self.mask.iter()) pairs each address byte with the corresponding byte of the mask. The mask says which bits matter for this range.
  • .zip(self.network.iter()) pairs those with the corresponding byte of the network definition.
  • .all(|((&octet, &mask), &net)| (octet & mask) == net) checks every position: take the address byte, keep only the bits the mask allows, and see whether it equals the network byte. If every position matches, the address is inside the range.

So whether the attacker supplies [redacted] or ::ffff:[redacted], both become the same 128-bit value and the deny list catches them. And fd00:ec2::254 is caught by the cloud module's explicit IPv6 deny range. No way of writing the address escapes validation.

For the octal and hex tricks, the library refuses to parse such addresses at all:

Text
fn reject_ambiguous_ipv4(s: &str) -> Result<()> {    for octet_str in s.split('.') {        if octet_str.is_empty() {            return Err(Error::Parse("empty octet in IPv4 address".into()));        }        if octet_str.starts_with("0x") || octet_str.starts_with("0X") {            return Err(Error::Parse("hex notation not allowed in IP addresses".into()));        }        if octet_str.len() > 1 && octet_str.starts_with('0') {            return Err(Error::Parse("leading zeros (octal notation) not allowed".into()));        }    }    Ok(())}

Line by line:

  • fn reject_ambiguous_ipv4(s: &str) -> Result<()> declares a function that takes the text of an address and returns either success or an error.
  • for octet_str in s.split('.') { splits the text at every dot and looks at each piece.
  • if octet_str.is_empty() { return Err(...); } an empty piece, as in 1..2, is rejected.
  • if octet_str.starts_with("0x") || octet_str.starts_with("0X") { return Err(...); } a piece starting with 0x is hexadecimal notation and is rejected.
  • if octet_str.len() > 1 && octet_str.starts_with('0') { return Err(...); } a piece longer than one character that starts with a zero is octal notation and is rejected. A single 0 is fine, because that is just zero.
  • Ok(()) if nothing was rejected, the address is accepted.

The AWS cloud module lists the IPv6 metadata address explicitly in its deny list:

JSON
{  "deny_ranges": [    { "cidr": "[redacted]/32", "name": "IMDS (IPv4)" },    { "cidr": "fd00:ec2::254/128",  "name": "IMDSv2 (IPv6)" },    { "cidr": "[redacted]/32",   "name": "ECS task metadata" }  ]}

Line by line:

  • "deny_ranges" is the list of forbidden address ranges.
  • "[redacted]/32" is the IPv4 metadata address. The /32 means all 32 bits must match, so it is exactly this one address.
  • "fd00:ec2::254/128" is the IPv6 metadata address. The /128 means all 128 bits must match, so again exactly one address.
  • "[redacted]/32" is the address used by ECS, Amazon's container service, to give containers their metadata.
  • The name fields are just labels for humans reading the file.

The DNS layer, using either tokio::net::lookup_host or hickory-resolver, returns both A and AAAA records, and every returned address is checked. There is no "IPv4-only glasses" problem, because the library does not split the lookup by address family.

Step 3: Following the breadcrumbs (CVE-2026-5921)

The idea, from zero

A redirect is what happens when you ask a web server for something and it answers "not here, go to this other address instead". Browsers follow redirects automatically, which is why typing an old web address often lands you on the new one. The specific answer used here is a 302, which means "found elsewhere, temporarily".

This case is different from the first two. The initial URL is perfectly safe. The problem is not what you request, but where the request takes you.

GitHub Enterprise Server is the self-hosted version of GitHub, the code hosting service. Its notebook rendering service fetched external resources so it could display them inline. It checked the initial URL. Then it followed HTTP redirects without re-checking the destination. An attacker could host a notebook that referenced a URL on their own server, which answered with a 302 pointing at an internal service, and the renderer dutifully followed it.

But it gets worse. The attacker could not read the response from internal services directly, because the content was rendered rather than returned raw. So they used a timing side channel: they pointed the redirect at an internal API that answers questions using regular expressions, crafted queries that would match or not match specific characters of secret values, and measured how long the answers took. A regular expression, or regex, is a pattern-matching language for text. Character by character, they extracted sensitive environment variables. Environment variables are settings stored by the operating system and handed to programs, often including passwords and keys.

The obvious fix is to re-check after redirects. But in practice, HTTP clients hide redirect following from the programmer. You hand a URL to requests.get() or http.Get() and get back the final response. The intermediate stops are invisible unless you specifically ask to intercept them.

How ressrf closes this gap

The RedirectValidator sits in the redirect chain and runs every stop through the full policy:

Text
pub fn validate_hop(&self, target_url: &str) -> Result<(), HttpGuardError> {    let hop = self.hops.fetch_add(1, Ordering::Relaxed);    if hop >= self.redirect_policy.max_redirects {        return Err(HttpGuardError::TooManyRedirects { max: self.redirect_policy.max_redirects });    }        let validator = ressrf_core::UriValidator::default();    if let Err(_) = validator.validate_url(target_url, Some(&self.policy)) {        return Err(HttpGuardError::RedirectBlocked { hop: hop + 1, url: target_url.to_string() });    }        if let Some(scheme_end) = target_url.find("://") {        let scheme = &target_url[..scheme_end];        if self.policy.validate_scheme(scheme).is_err() {            return Err(HttpGuardError::RedirectBlocked { hop: hop + 1, url: target_url.to_string() });        }    }    Ok(())}

Line by line:

  • pub fn validate_hop(&self, target_url: &str) -> Result<(), HttpGuardError> declares a function that checks one stop in a redirect chain. A hop is one redirect step.
  • let hop = self.hops.fetch_add(1, Ordering::Relaxed); increases a counter by one and returns the previous value, so the code knows which stop this is. Ordering::Relaxed is a low-precision instruction about how multiple threads coordinate the counter.
  • if hop >= self.redirect_policy.max_redirects { return Err(...); } if the number of stops has reached the configured maximum, refuse. This stops endless redirect loops.
  • let validator = ressrf_core::UriValidator::default(); creates the standard URL checker.
  • if let Err(_) = validator.validate_url(target_url, Some(&self.policy)) { return Err(...); } runs the full policy against this stop's address. If it fails, the redirect is blocked and the error records which stop and which URL.
  • if let Some(scheme_end) = target_url.find("://") { looks for the :// that separates the scheme from the rest of the address. The scheme is the part before it, like http or https.
  • let scheme = &target_url[..scheme_end]; takes the scheme text.
  • if self.policy.validate_scheme(scheme).is_err() { return Err(...); } checks that the scheme is allowed, so a redirect cannot switch to something unexpected.
  • Ok(()) if all checks pass, this stop is allowed.

It plugs into the client's redirect handling. Here is the Rust client reqwest:

Text
use std::sync::Arc;let policy = Arc::new(policy);let validator = RedirectValidator::new(policy, RedirectPolicy::follow(10));let client = reqwest::Client::builder()    .redirect(reqwest::redirect::Policy::custom(move |attempt| {        match validator.validate_hop(attempt.url().as_str()) {            Ok(()) => attempt.follow(),            Err(_) => attempt.stop(),        }    }))    .build()?;

Line by line:

  • use std::sync::Arc; imports Arc, a wrapper that lets several parts of a program share one value safely.
  • let policy = Arc::new(policy); wraps the policy so it can be shared.
  • let validator = RedirectValidator::new(policy, RedirectPolicy::follow(10)); creates the redirect checker with a maximum of 10 redirects.
  • let client = reqwest::Client::builder() starts building an HTTP client.
  • .redirect(reqwest::redirect::Policy::custom(move |attempt| { ... })) installs a custom rule that runs on every redirect attempt.
  • match validator.validate_hop(attempt.url().as_str()) checks the address the redirect wants to go to.
  • Ok(()) => attempt.follow(), if the check passes, follow the redirect.
  • Err(_) => attempt.stop(), if it fails, stop and do not follow.
  • .build()?; finishes building the client, or returns an error if building failed.

The redirect chain from the GitHub advisory would die at the second stop: the initial URL passes because it points at the attacker's server, but the 302 target resolves to an internal address, and the validator blocks it. The timing side channel never gets a chance to work, because the connection to the internal service is never made.

Step 4: Two parsers, one URL (CVE-2026-25960)

The idea, from zero

A URL parser is a piece of software that takes the text of a web address and works out its parts: the scheme, the hostname, the path, and so on. Different parsers are written by different people and can disagree about unusual text. When one part of a program uses one parser to decide whether an address is safe, and another part uses a different parser to decide where to send the request, the attacker only has to find text where the two disagree.

This is the most subtle of the four bypasses, and perhaps the most instructive about why SSRF protection cannot simply be bolted on as a separate layer.

vLLM is a tool for running large language models, the kind of software behind chat assistants. Its load_from_url_async method validated URLs before fetching them. The validation used urllib3.util.parse_url() to extract the hostname, checked it against an allowlist, and if it passed, handed the URL to aiohttp for the actual request. An allowlist is the opposite of a blocklist: only listed things are permitted. Here is the problem: aiohttp uses yarl internally, and urllib3 and yarl disagree about backslashes.

Given the URL https://httpbin.org\@evil.com/:

  • urllib3 treats \ as a literal character in the path. It URL-encodes it to %5C. The hostname is httpbin.org. Validation passes.
  • yarl, used by aiohttp, treats \@ as a separator between login details and the host. The hostname becomes evil.com. The request goes to the attacker.

Same bytes, two parsers, two interpretations. The attacker finds the input where they disagree.

Why this keeps happening

This is not a bug in either parser. Both follow their own internally consistent logic. The vulnerability exists in the gap between them: the application uses one parser to decide whether a URL is safe, and a different parser to decide where to send the request.

The article calls this the "two kings in one kingdom" problem. Two authorities both claim to rule the same input. When they disagree, the attacker is the only one who benefits. The pattern is everywhere: any time validation and execution parse the same input independently, there is a surface for parser differential attacks.

How ressrf closes this gap

ressrf's answer is architectural: do not have two parsers. The policy is not a pre-flight check on a URL string that then gets handed to a separate HTTP client. The policy lives at the transport layer itself, at the moment of DNS resolution.

The first line of defence is normalisation. Before the URL validator even extracts the host, it replaces backslashes with forward slashes in the part after the scheme:

Text
let (scheme, rest_owned) = if let Some(idx) = url.find("://") {    let scheme = &url[..idx];    let rest = &url[idx + 3..];    let rest_normalized = rest.replace('\\', "/");    (Some(String::from(scheme)), rest_normalized)} else {    (None, url.replace('\\', "/"))};

Line by line:

  • let (scheme, rest_owned) = ... prepares to store two values: the scheme and the rest of the address.
  • if let Some(idx) = url.find("://") { looks for the :// separator and remembers its position.
  • let scheme = &url[..idx]; takes everything before it as the scheme.
  • let rest = &url[idx + 3..]; takes everything after it as the rest. The + 3 skips the three characters of ://.
  • let rest_normalized = rest.replace('\\', "/"); replaces every backslash with a forward slash.
  • (Some(String::from(scheme)), rest_normalized) returns the scheme and the normalised rest.
  • } else { (None, url.replace('\\', "/")) }; if there is no ://, there is no scheme, and the whole address is normalised.

Given the vLLM payload https://httpbin.org\@evil.com/, the part after the scheme, httpbin.org\@evil.com/, becomes httpbin.org/@evil.com/. The host is now unambiguously httpbin.org, and /@evil.com/ is the path. There is no ambiguity left for two parsers to disagree about.

The second line of defence catches login-detail tricks that survive normalisation:

Text
fn has_userinfo_bypass(url: &str) -> bool {    let rest = if let Some(idx) = url.find("://") { &url[idx + 3..] } else { url };    let authority = rest.split('/').next().unwrap_or(rest);    let authority = authority.split('?').next().unwrap_or(authority);    let authority = authority.split('#').next().unwrap_or(authority);        if authority.contains('@') && authority.contains("%40") {        return true;    }        if let Some(encoded_at_pos) = authority.find("%40") {        let after = &authority[encoded_at_pos + 3..];        let after_host = if let Some(at_idx) = after.rfind('@') {            &after[at_idx + 1..] } else { after };        if after_host.contains('.') || after_host.contains(':') {            return true;        }    }    false}

Line by line:

  • fn has_userinfo_bypass(url: &str) -> bool declares a function that answers yes or no for a given address. Userinfo is the optional username:password@ part at the start of a URL.
  • let rest = if let Some(idx) = url.find("://") { &url[idx + 3..] } else { url }; takes the part after the scheme, or the whole address if there is no scheme.
  • let authority = rest.split('/').next().unwrap_or(rest); takes the part before the first slash. The authority is the host part of a URL, optionally with login details and a port.
  • let authority = authority.split('?').next().unwrap_or(authority); cuts off anything after a question mark, which starts the query string.
  • let authority = authority.split('#').next().unwrap_or(authority); cuts off anything after a hash, which starts the fragment.
  • if authority.contains('@') && authority.contains("%40") { return true; } if the authority contains both a literal @ and its encoded form %40, that is suspicious, so report a bypass. %40 is how an @ is written when it must not be treated as a separator.
  • if let Some(encoded_at_pos) = authority.find("%40") { otherwise, if there is an encoded @, look at what follows it.
  • let after = &authority[encoded_at_pos + 3..]; take the text after the %40. The + 3 skips the three characters of %40.
  • let after_host = if let Some(at_idx) = after.rfind('@') { &after[at_idx + 1..] } else { after }; if there is another @ later, take what follows the last one; otherwise take everything.
  • if after_host.contains('.') || after_host.contains(':') { return true; } if what remains looks like a hostname (contains a dot) or has a port (contains a colon), report a bypass.
  • false otherwise, no bypass found.

But the deepest defence is architectural. The protocol adapters do not work as URL-string middleware. They work at the DNS and connection layer. The HTTP adapter checks the resolved address of whatever hostname the HTTP client actually connects to. It does not matter what a string parser thinks the hostname is, because the check happens on the actual network address the operating system is about to dial.

In the vLLM scenario, even if a URL somehow confused the string-level validator, the protocol adapter would still catch the connection to evil.com at the DNS lookup. If evil.com resolved to a blocked address, it would be blocked. If it resolved to a safe address, you are connecting to a safe address regardless. The parser disagreement becomes irrelevant, because the check happens on the resolved address, not on a parser's reading of the text.

The pattern behind the patches

Step back from the four stories and one pattern appears. Every bypass exploits a gap between what was checked and what was used.

Ad-hoc fixes try to close each gap separately: pin DNS with CURLOPT_RESOLVE, add AAAA checks, intercept redirects, normalise URLs. Each fix is specific to one client, one language, one vulnerability. Next quarter a new gap opens.

The article quotes 0xdade: "Security is the side-effect of good engineering." The point is that security is not a product you bolt on, and not a regex you stick in front of a request handler. It is what falls out naturally when the system is designed so that the unsafe state cannot be represented at all. SSRF prevention is no different. You do not solve it by adding more checks. You solve it by removing the gap between checking and connecting.

ressrf closes these gaps by refusing to have them:

  • No second DNS lookup. Look up once, check, connect to the checked address.
  • One address representation. Everything becomes 128-bit IPv6 before comparison. Octal and hex are rejected at parse time.
  • Re-check every stop. The redirect interceptor runs the full policy on each target.
  • Be the resolver. The policy works at the transport layer, not as a string pre-check.

These are not four separate features. They are four consequences of one design decision: the library sits between your application and the network, checking the actual destination at the moment of connection, not a string representation of what you hope the destination will be.

What this means for you

If you are building an application that fetches URLs on behalf of users, you are playing a game with four categories of hostile input and a growing list of bypasses. You can keep patching each one as it arrives, or you can move the check to a layer where the bypasses stop working.

The four advisories in this article are not outliers. They are the predictable result of a pattern most applications follow: check a string, then hand that string to a separate system that reads it again. Every seam between checking and doing is a surface an attacker can exploit.

ressrf was built to remove those seams. It is not a blocklist. It is not a regex. It is a policy engine that lives inside your HTTP client's DNS resolver and connection layer, checking the actual network destination at the moment the connection opens. DNS rebinding, address encoding tricks, redirect chains and parser disagreements all become irrelevant when the thing you check is the thing you connect to.

Getting started

Integration takes a few lines in any of the four supported languages. Rust first:

Text
use ressrf_core::{PolicyBuilder, CloudProvider};use ressrf_tcp::SafeConnector;let mut builder = PolicyBuilder::external_only();builder.with_cloud(CloudProvider::Aws)    .with_cloud(CloudProvider::Azure)    .with_cloud(CloudProvider::Gcp);let policy = builder.build();let connector = SafeConnector::new(policy);let stream = connector.connect("example.com", 443).await?;

Line by line:

  • use ressrf_core::{PolicyBuilder, CloudProvider}; imports the tools for building a policy and naming cloud providers.
  • use ressrf_tcp::SafeConnector; imports the safe connector, the object that opens checked connections.
  • let mut builder = PolicyBuilder::external_only(); starts a policy that only allows external addresses. mut means the builder can be changed as we go.
  • builder.with_cloud(CloudProvider::Aws) adds AWS-specific forbidden ranges.
  • .with_cloud(CloudProvider::Azure) adds Azure's, Microsoft's cloud.
  • .with_cloud(CloudProvider::Gcp); adds Google Cloud's.
  • let policy = builder.build(); produces the finished policy.
  • let connector = SafeConnector::new(policy); creates a connector that uses it.
  • let stream = connector.connect("example.com", 443).await?; opens a checked connection to example.com on port 443, the standard HTTPS port.

Go:

Text
policy, _ := ressrf.NewPolicyBuilder(ressrf.PresetExternalOnly).    WithCloudProviders("aws", "azure", "gcp").    Build(ctx)defer policy.Close(ctx)client := policy.HTTPClient(http.DefaultTransport)

Line by line:

  • policy, _ := ressrf.NewPolicyBuilder(ressrf.PresetExternalOnly). starts a policy from the external-only preset. The _ discards an error value the function also returns.
  • .WithCloudProviders("aws", "azure", "gcp"). adds the three cloud providers' forbidden ranges.
  • .Build(ctx) finishes the policy. ctx is a context, a standard way to carry cancellation and deadlines.
  • defer policy.Close(ctx) arranges for the policy to be cleaned up when the function ends.
  • client := policy.HTTPClient(http.DefaultTransport) creates an HTTP client that uses the policy, wrapping Go's standard transport.

Python:

Text
from ressrf import Policyfrom ressrf.protocols.http import SafeTransportpolicy = Policy.external_only(cloud=["aws", "azure", "gcp"])client = httpx.Client(transport=SafeTransport(policy))

Line by line:

  • from ressrf import Policy imports the policy class.
  • from ressrf.protocols.http import SafeTransport imports the safe transport, the piece that carries HTTP requests through the policy.
  • policy = Policy.external_only(cloud=["aws", "azure", "gcp"]) creates an external-only policy with the three clouds.
  • client = httpx.Client(transport=SafeTransport(policy)) creates an HTTP client that sends everything through the safe transport.

JavaScript:

Text
import { Policy, http } from "ressrf";const policy = await Policy.externalOnly({ cloud: ["aws", "azure", "gcp"] });const res = await http.safeFetch(url, { policy });

Line by line:

  • import { Policy, http } from "ressrf"; imports the policy and the safe HTTP helpers.
  • const policy = await Policy.externalOnly({ cloud: ["aws", "azure", "gcp"] }); creates an external-only policy with the three clouds. await means wait for the setup to finish.
  • const res = await http.safeFetch(url, { policy }); fetches the URL through the policy and stores the response.

The ExternalOnly preset blocks all IANA special-purpose ranges, cloud metadata endpoints and link-local addresses out of the box. IANA is the organisation that keeps the official registries of internet numbers and names. Link-local addresses are addresses a machine may use only on its own local network segment. Cloud modules add provider-specific forbidden ranges: AWS IMDS and ECS, IPv4 and IPv6; Azure IMDS and Wireserver; GCP metadata. You can open holes with allow lists for internal services you trust, or add URL rules for fine-grained control over paths.

The Rust core is fuzz-tested weekly with three cargo-fuzz targets. Fuzz testing means feeding a program large amounts of random or malformed input to see if it breaks. All four language bindings run the same shared test vectors in CI. CI stands for continuous integration, an automated system that runs tests whenever code changes. A bypass that worked in one language would fail the shared test suite in every other. The default deny list comes from IANA special-purpose registries and is refreshed monthly by an automated workflow.

Acknowledgements

ressrf did not emerge in a vacuum. Several existing projects shaped its design and provided test data:

  • Microsoft's AntiSSRF pioneered the two-layer architecture of policy engine plus transport integration that ressrf follows. Its IP range data and test suite seeded ressrf's first test vectors.
  • Stripe's Smokescreen showed that an egress proxy with SSRF-aware policy is viable at scale, and is the reference architecture for ressrf's planned standalone proxy mode. An egress proxy is a single gateway that all outgoing traffic passes through, so rules can be applied in one place.
  • Arcjet proved the Rust-core-compiled-to-WASM architecture in production. WASM, short for WebAssembly, is a portable format that lets code written once run in many environments, so a single source of truth for security logic can serve Go, JavaScript and other runtimes without behaving differently.

These projects and many other libraries in different languages showed that the problem was solvable. ressrf's contribution is combining their insights into a single fuzz-tested library with bindings for four languages and a deny-first architecture that addresses all four bypass classes in this article.

Contributing

If you would like to see integration with your favourite programming language, cloud provider, protocol or library, you can open an issue or submit a pull request. Contributions of all kinds are welcome.

Further reading

An update at the top of the article notes that the Go binding now has a native port in pure Go, without WASM, under go-native/ressrf. The APIs are all the same, and the native port is arguably faster.

Glossary

  • 302: an HTTP response meaning "the thing you asked for is temporarily at another address, go there instead".
  • A record: the DNS entry that gives a hostname its IPv4 address.
  • AAAA record: the DNS entry that gives a hostname its IPv6 address, pronounced "quad A".
  • Allowlist: a list of things that are permitted, with everything else refused.
  • API: a defined way for one piece of software to ask another for something, like a service counter with a fixed set of requests.
  • Arcjet: a company whose product proved the Rust-core-compiled-to-WASM architecture in production.
  • Authority: the host part of a URL, optionally including login details and a port.
  • Binding: a version of a library packaged for a particular programming language.
  • Bit: a single binary digit, zero or one.
  • Blocklist: a list of things that are forbidden, with everything else allowed.
  • CIDR engine: the part of a library that decides whether an address falls inside a given range of addresses.
  • CI (continuous integration): an automated system that runs tests whenever code changes.
  • Craft CMS: content management system software used to build and run websites.
  • Credentials: secret strings that prove who a computer or person is, and let them use services.
  • curl: a widely used tool and library for making web requests.
  • CVE: a public catalogue number for a known security flaw.
  • CVSS: a score from 0 to 10 for how serious a security flaw is.
  • DNS (Domain Name System): the internet's phone book, translating hostnames into IP addresses.
  • DNS rebinding: an attack where a hostname resolves to a safe address during a check and a dangerous one during the actual request.
  • Egress proxy: a single gateway that all outgoing traffic passes through, so rules can be applied in one place.
  • Environment variables: settings stored by the operating system and handed to programs, often including passwords and keys.
  • Fuzz testing: feeding a program large amounts of random or malformed input to find crashes and bugs.
  • Guzzle: a PHP library for making web requests.
  • Hop: one step in a chain of redirects.
  • Hostname: the human-friendly name of a computer on the internet, like example.com.
  • HTTP client: the part of a program that makes web requests.
  • IANA: the organisation that keeps the official registries of internet numbers and names.
  • IMDS (instance metadata service): a special cloud address a server can ask for information about itself, including temporary credentials.
  • Instance metadata service: see IMDS.
  • IPv4: the older internet addressing system, written as four numbers separated by dots.
  • IPv6: the newer internet addressing system, written with colons and hexadecimal digits.
  • Library: a bundle of ready-made code that programmers add to their own programs.
  • Link-local address: an address a machine may use only on its own local network segment.
  • Octet: a byte, eight bits; one of the four numbers in an IPv4 address.
  • Parser: a piece of software that takes text and works out its structure and parts.
  • Parser differential: an attack that relies on two parsers reading the same input differently.
  • Policy: the set of rules saying which addresses and schemes are allowed or forbidden.
  • Redirect: a web server's answer telling the client to go to a different address instead.
  • Regular expression (regex): a pattern-matching language for text.
  • Scheme: the part of a URL before ://, like http or https.
  • SSRF (server-side request forgery): making a server fetch an address of your choosing, so it reaches places you cannot.
  • Timing side channel: learning secret information by measuring how long operations take rather than reading their output.
  • TOCTOU (time-of-check-time-of-use): a flaw where something is checked at one moment and used at another, and it changes in between.
  • TTL (time to live): how long a DNS answer may be remembered before asking again.
  • URL parser: software that takes the text of a web address and works out its parts.
  • Userinfo: the optional username:password@ part at the start of a URL.
  • vLLM: software for running large language models.
  • WASM (WebAssembly): a portable code format that lets code written once run in many environments.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.