# CVE-2024-22020: Code injection in Node

> Attackers can bypass network import restrictions in Node.js by embedding non-network imports in data URLs, leading to arbitrary code execution.

- **Severity:** Medium 6.5 (`CVSS:3.0/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 9 Jul 2024
- **Updated:** 30 Apr 2025
- **Also known as:** ALPINE-CVE-2024-22020, AZL-43195, AZL-43216, BELL-CVE-2024-22020, BIT-node-2024-22020, BIT-node-min-2024-22020, CLEANSTART-2026-ER77659, CLEANSTART-2026-RM98844, CLSA-2025-1756932817, CLSA-2026-1771494125, DEBIAN-CVE-2024-22020, GHSA-ch4x-f5c4-36gv, UBUNTU-CVE-2024-22020

## What is CVE-2024-22020?

CVE-2024-22020 is a medium-severity code injection vulnerability in NodeJS Node, published on 9 Jul 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

A security flaw in Node.js  allows a bypass of network import restrictions.
By embedding non-network imports in data URLs, an attacker can execute arbitrary code, compromising system security.
Verified on various platforms, the vulnerability is mitigated by forbidding data URLs in network imports.
Exploiting this flaw can violate network import security, posing a risk to developers and servers.

Weakness: CWE-94 (Improper Control of Generation of Code)

## Which versions are affected by CVE-2024-22020?

2 open source packages ship an affected version, including node and node-min.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `node` | Bitnami | All versions | 18.20.4, 20.15.1, 22.4.1 |
| `node-min` | Bitnami | All versions | 18.20.5, 20.18.1, 22.12.0 |

## How do I fix CVE-2024-22020?

Upgrade node to a fixed version for your release line: 18.20.4, 20.15.1 or 22.4.1.

## Is CVE-2024-22020 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-22020 and fix it if it is affected.

What it is: CVE-2024-22020 is a medium-severity code injection vulnerability in NodeJS Node, published on 9 Jul 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2024-22020 in the wild and no public exploit code.

Affected packages and fixed versions:
- node (Bitnami): affected all versions; fixed in 18.20.4, 20.15.1, 22.4.1
- node-min (Bitnami): affected all versions; fixed in 18.20.5, 20.18.1, 22.12.0

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-2024-22020/ (Markdown: https://insights.sbomify.com/CVE-2024-22020/index.md)
```

## Sources

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

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