CVE-2022-0235: Node fetch Node-fetch Forwards Secure Headers To Vulnerability

HIGH
Advisory Identifier: GHSA-r683-j2x4-v87g
CVSS 8.8
CWE-173 CWE-601 CWE-200
Published
Advisory Summary

CVE-2022-0235 is a HIGH (CVSS 8.8) node-fetch forwards secure headers to vulnerability (CWE-173: Improper Handling of Alternate Encoding) affecting Node fetch libraries in the npm ecosystem. The issue involves node-fetch forwards secure headers to untrusted sites. Remediation is available by upgrading affected packages to version 3.1.1, 2.6.7.

CVE-2022-0235 at a Glance

CVE Identifier CVE-2022-0235
GHSA Identifier GHSA-r683-j2x4-v87g
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-173: Improper Handling of Alternate Encoding
Affected Product Node fetch
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-0235

To remediate this vulnerability, upgrade all affected Node fetch dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

node-fetch fixed: 3.1.1
npm install node-fetch@3.1.1
node-fetch fixed: 2.6.7
npm install node-fetch@2.6.7
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls node-fetch

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2022-0235, inspect your project dependencies using npm:

npm ls node-fetch

Analyze the terminal output to locate any version of Node fetch in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.1.1), your application is affected.

Note: The npm ls node-fetch command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-173: Improper Handling of Alternate Encoding, where the product does not properly handle when an input uses an alternate encoding that is valid for the control sphere to which the input is being sent. In Node fetch, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

node-fetch forwards secure headers such as `authorization`, `www-authenticate`, `cookie`, & `cookie2` when redirecting to a untrusted site.

CVE-2022-0235 Affected Node fetch Versions

2 component(s)
Fixed Versions:
3.1.12.6.7
Product / Package Ecosystem Affected Versions Fixed Version
node-fetch
npm
≥ 3.0.0
< 3.1.1
3.1.1
node-fetch
npm
< 2.6.7
2.6.7

References

Frequently Asked Questions

What is CVE-2022-0235?
CVE-2022-0235 is a security vulnerability in Node fetch involving node-fetch forwards secure headers to untrusted sites under CWE-173: Improper Handling of Alternate Encoding.
Which Node fetch versions are affected?
Affected versions include releases prior to 3.1.1, 2.6.7 across affected packages: node-fetch.
What version fixes CVE-2022-0235?
Upgrading to 3.1.1, 2.6.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is node-fetch affected?
Yes, node-fetch is affected in releases prior to 3.1.1, 2.6.7. Upgrade your dependency to 3.1.1, 2.6.7 or later.
What is the CVSS score of CVE-2022-0235?
CVE-2022-0235 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-0235?
CVE-2022-0235 is classified under CWE-173: Improper Handling of Alternate Encoding (The product does not properly handle when an input uses an alternate encoding that is valid for the control sphere to which the input is being sent.).
How can I check npm dependencies for CVE-2022-0235?
Run the dependency tree command: 'npm ls node-fetch'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-r683-j2x4-v87g",
  "modified" : "2023-09-07T18:38:41Z",
  "published" : "2022-01-21T23:55:52Z",
  "aliases" : [ "CVE-2022-0235" ],
  "summary" : "node-fetch forwards secure headers to untrusted sites",
  "details" : "node-fetch forwards secure headers such as `authorization`, `www-authenticate`, `cookie`, & `cookie2` when redirecting to a untrusted site.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "node-fetch"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.1.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "node-fetch"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.6.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-0235"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/node-fetch/node-fetch/pull/1449/commits/5c32f002fdd65b1c6a8f1e3620210813d45c7e60"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/node-fetch/node-fetch/pull/1453"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/node-fetch/node-fetch/commit/1ef4b560a17e644a02a3bfdea7631ffeee578b35"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/node-fetch/node-fetch/commit/36e47e8a6406185921e4985dcbeff140d73eaa10"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/node-fetch/node-fetch/commit/5c32f002fdd65b1c6a8f1e3620210813d45c7e60"
  }, {
    "type" : "WEB",
    "url" : "https://cert-portal.siemens.com/productcert/pdf/ssa-637483.pdf"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/node-fetch/node-fetch"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.dev/bounties/d26ab655-38d6-48b3-be15-f9ad6b6ae6f7"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2022/12/msg00007.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-173", "CWE-200", "CWE-601" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-01-18T22:51:22Z",
    "nvd_published_at" : "2022-01-16T17:15:00Z"
  }
}