CVE-2024-12905 tar-fs Vulnerable to Link Following and Path Traversal via Extracting a Crafted tar File

High 7.5 Published Updated

Attackers can write or overwrite files outside the intended directory by crafting a malicious tar archive processed by the tar-fs library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2024-12905?

CVE-2024-12905 is a high-severity path traversal vulnerability in tar-fs, published on 27 Mar 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

An Improper Link Resolution Before File Access ("Link Following") and Improper Limitation of a Pathname to a Restricted Directory ("Path Traversal"). This vulnerability occurs when extracting a maliciously crafted tar file, which can result in unauthorized file writes or overwrites outside the intended extraction directory. The issue is associated with index.js in the tar-fs package.

This issue affects tar-fs: from 0.0.0 before 1.16.4, from 2.0.0 before 2.1.2, from 3.0.0 before 3.0.8.

Weakness: CWE-59, CWE-22

Which versions are affected by CVE-2024-12905?

6 open source packages ship an affected version, including tar-fs.

PackageAffectedFixed in
tar-fs npmAll versions1.16.4
tar-fs npmAll versions1.16.4
tar-fs npmFrom 2.0.02.1.2
tar-fs npmFrom 2.0.02.1.2
tar-fs npmFrom 3.0.03.0.7
tar-fs npmFrom 3.0.03.0.7

How do I fix CVE-2024-12905?

Upgrade tar-fs to a fixed version for your release line: 1.16.4, 2.1.2 or 3.0.7.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2024-12905 being exploited?

There is no known exploitation of CVE-2024-12905 in the wild and no public exploit code.

Public exploit code: 1 Exploit-DB entry and 1 proofs of concept on GitHub.

Sources

Also known as AZL-59367, DEBIAN-CVE-2024-12905, ECHO-01fc-195c-4504, GHSA-pq67-2wwv-3xjx, MINI-mgrc-433g-jf2q, MINI-vr9x-j54j-rvwp and 2 more.

Is CVE-2024-12905 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free