CVE-2025-48387: tar-fs Package Vulnerability Allowing Extraction Outside Specified Directory

tar-fs Updated 14 Dec 2025

Summary

03/06/2025
Yes i
High
8.7

CVE-2025-48387: tar-fs can extract outside the specified dir with a specific tarball. Affects tar-fs across 3 version ranges.

< 1.16.5 >= 2.0.0, < 2.1.3 >= 3.0.0, < 3.0.9

Fixed in 1.16.5, 2.1.3 or 3.0.9, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2025-48387 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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

The tar-fs package is a Node.js library that provides a way to create and extract tar archives. It is commonly used in applications that require file compression and decompression. However, certain versions of tar-fs are vulnerable to a security issue that allows attackers to extract files outside the intended directory, potentially leading to unauthorized access to sensitive files.

Vulnerability Detail

The vulnerability in tar-fs arises from improper handling of tarball extraction paths, specifically in versions v3.0.8, v2.1.2, and v1.16.4 and below. This flaw allows attackers to craft a malicious tarball that, when extracted, can place files in unintended locations on the filesystem. The potential ramifications include unauthorized file access and system compromise, making it critical for users of affected versions to address this issue promptly.

How To Fix

Latest published version: 3.1.3 as of 23 Oct 2026

npm install tar-fs@3.1.3

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 1.16.5 1.16.5
    npm install tar-fs@1.16.5
  • >= 2.0.0, < 2.1.3 2.1.3
    npm install tar-fs@2.1.3
  • >= 3.0.0, < 3.0.9 3.0.9
    npm install tar-fs@3.0.9

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a temporary workaround, you can implement an ignore option in your extraction code to prevent the extraction of symlinks and other non-file types. Here is an example of how to do this:

ignore (_, header) {
  // pass files & directories, ignore e.g. symlinks
  return header.type !== 'file' && header.type !== 'directory';
}

Conclusion

The tar-fs package has a significant vulnerability that allows for extraction outside of the specified directory, which can lead to serious security risks. Users are strongly advised to update to the latest patched versions or implement the provided workaround to mitigate the issue. Regular monitoring of dependencies using tools like Vulert can help maintain security in your applications.

See every vulnerability recorded for tar-fs →

Share this vulnerability

FAQ

Versions v3.0.8, v2.1.2, and v1.16.4 and below 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.

The risks include unauthorized access to sensitive files and potential system compromise due to files being extracted to unintended locations.

You can update the tar-fs package by running the command 'npm install tar-fs@<version>' in your project directory, replacing <version> with 3.0.9, 2.1.3, or 1.16.5, depending on your current version.

Vulert is a tool that monitors and alerts in real-time for open-source vulnerabilities in your software using just package-lock.json. It helps you stay informed about potential security issues.

Related vulnerabilities

Recent vulnerabilities recorded for tar-fs.

How To Fix

Latest published version: 3.1.3 as of 23 Oct 2026

npm install tar-fs@3.1.3

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 1.16.5 1.16.5
    npm install tar-fs@1.16.5
  • >= 2.0.0, < 2.1.3 2.1.3
    npm install tar-fs@2.1.3
  • >= 3.0.0, < 3.0.9 3.0.9
    npm install tar-fs@3.0.9

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. 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