Path Traversal Vulnerability in Node.js Package: nodejs (CVE-2024-21891)

nodejs Updated 02 Oct 2025

Summary

20/02/2024
N/A
Yes i
High
7.9

UBUNTU-CVE-2024-21891: Node.js depends on multiple built-in utility functions to normalize paths provided to node:fs functions, which can be overwitten with user-defined implementations leading to filesystem permission model bypass through pat... Affects nodejs versions < 20.18.1+dfsg-1ubuntu2. Fixed in 20.18.1+dfsg-1ubuntu2. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Node.js is a popular open-source JavaScript runtime built on Chrome's V8 JavaScript engine, enabling developers to build scalable network applications. It allows for the execution of JavaScript code server-side and is widely used for web development. The package 'nodejs' includes various tools and libraries for building server-side applications. However, it has been identified that the experimental permission model in Node.js versions 20 and 21 is susceptible to a path traversal vulnerability, which can lead to unauthorized access to the filesystem.

Vulnerability Detail

The vulnerability arises from Node.js's reliance on built-in utility functions to normalize paths for file system operations. These functions can be overridden by user-defined implementations, allowing attackers to bypass the filesystem permission model through path traversal attacks. This issue affects users utilizing the experimental permission model in Node.js 20 and 21, potentially leading to severe consequences such as unauthorized file access and data exposure.

How To Fix

Minimum fixed version

20.18.1+dfsg-1ubuntu2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade nodejs

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, you can disable the experimental permission model in your Node.js application until the package is updated. This can be done by avoiding the use of any features that rely on this model, thus mitigating the risk of exploitation.

Conclusion

In summary, CVE-2024-21891 is a critical vulnerability in the Node.js package that can lead to serious security risks through path traversal attacks. It is essential for users to update to the patched version to protect their applications from potential exploitation.

See every vulnerability recorded for nodejs →

Share this vulnerability

FAQ

CVE-2024-21891 is a vulnerability in Node.js that allows for path traversal attacks due to the ability to override built-in path normalization functions.

The vulnerability affects Node.js versions 20 and 21 that utilize the experimental permission model.

The vulnerability can lead to unauthorized access to the filesystem, allowing attackers to read or modify sensitive files.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without any signup.

The CVSS score of this vulnerability is 7.9, indicating a high severity level.

Related vulnerabilities

Recent vulnerabilities recorded for nodejs.

How To Fix

Minimum fixed version

20.18.1+dfsg-1ubuntu2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade nodejs

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback