Abusing Hop-by-Hop Header to Chain A CRLF Injection Vulnerability
A CRLF injection in the Location header of a redirect response allowed an attacker to inject arbitrary headers and body content. By abusing the hop-by-hop Connection header, the attacker could cause an intermediary proxy to remove the Location header, turning the redirect into a 200 response with attacker-controlled HTML, enabling XSS.
Published on redshark1802.com
This blog post explores a CRLF injection vulnerability in the Location header of an HTTP response and how it could be used to chain it with other attacks.
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 application failed to sanitise user input before placing it into the Location header, allowing carriage return and line feed characters to inject new headers and body content.
Impact
An attacker could perform open redirect, set cookies, inject arbitrary headers, and by removing the Location header via a proxy, achieve XSS by controlling the response body; however, the author was not able to chain it with SSRF or XXE.
What the attacker needed
CRLF injection in Location header; intermediary proxy that processes Connection header
How it was found
- Inject a Connection header with value 'Location, close' via the CRLF injection.
- Set the Content-Type header to text/html.
- Set an appropriate Content-Length header to ensure correct parsing.
- Inject the payload in the body of the response.
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.
A CRLF injection happens when a web application puts user input into an HTTP header without cleaning it, and the attacker can insert special characters that start a new line. This lets the attacker add extra headers or even a body to the response. Here, the attacker used a special header called Connection to make a proxy remove the redirect header, so the browser would show the attacker's content instead of redirecting.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.