Credential leak when use two url
When curl is given two URLs and a username and password on the command line, it sends the same Basic authentication header to both hosts. An attacker who controls or observes the second host could therefore receive credentials meant only for the first.
- Disclosed after 44 days
Summary:
Curl can leak user credentials if use two url.
Steps To Reproduce:
- curl -I -v -u aaa:bbb hackerone.com curl.se
- the output is:
Connected to hackerone.com (104.16.100.52) port 80 (#0)
Server auth using Basic with user 'aaa'
HEAD / HTTP/1.1
Host: hackerone.com
Authorization: Basic YWFhOmJiYg==
User-Agent: curl/7.83.1
Accept: /
Connection #0 to host hackerone.com left intact
Trying 151.101.65.91:80...
Connected to curl.se (151.101.65.91) port 80 (#1)
Server auth using Basic with user 'aaa'
HEAD / HTTP/1.1
Host: curl.se
Authorization: Basic YWFhOmJiYg==
User-Agent: curl/7.83.1
Accept: /
- from the output we can see, the second url get the same credentials
Impact
Leak of confidential information (user credential)
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 applies command-line credentials to every URL in the request rather than scoping them to the host they were intended for.
Impact
User credentials intended for one host could be disclosed to a second host, leaking confidential information.
What the attacker needed
Curl invoked with two URLs; credentials passed on the command line
How it was found
- Run curl with verbose output, a username and password, and two different URLs.
- Observe the request headers sent to the first host.
- Observe the request headers sent to the second host and note the same credentials appear.
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.
Basic authentication is a simple way for a program to prove who it is by sending a username and password in a header with every request. Here, curl was told to fetch two different websites in one command, and it reused the same login details for the second site even though they were only meant for the first. That means the second site's owner learns the password.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.