CVE-2021-22923: Metalink download sends credentials
When curl is built with libmetalink support and used with the --metalink and --user options, it sends the provided credentials to every host and protocol referenced in the metalink file, including plain HTTP and FTP. An attacker in a man-in-the-middle position or the operator of any referenced host could capture the credentials.
- Triaged in 12 days
- Fixed in 52 days
- Paid in 31 days
- Disclosed after 52 days
Summary:
When compiled --with-libmetalink and used with --metalink and --user curl will use the credentials for any further transfers performed. This includes different hosts and protocols, even ones without transport layer security such as http and ftp. As a result the credentials only intended for the target site may end up being sent to outside hosts, and without transport layer security, and may be intercepted by attackers in man in the middle network position.
For example HTTP redirects will not leak the credentials to other hosts unless if --location-trusted is used, thus this is unexpected and insecure behaviour.
Steps To Reproduce:
- Configure libcurl
--with-libmetalinkand build libcurl - Have metalinktest.xml with
<url>referencing data on different host than testsite and usinghttpprotocol - Execute:
curl --metalink --user professor:Joshua https://testsite/metalinktest.xml
The credentials can be seen by the target host and anyone in man in the middle position:
Authorization: Basic cHJvZmVzc29yOkpvc2h1YQ==
Remarks
CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor) might be a more accurate CWE.
Fix
- Perhaps
--location-trustedshould be extended to apply to--metalinkas well
Impact
Leak of credentials to unauthorized parties§
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
Impact
Credentials intended for one site could be sent to unauthorised hosts and, over plain HTTP or FTP, intercepted by a man-in-the-middle attacker.
What the attacker needed
Curl built with libmetalink; user runs curl with --metalink and --user; metalink file references another host
The fix
The report suggests extending the --location-trusted option to also govern --metalink, so credentials are only forwarded when explicitly allowed.
How it was found
- Build libcurl with libmetalink support enabled.
- Create a metalink file whose url entry points to a different host over plain HTTP.
- Run curl with the metalink and user options against that file.
- Observe the Authorization header sent to the other 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.
curl is a command-line tool for downloading files. A metalink file is a list of alternative download locations. If you give curl a username and password for one site, it should only send them there. Here, curl also sent them to other sites listed in the metalink file, even over unencrypted connections, so anyone watching the network could read them.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.