CVE-2020-15168: Node-fetch size option not honored after redirect
Summary
CVE-2020-15168: The size option isn't honored after following a redirect in node-fetch. Affects node-fetch across 2 version ranges.
>= 2.0.0, < 2.6.1
>= 3.0.0-beta.1, < 3.0.0-beta.9
Fixed in 2.6.1 or 3.0.0-beta.9, depending on the release line you run. How to fix ↓
Also tracked for
- node-fetch · Debian:11
The same CVE-2020-15168 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Node-fetch is an npm package that provides a lightweight implementation of the Fetch API for Node.js. It allows developers to make HTTP requests and handle responses in a convenient manner. However, a vulnerability has been discovered in node-fetch versions 0 to 2.6.0 and 3.0.0-beta.1 to 3.0.0-beta.8. This vulnerability relates to the size option not being honored after following a redirect.
Vulnerability Detail
The vulnerability in node-fetch occurs when the size option is used to limit the content size of a response. Prior to the fix, if a redirect occurred and the content size exceeded the specified limit, a FetchError would not be thrown. This means that the process would continue without failure, potentially leading to resource exhaustion or unexpected costs. While the impact of this vulnerability may be minimal for most users, those relying on node-fetch to gate files based on size could be significantly affected.
How To Fix
Latest published version: 3.3.2 as of 22 Oct 2026
npm install node-fetch@3.3.2
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
>= 2.0.0, < 2.6.12.6.1npm install node-fetch@2.6.1 -
>= 3.0.0-beta.1, < 3.0.0-beta.93.0.0-beta.9npm install node-fetch@3.0.0-beta.9
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
There are no known workarounds for this vulnerability. It is strongly advised to update to the patched versions as soon as possible.
Conclusion
In conclusion, the vulnerability in node-fetch related to the size option not being honored after a redirect can have significant impacts for those relying on file size gating. It is crucial to update to the patched versions (2.6.1 for v2 and 3.0.0-beta.9 for v3) to ensure the proper handling of content size limits. For further support on vulnerability remediation, you can reach out to DevNack.com.
See every vulnerability recorded for node-fetch →
FAQ
Node-fetch is an npm package that provides a lightweight implementation of the Fetch API for Node.js. It allows developers to make HTTP requests and handle responses in a convenient manner.
The impact of this vulnerability may be minimal for most users. However, for those relying on node-fetch to gate files based on size, the impact could be significant. It could lead to resource exhaustion, denial of service, or unexpected costs.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities without requiring access to the code or installation.
There are no known workarounds for this vulnerability. It is strongly advised to update to the patched versions of node-fetch.
For more information, you can open an issue in the node-fetch GitHub repository or contact one of the core maintainers.
References
Related vulnerabilities
Recent vulnerabilities recorded for node-fetch.