# CVE-2020-15168: File size limit bypass in node-fetch

> Attackers can bypass file size limits in node-fetch redirects, causing resource exhaustion and denial of service in applications relying on this check.

- **Severity:** Low 2.6 (`CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:N/I:N/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 10 Sep 2020
- **Updated:** 4 Aug 2024
- **Also known as:** DEBIAN-CVE-2020-15168, GHSA-w7rc-rwvf-8q5r, UBUNTU-CVE-2020-15168

## What is CVE-2020-15168?

CVE-2020-15168 is a low-severity denial of service vulnerability in node-fetch, published on 10 Sep 2020. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official description

node-fetch before versions 2.6.1 and 3.0.0-beta.9 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. For 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.

Weakness: CWE-770 (Allocation of Resources Without Limits or Throttling), CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2020-15168?

4 open source packages ship an affected version, including node-fetch. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `node-fetch` | npm | From 2.0.0 | 2.6.1 |
| `node-fetch` | npm | From 2.0.0 | 2.6.1 |
| `node-fetch` | npm | From 3.0.0-beta.1 | 3.0.0-beta.9 |
| `node-fetch` | npm | From 3.0.0-beta.1 | 3.0.0-beta.9 |

Products: Node-Fetch Project Node-Fetch.

## How do I fix CVE-2020-15168?

Upgrade node-fetch to a fixed version for your release line: 2.6.1 or 3.0.0-beta.9.

## Is CVE-2020-15168 being exploited?

There is no known exploitation of CVE-2020-15168 in the wild and no public exploit code.

## Other vulnerabilities in node-fetch

- [CVE-2022-2596](https://insights.sbomify.com/CVE-2022-2596/): Inefficient Regular Expression Complexity in node-fetch/node-fetch (medium 5.9)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2020-15168 and fix it if it is affected.

What it is: CVE-2020-15168 is a low-severity denial of service vulnerability in node-fetch, published on 10 Sep 2020. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2020-15168 in the wild and no public exploit code.

Affected packages and fixed versions:
- node-fetch (npm): affected from 2.0.0; fixed in 2.6.1
- node-fetch (npm): affected from 2.0.0; fixed in 2.6.1
- node-fetch (npm): affected from 3.0.0-beta.1; fixed in 3.0.0-beta.9
- node-fetch (npm): affected from 3.0.0-beta.1; fixed in 3.0.0-beta.9

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2020-15168/ (Markdown: https://insights.sbomify.com/CVE-2020-15168/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2020-15168
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2020-15168
- OSV: https://osv.dev/vulnerability/CVE-2020-15168

---
From sbomify Insights: https://insights.sbomify.com/CVE-2020-15168/
Summaries are generated and may contain mistakes; the official description above is the record.
