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

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

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 27 Mar 2025
- **Updated:** 3 Nov 2025
- **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, ROOT-APP-NPM-CVE-2024-12905, UBUNTU-CVE-2024-12905

## 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 (Improper Link Resolution Before File Access), CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

## Which versions are affected by CVE-2024-12905?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `tar-fs` | npm | All versions | 1.16.4 |
| `tar-fs` | npm | All versions | 1.16.4 |
| `tar-fs` | npm | From 2.0.0 | 2.1.2 |
| `tar-fs` | npm | From 2.0.0 | 2.1.2 |
| `tar-fs` | npm | From 3.0.0 | 3.0.7 |
| `tar-fs` | npm | From 3.0.0 | 3.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.

## 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:

- tar-fs file write/overwrite vulnerability (github_poc): https://github.com/theMcSam/CVE-2024-12905-PoC
- tar-fs 3.0.0 - Arbitrary File Write/Overwrite (exploitdb)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-12905 and fix it if it is affected.

What it is: 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.
Exploitation: There is no known exploitation of CVE-2024-12905 in the wild and no public exploit code.

Affected packages and fixed versions:
- tar-fs (npm): affected all versions; fixed in 1.16.4
- tar-fs (npm): affected all versions; fixed in 1.16.4
- tar-fs (npm): affected from 2.0.0; fixed in 2.1.2
- tar-fs (npm): affected from 2.0.0; fixed in 2.1.2
- tar-fs (npm): affected from 3.0.0; fixed in 3.0.7
- tar-fs (npm): affected from 3.0.0; fixed in 3.0.7

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-12905/ (Markdown: https://insights.sbomify.com/CVE-2024-12905/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-12905
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-12905
- OSV: https://osv.dev/vulnerability/CVE-2024-12905

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-12905/
Summaries are generated and may contain mistakes; the official description above is the record.
