Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐍
🐍 PyPI
Not in CISA KEV
MEDIUM severity

CVE-2022-40897 — setuptools

MEDIUMFix: pypa/setuptools@43a9c9b

CVE-2022-40897 is a medium-severity (CVSS 5.9) CWE-1333 vulnerability in setuptools. 1 public exploit reference exists, so weaponization risk is real. A fix is available for setuptools — see the affected versions and patch details below.

pypa/setuptools vulnerable to Regular Expression Denial of Service (ReDoS)

Also known asBIT-setuptools-2022-40897GHSA-r9hx-vwmv-q579PYSEC-2022-43012
Published
Updated
Affected
1 pkg
Patched
1 / 1
Exploits
1 known
Exploitation data as of Oct 23, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

No confirmed exploitation observed yet

  • CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.

Exploitation and automatability from CISA’s SSVC triage for CVE-2022-40897.

EPSS Exploitation Probability

via FIRST.org ↗
2.6%probability of exploitation in next 30 days
Lower Risk+0.02%
Lower risk than most CVEs85th percentile — riskier than 85% of all scored CVEsHighest risk
0.00%1.09%2.18%3.27%0.5%2.6%Apr 26Aug 26Oct 26

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

CVE-2022-40897 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.

Where this sits among everything scored

Of 394,803 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.

Real-World Exposure

1 pkg affected
🐍setuptools

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.

Description

Python Packaging Authority (PyPA)'s setuptools is a library designed to facilitate packaging Python projects. Setuptools version 65.5.0 and earlier could allow remote attackers to cause a denial of service by fetching malicious HTML from a PyPI package or custom PackageIndex page due to a vulnerable Regular Expression in package_index. This has been patched in version 65.5.1.

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐍PyPIsetuptoolsall versions65.5.1pip install --upgrade 'setuptools==65.5.1'

Affected Products

1 product · 1 configurations
Application
setuptoolspython
< 65.5.1
range
Exploits & PoCs
1

Research use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for setuptools, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update setuptools to 65.5.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2022-40897 is resolved across your whole dependency graph.

  3. Workarounds

    Cap what an attacker can consume: apply request size, rate and timeout limits in front of the affected component, and run it with memory and CPU limits so exhaustion degrades one worker rather than the whole service.

Fixing This On Your OS

If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.

Red HatModerate
ProductFixed inAdvisory
Red Hat Enterprise Linux 8python39:3.9-8100020240214182535.7044f6c1RHSA-2024:2985
Red Hat Enterprise Linux 8python27:2.7-8100020240208011952.5f0f67deRHSA-2024:2987
Red Hat Enterprise Linux 8python-setuptools-0:39.2.0-6.el8_7.1RHSA-2023:0835
Red Hat Enterprise Linux 8.6 Advanced Mission Critical Update Supportpython39:3.9-8060020240916062113.6a631399RHSA-2024:6915
Red Hat Enterprise Linux 8.6 Extended Update Supportpython-setuptools-0:39.2.0-7.el8_6RHSA-2023:7395
Red Hat Enterprise Linux 8.8 Extended Update Supportpython39:3.9-8080020240402104641.93c2fc2fRHSA-2024:4421
Red Hat Enterprise Linux 9python-setuptools-0:53.0.0-10.el9_1.1RHSA-2023:0952
Red Hat Software Collections for Red Hat Enterprise Linux 7rh-python38-python-setuptools-0:41.6.0-8.el7RHSA-2023:6793
UbuntuMEDIUM

Frequently Asked Questions

Python Packaging Authority (PyPA)'s setuptools is a library designed to facilitate packaging Python projects. Setuptools version 65.5.0 and earlier could allow remote attackers to cause a denial of service by fetching malicious HTML from a PyPI package or custom PackageIndex page due to a vulnerable Regular Expression in `package_index`. This has been patched in version 65.5.1.
O3 Security · Impact-Aware SCA

Is CVE-2022-40897 in your dependencies?

Find it across PyPI, including transitive dependencies.

CVE-2022-40897: setuptools DoS — Fixed in 65.5.1