CVE-2020-15168: Node fetch The `size` Option Isn't Honored Vulnerability
LOWCVE-2020-15168 is a LOW (CVSS 2.6) the `size` option isn't honored vulnerability (CWE-20: Improper Input Validation) affecting Node fetch libraries in the npm ecosystem. The issue involves the `size` option isn't honored after following a redirect in node-fetch. Remediation is available by upgrading affected packages to version 2.6.1, 3.0.0-beta.9.
CVE-2020-15168 at a Glance
Security Impact
CVSS: 2.6
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:N/I:N/A:L).
How to Fix CVE-2020-15168
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.
npm install node-fetch@2.6.1
npm install node-fetch@3.0.0-beta.9
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-2020-15168, 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 2.6.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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. 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
CVE-2020-15168 Affected Node fetch Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
node-fetch
|
npm |
≥ 2.0.0
< 2.6.1
|
2.6.1
|
|
node-fetch
|
npm |
≥ 3.0.0-beta.1
< 3.0.0-beta.9
|
3.0.0-beta.9
|
References
Frequently Asked Questions
What is CVE-2020-15168?
Which Node fetch versions are affected?
What version fixes CVE-2020-15168?
Is node-fetch affected?
What is the CVSS score of CVE-2020-15168?
What CWE is associated with CVE-2020-15168?
How can I check npm dependencies for CVE-2020-15168?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-w7rc-rwvf-8q5r",
"modified" : "2024-07-15T19:46:22Z",
"published" : "2020-09-10T17:46:21Z",
"aliases" : [ "CVE-2020-15168" ],
"summary" : "The `size` option isn't honored after following a redirect in node-fetch",
"details" : "### Impact\nNode Fetch did not honor the `size` option after following a redirect, which means that when a content size was over the limit, a `FetchError` would never get thrown and the process would end without failure.\n\nFor most people, this fix will have a little or no impact. However, if you are relying on node-fetch to gate files above a size, the impact could be significant, for example: If you don't double-check the size of the data after `fetch()` has completed, your JS thread could get tied up doing work on a large file (DoS) and/or cost you money in computing.\n\n### Patches\nWe released patched versions for both stable and beta channels:\n\n- For `v2`: 2.6.1\n- For `v3`: 3.0.0-beta.9\n\n### Workarounds\nNone, it is strongly recommended to update as soon as possible.\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [node-fetch](https://github.com/node-fetch/node-fetch/issues/new?assignees=&labels=question&template=support-or-usage.md&title=Question%3A+)\n* Contact one of the core maintainers.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "node-fetch"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0"
}, {
"fixed" : "2.6.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "node-fetch"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0-beta.1"
}, {
"fixed" : "3.0.0-beta.9"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.0.0-beta.8"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/node-fetch/node-fetch/security/advisories/GHSA-w7rc-rwvf-8q5r"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-15168"
}, {
"type" : "WEB",
"url" : "https://github.com/node-fetch/node-fetch/commit/2358a6c2563d1730a0cdaccc197c611949f6a334"
}, {
"type" : "WEB",
"url" : "https://github.com/node-fetch/node-fetch/commit/eaff0094c4dfdd5b78711a8c4f1b61e33d282072"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/node-fetch/node-fetch"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20", "CWE-770" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2020-09-10T17:44:09Z",
"nvd_published_at" : null
}
}