Proxy-Authorization header carried to a new host on a redirect
When curl follows a redirect with the -L flag, it carries the Proxy-Authorization header to the new host, leaking the proxy credentials. An attacker controlling a redirect could receive the secret.
- Disclosed after 42 days
hi cURL team
I am not entirely sure this is an issue, please feel free to close of it isn't.
I noticed that when making an HTTP GET request with Proxy-Authorization header, together with the "-L" flag to follow redirects
curl -H "Authorization-Proxy: Basic xxx==" http://host:8000 -L
If the remote web server redirects to an alternate host/port, cURL will carry over the Proxy-Authorization header to the redirected new host along with the secret.
If Authorization header is used (vs Proxy-Authentication) then the header gets stripped as it should.
Client sends GET request with Proxy-Authorization header to Server 1:8080 Server1 Redirects cURL to Server2:8081 Server2:8081 Receives the Proxy-Authorization header This was reproducible in the following version:
curl 7.64.1 (x86_64-apple-darwin20.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.41.0 Release-Date: 2019-03-27
I believe the expected behaviour is that Proxy-Authorization header should be stripped upon a server redirection, since its not within the same domain origin.
I also noticed a similar issue was opened 3 years ago regarding Authorization header: https://curl.se/docs/CVE-2018-1000007.html
Impact
If the password is sent via HTTPS, the server may redirect it to over unencrypted protocols if sent to an HTTP web server, making the Interception of the password possible.
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 did not strip the Proxy-Authorization header when following a redirect to a different host, unlike the regular Authorization header.
Impact
The proxy password could be intercepted if the redirect goes to an unencrypted HTTP server, as the text notes.
What the attacker needed
Curl with -L flag; Proxy-Authorization header set; server redirects to another host
How it was found
- Send a GET request with a Proxy-Authorization header and the -L flag to a server.
- The server responds with a redirect to a different host and port.
- curl follows the redirect and sends the Proxy-Authorization header to the new host.
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.
A proxy is a middle server that fetches web pages for you, and it can require a password sent in a special header. When a website tells curl to go to a different address, curl should drop that password header, but it kept it and sent it to the new address, which could be controlled by someone else.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.