CRLF Injection in HTTP header values allows arbitrary header injection
curl allows carriage return and line feed characters inside HTTP header values, so when attacker-controlled data is placed in a header value, curl sends a malformed request with injected headers. An attacker who can influence a header value could inject arbitrary headers, leading to privilege bypass or request smuggling in proxy environments.
Originally disclosed on HackerOne
- Disclosed after 5 hours
curl allows carriage return (\r) and line feed (\n) characters inside HTTP header values. When attacker-controlled data is used in a header value (e.g., Authorization: Bearer <token>), curl construct and sends a malformed HTTP request containing injected headers.
This violates HTTP specification (RFC 7320 /RFC 9110), which forbid CR/LF in header field values, and result in client-side HTTP request splitting.
##Step To Reproduce:
- Run a local HTTP server that checks for a privileged headers:
from http.server import BaseHTTPRequestHandler, HTTPServer
class H(BaseHTTPRequestHandler):
def do_POST(self):
is_admin = self.headers.get("X-Admin") == "1"
length = int(self.headers.get("Content-Length","0"))
self.rfile.read(length)
if self.path == "/delete" and is_admin:
self.send_response(200); self.end_headers()
self.wfile.write(b"DELETED (admin)\n")
return
self.send_response(403); self.end_headers()
self.wfile.write(b"FORBIDDEN\n")
HTTPServer(("127.0.0.1", 8085), H).serve_forever()
- Normal request (expected 403):
curl -X POST http://127.0.0.1:8085/delete -d 'x=1'
- inject headers via Bearer token:
TOKEN=$'abc\r\nX-Admin: 1\r\n'
curl -v -X POST http://127.0.0.1:8085/delete \
-H "Authorization: Bearer ${TOKEN}" \
-d 'x=1'
##Observed Result: curl send the following request:
Authorization: Bearer abc
X-Admin: 1
server responds with:
200 OK
DELETED (admin)
##Expected Result: curl should reject or sanitized CR/LF characters in HTTP header values and refuse to end the request.
Impact
An attacker who can influence header values can inject arbitrary headers into outgoing HTTP request, Leading to:
- Authorization or privilege bypass
- manipulation of proxy-related headers (e.g.,
X-Forwarded-*) - Request smuggling chains in proxy environments
This issue is client-side and independent of server misconfiguration.
##Notes:
- The server behaves correctly.
- The issue occurs before any server-side parsing.
- The vulnerability exixts due to missing validation in curl's HTTP header construction logic.
Attachments





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 missing validation of CR/LF characters when curl constructs HTTP header values.
Impact
An attacker who can influence header values could inject arbitrary headers into outgoing HTTP requests, leading to authorization or privilege bypass, manipulation of proxy-related headers, or request smuggling chains in proxy environments.
What the attacker needed
Attacker controls a header value; curl used to send the request
The fix
curl should reject or sanitise CR/LF characters in HTTP header values and refuse to send the request.
How it was found
- Run a local HTTP server that checks for a privileged header.
- Send a normal request without the privileged header and observe a 403 response.
- Send a request with a Bearer token containing CR/LF and an injected privileged header.
- Observe that curl sends the injected header and the server responds with 200 and deletes the resource.
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.
HTTP headers are lines of text sent with a web request. A carriage return and line feed are special characters that mark the end of a line. If a program lets these characters appear inside a header value, an attacker can trick it into starting a new header line, adding extra instructions the server did not expect.
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.