Prototype Pollution Vulnerability in Cached Path Relative Package

node-cached-path-relative Updated 02 Oct 2025

Summary

21/01/2022
N/A
Yes i
Critical
9.8

CVE-2021-23518: The package cached-path-relative before 1.1.0 are vulnerable to Prototype Pollution via the cache variable that is set as {} instead of Object.create(null) in the cachedPathRelative function, which allows access to the p... Affects node-cached-path-relative across 2 version ranges.

< 1.0.2-1+deb11u1 < 40c73bf70c58add5aec7d11e4f36b93d144bb760

Fixed in 1.0.2-1+deb11u1. 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The 'cached-path-relative' package is a utility for resolving relative paths in a caching mechanism, commonly used in Node.js applications. It allows developers to efficiently manage file paths, enhancing performance and reducing overhead. However, prior to version 1.1.0, this package is susceptible to a prototype pollution vulnerability, which can lead to unauthorized access to object properties.

Vulnerability Detail

The vulnerability arises from the improper initialization of the cache variable in the 'cachedPathRelative' function. Instead of using 'Object.create(null)', the cache is initialized as an empty object '{}'. This allows an attacker to manipulate the prototype of the cache object, enabling access to parent prototype properties. If an attacker uses 'proto' as the origin path, they can access and modify attributes of the object instead of the intended path, potentially leading to severe security implications such as data leakage or application compromise.

How To Fix

Minimum fixed version

1.0.2-1+deb11u1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-cached-path-relative

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

Workaround

If immediate upgrading is not feasible, a temporary workaround is to avoid using the 'cached-path-relative' package until the vulnerability is patched. Additionally, you can implement input validation to sanitize paths and prevent the use of 'proto' or other prototype manipulation techniques.

Conclusion

The 'cached-path-relative' package has a critical vulnerability that allows for prototype pollution, potentially leading to severe security risks. It is essential to upgrade to the latest version to mitigate these risks. Utilizing tools like Vulert can help in monitoring and identifying vulnerabilities in your applications.

See every vulnerability recorded for node-cached-path-relative →

Share this vulnerability

FAQ

Prototype pollution is a security vulnerability that allows an attacker to modify the prototype of a base object, potentially leading to unauthorized access to properties and methods of all objects that inherit from that prototype.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. Simply upload your manifest file like package-lock.json to check for vulnerabilities.

Exploiting this vulnerability can lead to unauthorized access to sensitive data, manipulation of application behavior, and potential full compromise of the application.

Yes, you can implement input validation to sanitize paths and avoid using the 'cached-path-relative' package until it is updated.

The CVSS score for this vulnerability is 9.8, indicating a critical level of severity.

Related vulnerabilities

Recent vulnerabilities recorded for node-cached-path-relative.

How To Fix

Minimum fixed version

1.0.2-1+deb11u1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-cached-path-relative

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