curl mishandles `%0c%0b` sequences in HTTP responses leading to CRLF confusions, Headers and Cookies Injection
curl treats the %0c and %0b characters in an HTTP response's Location header as line breaks, so text after them is shown as a separate header. An attacker who controls a redirect target could therefore make curl display injected headers or cookies that other HTTP clients would not treat as headers.
- Disclosed after 7 months
Summary:
Hello,
Actually, this bug was found unexpectedly during some security audits on a private asset, we found some differences on how burp proxy/python's requests library handles the asset's HTTP responses on a certain endpoint and how curl handles the same HTTP responses, the bug arises when curl treats %0c and %0b sequences literally regardless how web servers respond to these characters, the mentioned asset was well-protected against CRLF injections as we didn't had success to inject headers/cookies using the known %0a%0b sequence, curl also didn't respond to our payloads as we hope, however, we tried using other non-printable characters, curl unexpectedly responded to our request using %0c with the following response:
gk@GKs-MacBook-Air ~ % curl "https://private.asset:8100/sap/public/bc/icf/logoff?redirecturl=//google.com/%0cX-Injected-Header:%20test" -I
HTTP/1.1 302 Moved temporarily
content-type: text/html; charset=utf-8
content-length: 17
location: //google.com/
X-Injected-Header: test
using %0c%0b sequences:
gk@GKs-MacBook-Air ~ % curl "https://private.asset:8100/sap/public/bc/icf/logoff?redirecturl=//google.com/%08%08%08%08%08%08%08%08%08%08%08%08%08%08%08%08%08%08%08%08%08%08%08%0cX-Header-Injection:%20test" -I
HTTP/1.1 302 Moved temporarily
content-type: text/html; charset=utf-8
content-length: 17
location: //google.com/
X-Header-Injection: test
While Burp responded differently:

Python's requests library responded also differently:

Even a random HTTP response viewer service on the public internet responded differently:

We found that you resolved the main CRLF issue (with %0a%0d) since 2012 with assigning CVE-2012-0036 to the security advisory published on your docs, but we think that our report describes a bug that makes CRLF indirectly possible again, with the high support for curl implementations in the most commonly used programming languages; the mentioned behavior could make some confusion when receiving HTTP responses from curl leading to unsafe CRLF treatment and thus allowing Headers/Cookies Injection.
Impact
CRLF confusions, Header Injection, Cookie Injection.
Regards,
Moaad (@mdakh404), Abdelkarim (@mchklt)
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely curl's response parser treats the form-feed and vertical-tab control characters as header line terminators, unlike other HTTP clients.
Impact
This could cause CRLF confusion and header or cookie injection in software that relies on curl's parsing of responses, though the report only demonstrates the display difference and does not show a full exploit.
What the attacker needed
Attacker controls a redirect target; software parses curl output as headers
How it was found
- Send a request with curl to an endpoint whose redirect target contains a form-feed character followed by header-like text.
- Observe that curl prints the text after the form-feed as a separate header in the response.
- Repeat with a form-feed and backspace characters and observe the same behaviour.
- Compare the output with Burp, Python requests and an online response viewer, which show the value differently.
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 report has not been written yet. The Original tab links to the source.
When a web server sends a redirect, it puts the new address in a 'Location' header. Some characters are supposed to end a header line, and others are not. curl appears to treat two unusual control characters as line endings, so it shows the rest of the address as if it were a new header. Other tools tested by the reporters did not do this.
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.