CVE-2024-5642
Medium · 6.5CVSS
6.5
EPSS
0.7%
Published
Jun 27, 2024
CISA due date
—
Cloudanix analysis
Older Python versions contain a rare flaw that could let attackers peek at small pieces of memory or cause crashes during certain secure network connections.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Data Exposure
- Component
- Library
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Configuring an empty list for SSLContext.set_npn_protocols() in CPython 3.9 and earlier passes an invalid value to the OpenSSL NPN API, resulting in a buffer over-read during protocol negotiation.
Why it matters to the business
Limited risk of information disclosure or application instability in network services that rely on the rarely used NPN feature; most environments remain unaffected.
How an attack unfolds
An attacker supplies or triggers an empty protocol list via set_npn_protocols() in a vulnerable Python application, causing the NPN code path to perform an out-of-bounds read when negotiating TLS connections.
How to fix it
Upgrade CPython source to commit 39258d3595300bc7b952854c915f63ae2d4b9c3e or later; ensure applications never pass an empty list to set_npn_protocols().
How to confirm the fix worked
Confirm set_npn_protocols rejects empty lists with an error; run regression tests exercising NPN code paths after applying the fix.
Typical attack path
- Locate Python applications using SSLContext and NPN
- Invoke or force set_npn_protocols with an empty list
- Initiate a TLS handshake that exercises the NPN code path
- Observe memory disclosure or crash from the resulting over-read
How to detect it
Search application and system logs for crashes or errors tied to SSL NPN negotiation; inspect source code for set_npn_protocols calls passing empty lists.
What your security team should do
- Apply the upstream commit or equivalent patch to all affected CPython installations
- Audit codebases for direct calls to set_npn_protocols with empty arguments
- Disable NPN support where it is not explicitly required
The record
CPython 3.9 and earlier doesn't disallow configuring an empty list ("[]") for SSLContext.set_npn_protocols() which is an invalid value for the underlying OpenSSL API. This results in a buffer over-read when NPN is used (see CVE-2024-5535 for OpenSSL). This vulnerability is of low severity due to NPN being not widely used and specifying an empty list likely being uncommon in-practice (typically a protocol name would be configured).
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| AlmaLinux:8 | python39 | 0 | 3.9.25-2.module_el8.10.0+4083+53cad1fb |
| AlmaLinux:8 | python39-Cython | 0 | 0.29.21-5.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-Cython | 0 | 0.29.21-5.module_el8.6.0+3248+c431e88c |
| AlmaLinux:8 | python39-PyMySQL | 0 | 0.10.1-2.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-attrs | 0 | 20.3.0-2.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-cffi | 0 | 1.14.3-2.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-cffi | 0 | 1.14.3-2.module_el8.6.0+3248+c431e88c |
| AlmaLinux:8 | python39-chardet | 0 | 3.0.4-19.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-cryptography | 0 | 3.3.1-3.module_el8.10.0+3765+2f9a457d |
| AlmaLinux:8 | python39-debug | 0 | 3.9.25-2.module_el8.10.0+4083+53cad1fb |
| AlmaLinux:8 | python39-devel | 0 | 3.9.25-2.module_el8.10.0+4083+53cad1fb |
| AlmaLinux:8 | python39-idle | 0 | 3.9.25-2.module_el8.10.0+4083+53cad1fb |
| AlmaLinux:8 | python39-idna | 0 | 2.10-4.module_el8.10.0+3849+a48d89aa |
| AlmaLinux:8 | python39-iniconfig | 0 | 1.1.1-2.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-libs | 0 | 3.9.25-2.module_el8.10.0+4083+53cad1fb |
| AlmaLinux:8 | python39-lxml | 0 | 4.6.5-1.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-lxml | 0 | 4.6.5-1.module_el8.6.0+3248+c431e88c |
| AlmaLinux:8 | python39-mod_wsgi | 0 | 4.7.1-7.module_el8.10.0+3989+a618fe15.1 |
| AlmaLinux:8 | python39-more-itertools | 0 | 8.5.0-2.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-numpy | 0 | 1.19.4-3.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-numpy | 0 | 1.19.4-3.module_el8.6.0+3248+c431e88c |
| AlmaLinux:8 | python39-numpy-doc | 0 | 1.19.4-3.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-numpy-f2py | 0 | 1.19.4-3.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-numpy-f2py | 0 | 1.19.4-3.module_el8.6.0+3248+c431e88c |
| AlmaLinux:8 | python39-packaging | 0 | 20.4-4.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-pip | 0 | 20.2.4-9.module_el8.10.0+3765+2f9a457d |
| AlmaLinux:8 | python39-pip-wheel | 0 | 20.2.4-9.module_el8.10.0+3765+2f9a457d |
| AlmaLinux:8 | python39-pluggy | 0 | 0.13.1-3.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-ply | 0 | 3.11-10.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-psutil | 0 | 5.8.0-4.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-psutil | 0 | 5.8.0-4.module_el8.6.0+3248+c431e88c |
| AlmaLinux:8 | python39-psycopg2 | 0 | 2.8.6-3.module_el8.10.0+3765+2f9a457d |
| AlmaLinux:8 | python39-psycopg2-doc | 0 | 2.8.6-3.module_el8.10.0+3765+2f9a457d |
| AlmaLinux:8 | python39-psycopg2-tests | 0 | 2.8.6-3.module_el8.10.0+3765+2f9a457d |
| AlmaLinux:8 | python39-py | 0 | 1.10.0-1.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-pybind11 | 0 | 2.7.1-1.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-pybind11 | 0 | 2.7.1-1.module_el8.6.0+3248+c431e88c |
| AlmaLinux:8 | python39-pybind11-devel | 0 | 2.7.1-1.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-pybind11-devel | 0 | 2.7.1-1.module_el8.6.0+3248+c431e88c |
| AlmaLinux:8 | python39-pycparser | 0 | 2.20-3.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-pyparsing | 0 | 2.4.7-5.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-pysocks | 0 | 1.7.1-4.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-pytest | 0 | 6.0.2-2.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-pyyaml | 0 | 5.4.1-1.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-pyyaml | 0 | 5.4.1-1.module_el8.6.0+3248+c431e88c |
| AlmaLinux:8 | python39-requests | 0 | 2.25.0-3.module_el8.9.0+3634+fb2a896c |
| AlmaLinux:8 | python39-rpm-macros | 0 | 3.9.25-2.module_el8.10.0+4083+53cad1fb |
| AlmaLinux:8 | python39-scipy | 0 | 1.5.4-5.module_el8.9.0+3634+fb2a896c |
| AlmaLinux:8 | python39-setuptools | 0 | 50.3.2-7.module_el8.10.0+4040+9207bbc0 |
| AlmaLinux:8 | python39-setuptools-wheel | 0 | 50.3.2-7.module_el8.10.0+4040+9207bbc0 |
| AlmaLinux:8 | python39-six | 0 | 1.15.0-3.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-test | 0 | 3.9.25-2.module_el8.10.0+4083+53cad1fb |
| AlmaLinux:8 | python39-tkinter | 0 | 3.9.25-2.module_el8.10.0+4083+53cad1fb |
| AlmaLinux:8 | python39-toml | 0 | 0.10.1-5.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-urllib3 | 0 | 1.25.10-5.module_el8.10.0+3765+2f9a457d |
| AlmaLinux:8 | python39-wcwidth | 0 | 0.2.5-3.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-wheel | 0 | 1:0.35.1-4.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:8 | python39-wheel-wheel | 0 | 1:0.35.1-4.module_el8.6.0+2780+a40f65e1 |
| AlmaLinux:9 | python-unversioned-command | 0 | 3.9.25-2.el9_7 |
| AlmaLinux:9 | python3 | 0 | 3.9.25-2.el9_7 |
| AlmaLinux:9 | python3-debug | 0 | 3.9.25-2.el9_7 |
| AlmaLinux:9 | python3-devel | 0 | 3.9.25-2.el9_7 |
| AlmaLinux:9 | python3-idle | 0 | 3.9.25-2.el9_7 |
| AlmaLinux:9 | python3-libs | 0 | 3.9.25-2.el9_7 |
| AlmaLinux:9 | python3-test | 0 | 3.9.25-2.el9_7 |
| AlmaLinux:9 | python3-tkinter | 0 | 3.9.25-2.el9_7 |
| Bitnami | libpython | 0 | 3.10.0 |
| Bitnami | libpython | 0 | 3.9.24 |
| Bitnami | python | 0 | 3.10.0 |
| Bitnami | python | 0 | 3.9.24 |
| Bitnami | python-min | 0 | 3.10.0 |
| Bitnami | python-min | 0 | 3.9.24 |
| Chainguard | python-3.9 | 0 | 3.9.25-r0 |
| Chainguard | python-3.9-base | 0 | 3.9.25-r0 |
| Chainguard | python-3.9-base-dev | 0 | 3.9.25-r0 |
| Chainguard | python-3.9-dev | 0 | 3.9.25-r0 |
| Chainguard | python-3.9-doc | 0 | 3.9.25-r0 |
| Debian:11 | pypy3 | 0 | No fix |
| Debian:11 | python2.7 | 0 | No fix |
| Debian:11 | python3.9 | 0 | No fix |
| Debian:12 | pypy3 | 0 | 7.3.10+dfsg-1 |
| Debian:13 | pypy3 | 0 | 7.3.10+dfsg-1 |
| Debian:14 | pypy3 | 0 | 7.3.10+dfsg-1 |
| SUSE:Enterprise Storage 7.1 | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Enterprise Storage 7.1 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Enterprise Storage 7.1 | python39 | 0 | 3.9.19-150300.4.49.1 |
| SUSE:Enterprise Storage 7.1 | python39-core | 0 | 3.9.19-150300.4.49.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | python39 | 0 | 3.9.19-150300.4.49.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | python39-core | 0 | 3.9.19-150300.4.49.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Micro 5.1 | python3 | 0 | 3.6.15-150000.3.158.1 |
| SUSE:Linux Enterprise Micro 5.1 | python3-core | 0 | 3.6.15-150000.3.158.1 |
| SUSE:Linux Enterprise Micro 5.2 | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Micro 5.2 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Micro 5.3 | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Micro 5.3 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Micro 5.4 | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Micro 5.4 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Micro 5.5 | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Micro 5.5 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP5 | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP5 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP6 | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP6 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Module for Development Tools 15 SP5 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Module for Development Tools 15 SP6 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Module for Legacy 15 SP5 | python39 | 0 | 3.9.19-150300.4.49.1 |
| SUSE:Linux Enterprise Module for Legacy 15 SP5 | python39-core | 0 | 3.9.19-150300.4.49.1 |
| SUSE:Linux Enterprise Server 12 SP5 | python36 | 0 | 3.6.15-64.1 |
| SUSE:Linux Enterprise Server 12 SP5 | python36-core | 0 | 3.6.15-64.1 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | python39 | 0 | 3.9.19-150300.4.49.1 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | python39-core | 0 | 3.9.19-150300.4.49.1 |
| SUSE:Linux Enterprise Server 15 SP4-LTSS | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Server 15 SP4-LTSS | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | python36 | 0 | 3.6.15-64.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | python36-core | 0 | 3.6.15-64.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | python39 | 0 | 3.9.19-150300.4.49.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | python39-core | 0 | 3.9.19-150300.4.49.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Linux Enterprise Software Development Kit 12 SP5 | python36-core | 0 | 3.6.15-64.1 |
| SUSE:Manager Proxy 4.3 | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Manager Proxy 4.3 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Manager Server 4.3 | python3 | 0 | 3.6.15-150300.10.72.1 |
| SUSE:Manager Server 4.3 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| Ubuntu:20.04:LTS | python2.7 | 0 | No fix |
| Ubuntu:20.04:LTS | python3.8 | 0 | 3.8.2-1ubuntu1 |
| Ubuntu:20.04:LTS | python3.9 | 0 | No fix |
| Ubuntu:22.04:LTS | python2.7 | 0 | No fix |
| Ubuntu:22.04:LTS | python3.10 | 0 | 3.10.4-3 |
| Ubuntu:22.04:LTS | python3.11 | 0 | 3.11.0~rc1-1~22.04 |
| Ubuntu:24.04:LTS | python3.12 | 0 | 3.12.3-1 |
| Ubuntu:24.10 | python3.12 | 0 | 3.12.4-1ubuntu1 |
| Ubuntu:25.10 | python3.12 | 0 | No fix |
| Ubuntu:Pro:14.04:LTS | python2.7 | 0 | No fix |
| Ubuntu:Pro:14.04:LTS | python3.4 | 0 | No fix |
| Ubuntu:Pro:14.04:LTS | python3.5 | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | python2.7 | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | python3.5 | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | python2.7 | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | python3.6 | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | python3.7 | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | python2.7 | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | python3.9 | 0 | No fix |
| Ubuntu:Pro:22.04:LTS | python2.7 | 0 | No fix |
| openSUSE:Leap 15.5 | python3 | 0 | 3.6.15-150300.10.72.1 |
| openSUSE:Leap 15.5 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| openSUSE:Leap 15.5 | python3-documentation | 0 | 3.6.15-150300.10.72.1 |
| openSUSE:Leap 15.5 | python39 | 0 | 3.9.19-150300.4.49.1 |
| openSUSE:Leap 15.5 | python39-core | 0 | 3.9.19-150300.4.49.1 |
| openSUSE:Leap 15.5 | python39-documentation | 0 | 3.9.19-150300.4.49.1 |
| openSUSE:Leap 15.6 | python3 | 0 | 3.6.15-150300.10.72.1 |
| openSUSE:Leap 15.6 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| openSUSE:Leap 15.6 | python3-documentation | 0 | 3.6.15-150300.10.72.1 |
| openSUSE:Leap 15.6 | python39 | 0 | 3.9.19-150300.4.49.1 |
| openSUSE:Leap 15.6 | python39-core | 0 | 3.9.19-150300.4.49.1 |
| openSUSE:Leap 15.6 | python39-documentation | 0 | 3.9.19-150300.4.49.1 |
| openSUSE:Leap Micro 5.5 | python3 | 0 | 3.6.15-150300.10.72.1 |
| openSUSE:Leap Micro 5.5 | python3-core | 0 | 3.6.15-150300.10.72.1 |
| openSUSE:Tumbleweed | python38 | 0 | 3.8.19-7.1 |
| openSUSE:Tumbleweed | python39 | 0 | 3.9.19-6.1 |
Related vulnerabilities
- CVE-2025-6075 If the value passed to os.path.expandvars() is user-controlled a performance degradation… Also affects python39
- CVE-2024-11168 The urllib.parse.urlsplit() and urlparse() functions improperly validated bracketed hosts… Also affects python39
- CVE-2024-9287 A vulnerability has been found in the CPython `venv` module and CLI where path names… Also affects python39
- CVE-2024-6232 There is a MEDIUM severity vulnerability affecting CPython. Also affects python39
- CVE-2024-8088 There is a HIGH severity vulnerability affecting the CPython "zipfile" module affecting… Also affects python39
- CVE-2024-6923 There is a MEDIUM severity vulnerability affecting CPython. Also affects python39
- CVE-2024-6345 A vulnerability in the package_index module of pypa/setuptools versions up to 69.1.1… Also affects python39
- CVE-2024-4032 The “ipaddress” module contained incorrect information about whether certain IPv4 and… Also affects python39