Exposure of Sensitive Information to an Unauthorized Actor in node-fetch/node-fetch

Valid

Reported on

Feb 12th 2022


Description

The Authorization header leaks from same hostname https-http redirect. If https://example.com redirects to http://example.com, then an attacker who can listen in on the wire (or perform a MITM attack) will be able to receive the Authorization header due to the use of the insecure HTTP protocol which does not verify the host the request is sending to. The attacker does NOT need to control example.com, they only need to able simply listen in on the wire (ability to perform MITM attack). A similar issue for PSF's (Python Software Foundation) requests module was filed in CVE-2018-18074

Vulnerable Code

In https://github.com/node-fetch/node-fetch/blob/81b1378bb3bda555d3d2114e7d3dfddbd91f210c/src/index.js#L204L208, it uses a isDomainOrSubdomain check to determine whether to send the confidential headers on redirect, but it does not validate that the scheme remains the same

Impact

If the attacker can intercept the HTTP request (perform MiTM attack) and https://example.com redirects to http://example.com, they may be able to leak the Authorization header during a same hostname/subdomain HTTPS-HTTP redirection. They do NOT need to control the hostname. There are 2 scenarios where this may occur:

1: A mistake occurs where the Authorization header is sent from HTTPS to HTTP (by a developer incorrectly specifying the HTTP protocol in the Location header) [for same hostname / subdomain-main domain redirection]

2: The malicious user controls the redirection target and sits in the middle of the network. If there are checks in place which allow one to control the redirection target (such as the hostname). Then this can open up a new possibility for the attacker to bypass the hostname check to send the credentials by the wire and sniff it, provided they exist in the same network.

Recommended Fix:

Check scheme of original URL and redirected URL for HTTPS-HTTP redirection and prevent it.

We are processing your report and will contact the node-fetch team within 24 hours. a year ago
haxatron modified the report
a year ago
haxatron modified the report
a year ago
haxatron modified the report
a year ago
haxatron modified the report
a year ago
haxatron modified the report
a year ago
haxatron modified the report
a year ago
We have contacted a member of the node-fetch team and are waiting to hear back a year ago
We have sent a follow up to the node-fetch team. We will try again in 7 days. a year ago
node-fetch/node-fetch maintainer validated this vulnerability a year ago
haxatron has been awarded the disclosure bounty
The fix bounty is now up for grabs
Jimmy Wärting marked this as fixed in 2.6.7 with commit 1ef4b5 a year ago
Jimmy Wärting has been awarded the fix bounty
This vulnerability will not receive a CVE
haxatron
a year ago

Researcher


Hi @maintainer commit 1ef4b5 does not fix this

Jamie Slome
a year ago

Admin


@haxatron - can you share which commit fixes this?

haxatron
a year ago

Researcher


@maintainer, a note here that this issue is different from https://nvd.nist.gov/vuln/detail/CVE-2022-0235, this issue talks about sensitive header leakage from HTTPS domain / subdomain to same HTTP domain / subdomain, whereby an attacker is able to gather the sensitive headers if they can listen in on the wire (perform MiTM)

haxatron
a year ago

Researcher


Jamie Slome
a year ago

Admin


I have paused the automatic publishing of the CVE until was have this rectified as well.

Max Gerber
10 months ago

@hexatron can we confirm whether this commit fixes the vuln?

to join this conversation