# CVE-2007-4559: Path traversal in n/a

> Attackers can overwrite arbitrary files via directory traversal in Python's tarfile module, requiring user-assisted archive extraction.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 28 Aug 2007
- **Updated:** 17 Jan 2025
- **Also known as:** ALSA-2023:6324, ALSA-2023:6659, ALSA-2023:6694, ALSA-2023:6914, ALSA-2023:7151, ALSA-2023:7176, AZL-109554, AZL-6822, AZL-6828, BIT-python-2007-4559, BIT-python-min-2007-4559, CLSA-2025-1740471603, CLSA-2025-1740599937, CLSA-2025-1740645663, CLSA-2025-1741125595, CLSA-2025-1759780334, CLSA-2025-1759780820, CLSA-2025-1759857092, CLSA-2025-1765376235, CLSA-2026-1782894738, GHSA-gw9q-c7gh-j9vm, OESA-2023-1518, OESA-2023-1519, OESA-2023-1520, OESA-2024-2304, PSF-2007-2, RHSA-2023:6324, RHSA-2023:6659, RHSA-2023:6694, RHSA-2023:6914, RHSA-2023:7151, RHSA-2023:7176, RHSA-2024:0374, RHSA-2024:0587, SUSE-SU-2023:2463-1, SUSE-SU-2023:2473-1, SUSE-SU-2023:2509-1, SUSE-SU-2023:2517-1, SUSE-SU-2023:2641-1, SUSE-SU-2023:2778-1, UBUNTU-CVE-2007-4559, openSUSE-SU-2024:12684-1, openSUSE-SU-2024:12947-1, openSUSE-SU-2024:12964-1, openSUSE-SU-2024:12977-1, openSUSE-SU-2024:13770-1, openSUSE-SU-2025:15104-1

## What is CVE-2007-4559?

CVE-2007-4559 is a critical path traversal vulnerability in Python Python, published on 28 Aug 2007. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Directory traversal vulnerability in the (1) extract and (2) extractall functions in the tarfile module in Python allows user-assisted remote attackers to overwrite arbitrary files via a .. (dot dot) sequence in filenames in a TAR archive, a related issue to CVE-2001-1267.

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

## Which versions are affected by CVE-2007-4559?

