# CVE-2024-12718: Bypass extraction filter to modify file metadata outside extraction directory

> Attackers can modify file metadata or permissions outside the extraction directory when using specific tarfile extraction filters.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/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:** 3 Jun 2025
- **Updated:** 31 Jul 2026
- **Also known as:** ALPINE-CVE-2024-12718, AZL-62258, BELL-CVE-2024-12718, BIT-libpython-2024-12718, BIT-python-2024-12718, BIT-python-min-2024-12718, CLEANSTART-2026-IG20308, DEBIAN-CVE-2024-12718, ECHO-83e1-a1f5-89ba, GHSA-2pg8-h2j6-28xm, MINI-6858-92ff-49v8, MINI-gmh8-x358-75xc, MINI-gvgf-hhg6-7pmh, MINI-vc96-27jr-q872, PSF-2025-5, UBUNTU-CVE-2024-12718

## What is CVE-2024-12718?

CVE-2024-12718 is a medium-severity path traversal vulnerability in CPython, published on 3 Jun 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Allows modifying some file metadata (e.g. last modified) with filter="data" or file permissions (chmod) with filter="tar" of files outside the extraction directory.
You are affected by this vulnerability if using the tarfile module to extract untrusted tar archives using TarFile.extractall() or TarFile.extract() using the filter= parameter with a value of "data" or "tar". See the tarfile  extraction filters documentation https://docs.python.org/3/library/tarfile.html#tarfile-extraction-filter  for more information. Only Python versions 3.12 or later are affected by these vulnerabilities, earlier versions don't include the extraction filter feature.

Note that for Python 3.14 or later the default value of filter= changed from "no filtering" to `"data", so if you are relying on this new default behavior then your usage is also affected.

Note that none of these vulnerabilities significantly affect the installation of source distributions which are tar archives as source distributions already allow arbitrary code execution during the build process. However when evaluating source distributions it's important to avoid installing source distributions with suspicious links.

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

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

3 open source packages ship an affected version, including libpython, python and python-min.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `libpython` | Bitnami | All versions | 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.4 |
| `python` | Bitnami | All versions | 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.4 |
| `python-min` | Bitnami | All versions | 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.4 |

## How do I fix CVE-2024-12718?

Upgrade libpython to a fixed version for your release line: 3.9.23, 3.10.18, 3.11.13 or 3.12.11.

## Is CVE-2024-12718 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-12718 exists.

## Fix prompt for AI coding agents

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

What it is: CVE-2024-12718 is a medium-severity path traversal vulnerability in CPython, published on 3 Jun 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-12718 exists.

Affected packages and fixed versions:
- libpython (Bitnami): affected all versions; fixed in 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.4
- python (Bitnami): affected all versions; fixed in 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.4
- python-min (Bitnami): affected all versions; fixed in 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.4

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-12718/ (Markdown: https://insights.sbomify.com/CVE-2024-12718/index.md)
```

## Sources

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

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