Critical Directory Traversal Vulnerability in node-tar-fs Package
Summary
CVE-2025-48387: tar-fs provides filesystem bindings for tar-stream. Affects node-tar-fs across 2 version ranges.
< 2.1.3-0+deb11u1
< 647447b572bc135c41035e82ca7b894f02b17f0f
Fixed in 2.1.3-0+deb11u1. How to fix ↓
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.
No signup required · Results in about 60 seconds
Background
The node-tar-fs package provides filesystem bindings for the tar-stream module, allowing users to extract tar files directly to the filesystem. It is commonly used in Node.js applications for handling tar archives. However, certain versions of this package are vulnerable to a directory traversal issue that can lead to unauthorized file writes outside the intended directory.
Vulnerability Detail
The vulnerability identified as CVE-2025-48387 affects versions of node-tar-fs prior to 3.0.9, 2.1.3, and 1.16.5. It allows an attacker to craft a malicious tarball that, when extracted, can write files outside the specified extraction directory. This can lead to data corruption, unauthorized access to sensitive files, and potential system compromise. The issue arises from improper validation of file paths during the extraction process.
How To Fix
Minimum fixed version
2.1.3-0+deb11u1
This is the first release that contains the fix.
sudo apt-get install --only-upgrade node-tar-fs
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, you can use the ignore option to ignore non-file or non-directory entries during extraction. This can be implemented in your extraction code as follows:
const tar = require('tar-fs');
tar.extract('destination-directory', { ignore: (name) => { return !isFileOrDirectory(name);
} });
Conclusion
The CVE-2025-48387 vulnerability in the node-tar-fs package poses significant risks due to its directory traversal nature. Users are strongly advised to update to the patched versions or implement the provided workaround to safeguard their applications.
See every vulnerability recorded for node-tar-fs →
FAQ
CVE-2025-48387 is a critical vulnerability in the node-tar-fs package that allows for directory traversal, enabling malicious tarballs to write files outside the intended directory.
Versions prior to 3.0.9, 2.1.3, and 1.16.5 of the node-tar-fs package are affected by this vulnerability.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
If immediate updates are not possible, implement the provided workaround using the ignore option to mitigate the risk of exploitation.
Exploitation of this vulnerability can lead to unauthorized file access, data corruption, and potential system compromise, making it critical to address.
Related vulnerabilities
Recent vulnerabilities recorded for node-tar-fs.