Incomplete Suppression of Transfer-Encoding: chunked Header in HTTP/2 After Redirect From HTTP/1.1
When curl sends a chunked HTTP/1.1 request and follows a redirect to an HTTP/2 endpoint, it keeps sending the Transfer-Encoding: chunked header even though HTTP/2 forbids it. This protocol confusion could enable request smuggling or desync attacks where proxies and CDNs translate between HTTP/1.1 and HTTP/2.
Originally disclosed on HackerOne
- Disclosed after 5 days
When curl send a request with Transfer-Encoding: chunked using HTTP/1.1, and follows a redirect to an HTTP/2 endpoint, the upload_chunky flag is not properly reset. As a result, the Transfer-Encoding: chunked header is sent in the subsequent request even when HTTP/2 is negotiated/used.
This violates RFC 9113 (HTTP/2) which states that HTTP/2 uses its own farming and Transfer-Encoding header must not be used.
##Proof OF Concept
Setup:
Local test server with HTTP/1.1 ---> HTTPS (HTTP/2) redirect
Reproduction Command:
curl -vvv --http1.1 --no-alpn -L --http2 -k \
-H "Transfer-Encoding: chunked" \
-H "Content-Type: text/plain" \
-d "This is chunked encoding bug test data" \
http://test.local:8080/
##Observed Behavior:
- First request (HTTP/1.1):
Transfer-Encoding: chunked--> Correct - Second request (after redirect): 'Transfer-Encoding: chunked' is still present ---> Vulnerable Even with
--http2flag, the header is not suppressed.
##Root Cause in 'lib/http.c'
http_req_set_TE()and 'http_add_content_hds()' functions only check HTTP version at intial request setup.- During redirect handling ('Curl_follow_Location()' / new Request setup), the 'data->req.upload_chunky' falg is not relible reset when protocol changes from HTTP/1.1 ---> HTTP/2.
Impact
- Protocol confusion between client and server / proxies.
- potential for
HTTP Request Smuggling / Desync attackin enviroments with reverse proxies or CDNs that handle HTTP/1.1 <--> HTTP/2 translation. - Unexpected behavior in middleboxes and caching systems.
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 the upload_chunky flag is not reset when a redirect changes the protocol from HTTP/1.1 to HTTP/2, so the header-setting functions still add Transfer-Encoding: chunked.
Impact
This could cause protocol confusion and potentially enable HTTP request smuggling or desync attacks in environments with reverse proxies or CDNs that translate between HTTP/1.1 and HTTP/2.
What the attacker needed
A redirect from HTTP/1.1 to an HTTP/2 endpoint; a proxy or CDN translating between HTTP/1.1 and HTTP/2
How it was found
- Start a local test server that redirects from HTTP/1.1 to an HTTPS HTTP/2 endpoint.
- Run curl in HTTP/1.1 mode with a chunked request body and follow redirects, forcing HTTP/2 on the second hop.
- Observe that the first HTTP/1.1 request correctly carries Transfer-Encoding: chunked.
- Observe that the redirected HTTP/2 request still carries Transfer-Encoding: chunked.
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/1.1 lets a client send a body in pieces using a header called Transfer-Encoding: chunked. HTTP/2 has its own way of framing data and forbids that header. curl, a command-line tool for making web requests, was supposed to drop the header after a redirect switched the connection to HTTP/2, but it kept it, which can confuse servers and proxies sitting in between.
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.