2 open source packages ship an affected version, including python and python-min. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `python` | Bitnami | All versions | 3.6.16, 3.8.17, 3.9.17, 3.10.12, 3.11.4 |
| `python-min` | Bitnami | All versions | 3.6.16, 3.8.17, 3.9.17, 3.10.12, 3.11.4 |
| `platform-python` | AlmaLinux:8 | All versions | 3.6.8-56.el8_9.alma.1 |
| `platform-python-debug` | AlmaLinux:8 | All versions | 3.6.8-56.el8_9.alma.1 |
| `platform-python-devel` | AlmaLinux:8 | All versions | 3.6.8-56.el8_9.alma.1 |
| `platform-python-pip` | AlmaLinux:8 | All versions | 9.0.3-23.el8 |
| `python3-idle` | AlmaLinux:8 | All versions | 3.6.8-56.el8_9.alma.1 |
| `python3-libs` | AlmaLinux:8 | All versions | 3.6.8-56.el8_9.alma.1 |
| `python3-pip` | AlmaLinux:8 | All versions | 9.0.3-23.el8 |
| `python3-pip-wheel` | AlmaLinux:8 | All versions | 9.0.3-23.el8 |
| `python3-test` | AlmaLinux:8 | All versions | 3.6.8-56.el8_9.alma.1 |
| `python3-tkinter` | AlmaLinux:8 | All versions | 3.6.8-56.el8_9.alma.1 |
| `python3.11-pip` | AlmaLinux:8 | All versions | 22.3.1-4.el8 |
| `python3.11-pip-wheel` | AlmaLinux:8 | All versions | 22.3.1-4.el8 |
| `python-unversioned-command` | AlmaLinux:9 | All versions | 3.9.18-1.el9_3 |
| `python3` | AlmaLinux:9 | All versions | 3.9.18-1.el9_3 |
| `python3-debug` | AlmaLinux:9 | All versions | 3.9.18-1.el9_3 |
| `python3-devel` | AlmaLinux:9 | All versions | 3.9.18-1.el9_3 |
| `python3-idle` | AlmaLinux:9 | All versions | 3.9.18-1.el9_3 |
| `python3-libs` | AlmaLinux:9 | All versions | 3.9.18-1.el9_3 |
| `python3-pip` | AlmaLinux:9 | All versions | 21.2.3-7.el9 |
| `python3-pip-wheel` | AlmaLinux:9 | All versions | 21.2.3-7.el9 |
| `python3-test` | AlmaLinux:9 | All versions | 3.9.18-1.el9_3 |
| `python3-tkinter` | AlmaLinux:9 | All versions | 3.9.18-1.el9_3 |
| `python3.11-pip` | AlmaLinux:9 | All versions | 22.3.1-4.el9 |
| `python3.11-pip-wheel` | AlmaLinux:9 | All versions | 22.3.1-4.el9 |
| `platform-python` | Red Hat:enterprise_linux:8::appstream | All versions | 0:3.6.8-56.el8_9 |
| `platform-python-debug` | Red Hat:enterprise_linux:8::appstream | All versions | 0:3.6.8-56.el8_9 |
| `platform-python-devel` | Red Hat:enterprise_linux:8::appstream | All versions | 0:3.6.8-56.el8_9 |
| `python3-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:3.6.8-56.el8_9 |
| `python3-debugsource` | Red Hat:enterprise_linux:8::appstream | All versions | 0:3.6.8-56.el8_9 |
| `python3-idle` | Red Hat:enterprise_linux:8::appstream | All versions | 0:3.6.8-56.el8_9 |
| `python3-pip` | Red Hat:enterprise_linux:8::appstream | All versions | 0:9.0.3-23.el8 |
| `python3-test` | Red Hat:enterprise_linux:8::appstream | All versions | 0:3.6.8-56.el8_9 |
| `python3-tkinter` | Red Hat:enterprise_linux:8::appstream | All versions | 0:3.6.8-56.el8_9 |
| `python3.11-pip` | Red Hat:enterprise_linux:8::appstream | All versions | 0:22.3.1-4.el8 |
| `python3.11-pip-wheel` | Red Hat:enterprise_linux:8::appstream | All versions | 0:22.3.1-4.el8 |
| `platform-python` | Red Hat:enterprise_linux:8::baseos | All versions | 0:3.6.8-56.el8_9 |
| `platform-python-pip` | Red Hat:enterprise_linux:8::baseos | All versions | 0:9.0.3-23.el8 |
| `python-pip` | Red Hat:enterprise_linux:8::baseos | All versions | 0:9.0.3-23.el8 |

Products: Python Python.

## How do I fix CVE-2007-4559?

Upgrade python to a fixed version for your release line: 3.6.16, 3.8.17, 3.9.17 or 3.10.12.

## Is CVE-2007-4559 being exploited?

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

Public exploit code:

- Creosote is our solution to searching for the tarfile vulnerability described by CVE-2007-4559. (github_poc): https://github.com/advanced-threat-research/Creosote
- https://github.com/depers-rus/CVE-2007-4559 (github_poc): https://github.com/depers-rus/CVE-2007-4559
- CVE-2007-4559 - Polemarch exploit (github_poc): https://github.com/Ooscaar/MALW
- https://github.com/davidholiday/CVE-2007-4559 (github_poc): https://github.com/davidholiday/CVE-2007-4559
- Bypass for CVE-2007-4559 Trellix patch (github_poc): https://github.com/luigigubello/trellix-tarslip-patch-bypass
- YISF 2024 CTF-Web (Directory Traversal via ".tar" file, CVE-2007-4559), easy (github_poc): https://github.com/m0d0ri205/wargame-tarpioka

## Other vulnerabilities in Python Python

- [CVE-2008-5031](https://insights.sbomify.com/CVE-2008-5031/): Integer overflow in n/a (critical 10.0)
- [CVE-2014-4650](https://insights.sbomify.com/CVE-2014-4650/): Path traversal in n/a (critical 9.8)
- [CVE-2016-5636](https://insights.sbomify.com/CVE-2016-5636/): Integer overflow in n/a (critical 9.8)
- [CVE-2017-17522](https://insights.sbomify.com/CVE-2017-17522/): Command injection in n/a (high 8.8)
- [CVE-2026-15308](https://insights.sbomify.com/CVE-2026-15308/): Incremental HTMLParser feed() allows CPU-exhaustion DoS via repeated unterminated markup declarations (high 8.7)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2007-4559 and fix it if it is affected.

What it is: CVE-2007-4559 is a critical path traversal vulnerability in Python Python, published on 28 Aug 2007. 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-2007-4559 exists.

Affected packages and fixed versions:
- python (Bitnami): affected all versions; fixed in 3.6.16, 3.8.17, 3.9.17, 3.10.12, 3.11.4
- python-min (Bitnami): affected all versions; fixed in 3.6.16, 3.8.17, 3.9.17, 3.10.12, 3.11.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-2007-4559/ (Markdown: https://insights.sbomify.com/CVE-2007-4559/index.md)
```

## Sources

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

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