CVE-2022-40897 pypa/setuptools vulnerable to Regular Expression Denial of Service (ReDoS)

Medium 5.9 Published Updated

Remote attackers can cause denial of service in Python setuptools via crafted HTML in packages or custom PackageIndex pages due to ReDoS.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-40897?

CVE-2022-40897 is a medium-severity denial of service vulnerability in n/a, published on 22 Dec 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Python Packaging Authority (PyPA) setuptools before 65.5.1 allows remote attackers to cause a denial of service via HTML in a crafted package or custom PackageIndex page. There is a Regular Expression Denial of Service (ReDoS) in package_index.py.

Weakness: CWE-1333

Which versions are affected by CVE-2022-40897?

4 open source packages ship an affected version, including setuptools. It affects 1 product.

PackageAffectedFixed in
setuptools BitnamiAll versions65.5.1
setuptools PyPIAll versions65.5.1
setuptools PyPIAll versions65.5.1
setuptools PyPIAll versions65.5.1
Linux distribution packages (36)
platform-python-setuptools AlmaLinux:8All versions39.2.0-6.el8_7.1
python3-setuptools AlmaLinux:8All versions39.2.0-6.el8_7.1
python3-setuptools-wheel AlmaLinux:8All versions39.2.0-6.el8_7.1
python3-setuptools AlmaLinux:9All versions53.0.0-10.el9_1.1
python3-setuptools-wheel AlmaLinux:9All versions53.0.0-10.el9_1.1
platform-python-setuptools Red Hat:enterprise_linux:8::baseosAll versions0:39.2.0-6.el8_7.1
python-setuptools Red Hat:enterprise_linux:8::baseosAll versions0:39.2.0-6.el8_7.1
python3-setuptools Red Hat:enterprise_linux:8::baseosAll versions0:39.2.0-6.el8_7.1
python3-setuptools-wheel Red Hat:enterprise_linux:8::baseosAll versions0:39.2.0-6.el8_7.1
python-setuptools Red Hat:enterprise_linux:9::baseosAll versions0:53.0.0-10.el9_1.1
python3-setuptools Red Hat:enterprise_linux:9::baseosAll versions0:53.0.0-10.el9_1.1
python3-setuptools-wheel Red Hat:enterprise_linux:9::baseosAll versions0:53.0.0-10.el9_1.1
platform-python-setuptools Red Hat:rhel_eus:8.6::baseosAll versions0:39.2.0-7.el8_6
python-setuptools Red Hat:rhel_eus:8.6::baseosAll versions0:39.2.0-7.el8_6
python3-setuptools Red Hat:rhel_eus:8.6::baseosAll versions0:39.2.0-7.el8_6
python3-setuptools-wheel Red Hat:rhel_eus:8.6::baseosAll versions0:39.2.0-7.el8_6
PyYAML Red Hat:rhel_eus:8.8::appstreamAll versions0:5.4.1-1.module+el8.5.0+10613+59a13ec4
PyYAML-debugsource Red Hat:rhel_eus:8.8::appstreamAll versions0:5.4.1-1.module+el8.5.0+10613+59a13ec4
mod_wsgi Red Hat:rhel_eus:8.8::appstreamAll versions0:4.7.1-5.module+el8.7.0+16654+645aad7f
numpy Red Hat:rhel_eus:8.8::appstreamAll versions0:1.19.4-3.module+el8.5.0+12204+54860423
numpy-debugsource Red Hat:rhel_eus:8.8::appstreamAll versions0:1.19.4-3.module+el8.5.0+12204+54860423
python-PyMySQL Red Hat:rhel_eus:8.8::appstreamAll versions0:0.10.1-2.module+el8.4.0+9822+20bf1249
python-cffi Red Hat:rhel_eus:8.8::appstreamAll versions0:1.14.3-2.module+el8.4.0+9822+20bf1249
python-cffi-debugsource Red Hat:rhel_eus:8.8::appstreamAll versions0:1.14.3-2.module+el8.4.0+9822+20bf1249
python-chardet Red Hat:rhel_eus:8.8::appstreamAll versions0:3.0.4-19.module+el8.4.0+9822+20bf1249
python-cryptography Red Hat:rhel_eus:8.8::appstreamAll versions0:3.3.1-2.module+el8.4.0+9822+20bf1249
python-cryptography-debugsource Red Hat:rhel_eus:8.8::appstreamAll versions0:3.3.1-2.module+el8.4.0+9822+20bf1249
python-idna Red Hat:rhel_eus:8.8::appstreamAll versions0:2.10-3.module+el8.4.0+9822+20bf1249
python-lxml Red Hat:rhel_eus:8.8::appstreamAll versions0:4.6.5-1.module+el8.6.0+13933+9cf0c87c
python-lxml-debugsource Red Hat:rhel_eus:8.8::appstreamAll versions0:4.6.5-1.module+el8.6.0+13933+9cf0c87c
python-ply Red Hat:rhel_eus:8.8::appstreamAll versions0:3.11-10.module+el8.4.0+9822+20bf1249
python-psutil Red Hat:rhel_eus:8.8::appstreamAll versions0:5.8.0-4.module+el8.4.0+9822+20bf1249
python-psutil-debugsource Red Hat:rhel_eus:8.8::appstreamAll versions0:5.8.0-4.module+el8.4.0+9822+20bf1249
python-psycopg2 Red Hat:rhel_eus:8.8::appstreamAll versions0:2.8.6-2.module+el8.4.0+9822+20bf1249
python-psycopg2-debugsource Red Hat:rhel_eus:8.8::appstreamAll versions0:2.8.6-2.module+el8.4.0+9822+20bf1249
python-pycparser Red Hat:rhel_eus:8.8::appstreamAll versions0:2.20-3.module+el8.4.0+9822+20bf1249

Products include Python Setuptools.

How do I fix CVE-2022-40897?

Upgrade setuptools to 65.5.1 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2022-40897 being exploited?

There is no known exploitation of CVE-2022-40897 in the wild and no public exploit code.

Sources

Also known as ALSA-2023:0835, ALSA-2023:0952, AZL-60207, BIT-setuptools-2022-40897, CLSA-2026-1774916703, CLSA-2026-1789379973 and 27 more.

Is CVE-2022-40897 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free