# CVE-2024-6345: Remote Code Execution in pypa/setuptools

> Remote code execution via code injection in setuptools download functions when exposed to user-controlled inputs.

- **Severity:** High 8.8 (`CVSS:3.0/AV:N/AC:L/PR:N/UI:R/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:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 15 Jul 2024
- **Updated:** 4 Nov 2025
- **Also known as:** ALPINE-CVE-2024-6345, ALSA-2024:5279, ALSA-2024:5530, ALSA-2024:5531, ALSA-2024:5532, ALSA-2024:5533, ALSA-2024:5534, ALSA-2024:6726, AZL-43326, AZL-43329, AZL-60199, BELL-CVE-2024-6345, BIT-setuptools-2024-6345, CLEANSTART-2026-ZQ12182, CLSA-2024-1730142448, CLSA-2025-1752019950, CLSA-2025-1764615000, CLSA-2026-1787812038, CLSA-2026-1791448913, CLSA-2026-1791449247, DEBIAN-CVE-2024-6345, ECHO-a9d4-b82a-f3c2, GHSA-cx63-2mw6-8hw5, MGASA-2025-0056, MINI-76m2-225f-2gcm, MINI-mmq3-8hq2-q2vw, OESA-2024-1931, PYSEC-2026-1918, RHSA-2024:5000, RHSA-2024:5002, RHSA-2024:5040, RHSA-2024:5078, RHSA-2024:5084, RHSA-2024:5137, RHSA-2024:5279, RHSA-2024:5389, RHSA-2024:5530, RHSA-2024:5531, RHSA-2024:5532, RHSA-2024:5533, RHSA-2024:5534, RHSA-2024:6220, RHSA-2024:6312, RHSA-2024:6488, RHSA-2024:6611, RHSA-2024:6612, RHSA-2024:6661, RHSA-2024:6662, RHSA-2024:6726, RHSA-2024:6907, RHSA-2024:8168, RHSA-2024:8170, RHSA-2024:8171, RHSA-2024:8172, RHSA-2024:8173, RHSA-2024:8179, RLSA-2024:5279, RLSA-2024:5530, RLSA-2024:5531, RLSA-2024:5532, RLSA-2024:5533, RLSA-2024:6726, ROOT-APP-PYPI-CVE-2024-6345, SUSE-SU-2024:2899-1, SUSE-SU-2024:2900-1, SUSE-SU-2024:2904-1, SUSE-SU-2024:2906-1, SUSE-SU-2024:2907-1, SUSE-SU-2024:2950-1, SUSE-SU-2024:3054-1, SUSE-SU-2024:3055-1, SUSE-SU-2025:20053-1, UBUNTU-CVE-2024-6345, USN-7002-1, openSUSE-SU-2024:14294-1

## What is CVE-2024-6345?

CVE-2024-6345 is a high-severity code injection vulnerability in pypa/setuptools, published on 15 Jul 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

A vulnerability in the package_index module of pypa/setuptools versions up to 69.1.1 allows for remote code execution via its download functions. These functions, which are used to download packages from URLs provided by users or retrieved from package index servers, are susceptible to code injection. If these functions are exposed to user-controlled inputs, such as package URLs, they can execute arbitrary commands on the system. The issue is fixed in version 70.0.

Weakness: CWE-94 (Improper Control of Generation of Code)

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

4 open source packages ship an affected version, including setuptools.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `setuptools` | Bitnami | All versions | 70.0.0 |
| `setuptools` | PyPI | All versions | 70.0.0 |
| `setuptools` | PyPI | All versions | 70.0.0 |
| `setuptools` | PyPI | All versions | 70.0.0 |
| `platform-python-setuptools` | AlmaLinux:8 | All versions | 39.2.0-8.el8_10 |
| `python3-setuptools` | AlmaLinux:8 | All versions | 39.2.0-8.el8_10 |
| `python3-setuptools-wheel` | AlmaLinux:8 | All versions | 39.2.0-8.el8_10 |
| `python3.11-setuptools` | AlmaLinux:8 | All versions | 65.5.1-3.el8_10 |
| `python3.11-setuptools-wheel` | AlmaLinux:8 | All versions | 65.5.1-3.el8_10 |
| `python3.12-setuptools` | AlmaLinux:8 | All versions | 68.2.2-4.el8_10 |
| `python3.12-setuptools-wheel` | AlmaLinux:8 | All versions | 68.2.2-4.el8_10 |
| `fence-agents-aliyun` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-all` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-amt-ws` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-apc` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-apc-snmp` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-aws` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-azure-arm` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-bladecenter` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-brocade` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-cisco-mds` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-cisco-ucs` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-common` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-compute` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-drac5` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-eaton-snmp` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-emerson` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-eps` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-gce` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-heuristics-ping` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-hpblade` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-ibm-powervs` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-ibm-vpc` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-ibmblade` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-ifmib` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-ilo-moonshot` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-ilo-mp` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-ilo-ssh` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-ilo2` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |
| `fence-agents-intelmodular` | AlmaLinux:9 | All versions | 4.10.0-62.el9_4.5 |

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

Upgrade setuptools to 70.0.0 or later.

## Is CVE-2024-6345 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: CVE-2024-6345 is a high-severity code injection vulnerability in pypa/setuptools, published on 15 Jul 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-6345 exists.

Affected packages and fixed versions:
- setuptools (Bitnami): affected all versions; fixed in 70.0.0
- setuptools (PyPI): affected all versions; fixed in 70.0.0
- setuptools (PyPI): affected all versions; fixed in 70.0.0
- setuptools (PyPI): affected all versions; fixed in 70.0.0

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

## Sources

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

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