CVE Database›Document archive›CVE-2021-22876

CVE-2021-22876

curl: Leak of authentication credentials in URL via automatic Referer

Loading…

Severity

Moderate

Red Hat Product Security

3.7

CVSS 3.1

Review impact separately from score.

Published · March 31, 2021

Updated · September 21, 2026

Description

It was discovered that libcurl did not remove authentication credentials from URLs when automatically populating the Referer HTTP request header while handling HTTP redirects. This could lead to exposure of the credentials to the server to which requests were redirected.

CVSS score applicability

The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.

Mitigation

This issue can be avoided by using at least one of the following recommendations:

  • Do not enable automatic generation of Referer headers when redirects are followed. This functionality is not enabled by default. In the curl command line tool, it is enabled using the -e ';auto' or --referer ';auto' command line options. In the libcurl library, it is enabled using the CURLOPT_AUTOREFERER option.

  • Do not include authentication credentials in URLs (in the form of https://username:[email protected]), use other methods to provide authentication credentials to curl / libcurl. For the curl command line tool, use -u or --user command line option. For the libcurl library, use CURLOPT_USERPWD or CURLOPT_USERNAME / CURLOPT_PASSWORD options.

CVSS / CWE

CVSS 3.1 · 3.7
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N

CWE-200 · Exposure of Sensitive Information to an Unauthorized Actor