Path Traversal Vulnerability in Node.js Package - CVE-2024-21896

nodejs Updated 02 Oct 2025

Summary

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

UBUNTU-CVE-2024-21896: The permission model protects itself against path traversal attacks by calling path.resolve() on any paths given by the user. Affects nodejs versions 20.16.0+dfsg-1ubuntu1 – 20.18.1+dfsg-1ubuntu2. No fix is published. 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 Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Node.js is a popular open-source runtime environment that allows developers to execute JavaScript code server-side. It is widely used for building scalable network applications. The affected package, nodejs version 20.18.1+dfsg-1ubuntu2, includes an experimental permission model designed to enhance security. However, this model is susceptible to a path traversal vulnerability, which can be exploited if not addressed.

Vulnerability Detail

The vulnerability arises from the permission model's reliance on path.resolve() to protect against path traversal attacks. If a user-supplied path is treated as a Buffer, the implementation uses Buffer.from() to create a Buffer from the resolved path. By monkey-patching Buffer internals, specifically Buffer.prototype.utf8Write, an attacker can manipulate the output of path.resolve(), leading to unauthorized access to files outside the intended directory. This vulnerability affects all users utilizing the experimental permission model in Node.js 20 and 21, potentially allowing attackers to read sensitive files.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, avoid using the experimental permission model in Node.js until the vulnerability is patched. Additionally, ensure that user-supplied paths are validated and sanitized before processing.

Conclusion

The CVE-2024-21896 vulnerability in the Node.js package presents a significant risk due to its potential for path traversal attacks. Users are advised to update their packages promptly and consider workarounds until a full resolution is implemented. Regular monitoring for vulnerabilities using tools like Vulert can help maintain application security.

See every vulnerability recorded for nodejs →

Share this vulnerability

FAQ

CVE-2024-21896 is a path traversal vulnerability in the Node.js package that affects versions 20 and 21, allowing attackers to manipulate file paths.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

The vulnerability can lead to unauthorized access to sensitive files on the server, posing significant security risks.

Yes, a patched version of the nodejs package is available. Updating to the latest version will resolve the issue.

If immediate updates are not possible, consider disabling the experimental permission model and validating user inputs to mitigate risks.

Related vulnerabilities

Recent vulnerabilities recorded for nodejs.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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