HTTP/3 connection contamination: an upcoming threat?
First-request routing in reverse proxies, combined with HTTP/2 connection coalescing, can cause requests for one host to be misrouted to another host's back-end. An attacker with XSS on a less secure sibling domain could then compromise a more secure domain that shares the same IP and wildcard certificate.
Published on portswigger.net
I recently documented a dangerous reverse-proxy behaviour called first-request routing, which enables host-header attacks on back-end systems. In this post, I'll show how first-request routing also enables a client-side, browser-based attack called HTTP connection contamination.
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.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the reverse proxy routes all requests on a connection based on the first request's Host header, without re-evaluating routing for subsequent requests, and this is combined with browser connection coalescing.
Impact
An attacker with XSS on one domain could compromise a sibling domain that shares the same IP and wildcard certificate, potentially stealing credentials and cookies; however, the author notes the threat is currently rare because first-request routing is uncommon and may cause intermittent breakage.
What the attacker needed
Victim uses a browser supporting HTTP/2+; two domains share IP and wildcard cert; XSS on one of the domains; reverse proxy uses first-request routing
The fix
Ensure reverse proxies do not perform first-request routing, and be aware that wildcard certificates with HTTP/3 increase risk.
How it was found
- The attacker identifies two domains that resolve to the same IP address and are covered by a wildcard TLS certificate.
- The attacker finds XSS on one of the domains (e.g., wordpress.example.com).
- The attacker crafts a page that uses fetch() to make a request to the vulnerable domain, causing the browser to open a connection.
- The attacker then navigates the victim to the other domain (e.g., secure.example.com), and the browser reuses the same connection due to connection coalescing.
- The reverse proxy, using first-request routing, misroutes the request for secure.example.com to the back-end of wordpress.example.com.
- The attacker's injected JavaScript runs in the context of secure.example.com, allowing theft of cookies, passwords, etc.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When your browser talks to a website, it may reuse the same connection for different sites if they share an IP address and certificate. Some proxies decide where to send all future requests based on the first request on that connection. If an attacker can run code on one site, they might trick the browser into sending requests for another site down the same connection, and the proxy sends them to the wrong place, letting the attacker steal data from the other site.
What is Smuggling / CRLF?
A front end and a back end split one connection's bytes into requests differently, letting an attacker hide a request inside another user's.