CVE-2024-0397
High · 7.4CVSS
7.4
EPSS
0.8%
Published
Jun 17, 2024
CISA due date
—
Cloudanix analysis
A timing flaw in Python's secure connection handling can cause crashes or leaks in programs that use encrypted network links, so updating Python removes the problem.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- High
- Impact
- Data Exposure
- Component
- Library
- Class
- Race Condition
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Memory race condition in ssl.SSLContext.cert_store_stats() and get_ca_certs() when invoked concurrently with certificate loading into the context, such as during TLS handshakes with a certificate directory configured, leading to undefined behavior, crashes, or information disclosure.
Why it matters to the business
Python-based services relying on SSL/TLS may experience unexpected crashes, service interruptions, or potential data leaks, increasing operational risk and requiring prompt updates across development and production environments.
How an attack unfolds
An attacker triggers the race by initiating TLS connections that cause certificate loading while concurrently invoking cert_store_stats() or get_ca_certs() on the same SSLContext, exploiting the timing window in the ssl module.
How to fix it
Upgrade CPython to 3.10.14, 3.11.9, 3.12.3, or 3.13.0a5 (or newer); the fix is included in commit 01c37f1d0714f5822d34063ca7180b595abf589d. Rebuild and redeploy affected applications after updating.
How to confirm the fix worked
Confirm the installed CPython version matches or exceeds a fixed release, then execute test cases that perform concurrent calls to cert_store_stats() and get_ca_certs() during TLS handshakes with certificate directories.
Typical attack path
- Locate Python applications using the ssl module with certificate directories configured for TLS
- Initiate concurrent TLS handshakes to trigger certificate loading into the SSLContext
- Simultaneously call cert_store_stats() or get_ca_certs() to exploit the memory race condition
How to detect it
Review Python process logs and crash dumps for segmentation faults, memory corruption errors, or unexpected exceptions occurring during TLS handshake activity and concurrent certificate operations; correlate with high-concurrency SSL workloads.
What your security team should do
- Prioritize upgrading all CPython installations to the listed fixed versions within the next patching cycle
- Audit Python applications and libraries for direct or indirect use of the ssl module with dynamic certificate loading
- Update dependency scanning tools and CI/CD pipelines to enforce the fixed versions going forward
The record
A defect was discovered in the Python “ssl” module where there is a memory race condition with the ssl.SSLContext methods “cert_store_stats()” and “get_ca_certs()”. The race condition can be triggered if the methods are called at the same time as certificates are loaded into the SSLContext, such as during the TLS handshake with a certificate directory configured. This issue is fixed in CPython 3.10.14, 3.11.9, 3.12.3, and 3.13.0a5.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Bitnami | libpython | 0 | 3.8.20 |
| Bitnami | python | 0 | 3.8.20 |
| Bitnami | python | 3.12.0 | 3.12.3 |
| Bitnami | python-min | 0 | 3.8.20 |
| Chainguard | python-3.8 | 0 | 3.8.19-r1 |
| Chainguard | python-3.8-base | 0 | 3.8.19-r1 |
| Chainguard | python-3.8-base-dev | 0 | 3.8.19-r1 |
| Chainguard | python-3.8-default | 0 | 3.8.19-r1 |
| Chainguard | python-3.8-dev | 0 | 3.8.19-r1 |
| Chainguard | python-3.8-doc | 0 | 3.8.19-r1 |
| Chainguard | python-3.9 | 0 | 3.9.19-r2 |
| Chainguard | python-3.9-base | 0 | 3.9.19-r2 |
| Chainguard | python-3.9-base-dev | 0 | 3.9.19-r2 |
| Chainguard | python-3.9-default | 0 | 3.9.19-r2 |
| Chainguard | python-3.9-dev | 0 | 3.9.19-r2 |
| Chainguard | python-3.9-doc | 0 | 3.9.19-r2 |
| Debian:11 | pypy3 | 0 | No fix |
| Debian:11 | python2.7 | 0 | No fix |
| Debian:11 | python3.9 | 0 | No fix |
| Debian:11 | python3.9 | 0 | 3.9.2-1+deb11u2 |
| Debian:12 | pypy3 | 0 | No fix |
| Debian:12 | python3.11 | 0 | 3.11.2-6+deb12u3 |
| Debian:13 | pypy3 | 0 | 7.3.16+dfsg-1 |
| Debian:13 | python3.12 | 0 | 3.12.3-1 |
| Debian:14 | pypy3 | 0 | 7.3.16+dfsg-1 |
| Mageia:9 | python3 | 0 | 3.10.11-1.3.mga9 |
| SUSE:EL-9:Update:Products:SaltBundle:Update | saltbundlepy | 0 | 3.11.9-1.26.1 |
| SUSE:EL-9:Update:Products:SaltBundle:Update | saltbundlepy-core | 0 | 3.11.9-1.26.1 |
| SUSE:EL-9:Update:Products:SaltBundle:Update | saltbundlepy-cryptography | 0 | 3.3.2-1.18.1 |
| SUSE:EL-9:Update:Products:SaltBundle:Update | saltbundlepy-docker | 0 | 7.0.0-1.8.1 |
| SUSE:EL-9:Update:Products:SaltBundle:Update | saltbundlepy-idna | 0 | 3.4-1.9.2 |
| SUSE:EL-9:Update:Products:SaltBundle:Update | saltbundlepy-passlib | 0 | 1.7.4-1.3.1 |
| SUSE:EL-9:Update:Products:SaltBundle:Update | saltbundlepy-passlib-test | 0 | 1.7.4-1.3.1 |
| SUSE:EL-9:Update:Products:SaltBundle:Update | saltbundlepy-setuptools | 0 | 67.7.2-1.12.1 |
| SUSE:EL-9:Update:Products:SaltBundle:Update | saltbundlepy-urllib3 | 0 | 2.0.7-1.12.1 |
| SUSE:EL-9:Update:Products:SaltBundle:Update | saltbundlepy-zipp | 0 | 3.15.0-1.9.2 |
| SUSE:EL-9:Update:Products:SaltBundle:Update | venv-salt-minion | 0 | 3006.0-1.47.1 |
| SUSE:Enterprise Storage 7.1 | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Enterprise Storage 7.1 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise Micro 5.1 | python3 | 0 | 3.6.15-150000.3.150.1 |
| SUSE:Linux Enterprise Micro 5.1 | python3-core | 0 | 3.6.15-150000.3.150.1 |
| SUSE:Linux Enterprise Micro 5.2 | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Linux Enterprise Micro 5.2 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise Micro 5.3 | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Linux Enterprise Micro 5.3 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise Micro 5.4 | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Linux Enterprise Micro 5.4 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise Micro 5.5 | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Linux Enterprise Micro 5.5 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP5 | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP5 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP6 | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP6 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP6 | python311-core | 0 | 3.11.9-150600.3.3.1 |
| SUSE:Linux Enterprise Module for Development Tools 15 SP5 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise Module for Development Tools 15 SP6 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise Module for Legacy 15 SP5 | python39 | 0 | 3.9.19-150300.4.46.1 |
| SUSE:Linux Enterprise Module for Legacy 15 SP5 | python39-core | 0 | 3.9.19-150300.4.46.1 |
| SUSE:Linux Enterprise Module for Python 3 15 SP6 | python311 | 0 | 3.11.9-150600.3.3.1 |
| SUSE:Linux Enterprise Module for Python 3 15 SP6 | python311-core | 0 | 3.11.9-150600.3.3.1 |
| SUSE:Linux Enterprise Module for Python 3 15 SP6 | python312 | 0 | 3.12.4-150600.3.3.1 |
| SUSE:Linux Enterprise Module for Python 3 15 SP6 | python312-core | 0 | 3.12.4-150600.3.3.1 |
| SUSE:Linux Enterprise Server 12 SP5 | python36 | 0 | 3.6.15-58.1 |
| SUSE:Linux Enterprise Server 12 SP5 | python36-core | 0 | 3.6.15-58.1 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Linux Enterprise Server 15 SP3-LTSS | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise Server 15 SP4-LTSS | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Linux Enterprise Server 15 SP4-LTSS | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | python36 | 0 | 3.6.15-58.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | python36-core | 0 | 3.6.15-58.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP3 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Linux Enterprise Software Development Kit 12 SP5 | python36-core | 0 | 3.6.15-58.1 |
| SUSE:Manager Client Tools 12 | venv-salt-minion | 0 | 3006.0-3.65.1 |
| SUSE:Manager Client Tools 15 | venv-salt-minion | 0 | 3006.0-150000.3.67.1 |
| SUSE:Manager Client Tools for RHEL, Liberty and Clones 9-CLIENT-TOOLS | venv-salt-minion | 0 | 3006.0-1.47.1 |
| SUSE:Manager Client Tools for SLE Micro 5 | venv-salt-minion | 0 | 3006.0-150000.3.67.1 |
| SUSE:Manager Proxy 4.3 | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Manager Proxy 4.3 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Manager Proxy Module 4.3 | venv-salt-minion | 0 | 3006.0-150000.3.67.1 |
| SUSE:Manager Server 4.3 | python3 | 0 | 3.6.15-150300.10.65.2 |
| SUSE:Manager Server 4.3 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| SUSE:Manager Server Module 4.3 | venv-salt-minion | 0 | 3006.0-150000.3.67.1 |
| Ubuntu:20.04:LTS | python2.7 | 0 | No fix |
| Ubuntu:20.04:LTS | python3.8 | 0 | 3.8.10-0ubuntu1~20.04.11 |
| 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.12-1~22.04.5 |
| Ubuntu:22.04:LTS | python3.11 | 0 | No fix |
| Ubuntu:24.04:LTS | python3.12 | 0 | 3.12.3-1 |
| Ubuntu:24.10 | python3.12 | 0 | 3.12.4-1ubuntu1 |
| 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:18.04:LTS | python3.8 | 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 |
| Ubuntu:Pro:22.04:LTS | python3.11 | 0 | No fix |
| openSUSE:Leap 15.5 | python3 | 0 | 3.6.15-150300.10.65.2 |
| openSUSE:Leap 15.5 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| openSUSE:Leap 15.5 | python3-documentation | 0 | 3.6.15-150300.10.65.1 |
| openSUSE:Leap 15.5 | python39 | 0 | 3.9.19-150300.4.46.1 |
| openSUSE:Leap 15.5 | python39-core | 0 | 3.9.19-150300.4.46.1 |
| openSUSE:Leap 15.5 | python39-documentation | 0 | 3.9.19-150300.4.46.1 |
| openSUSE:Leap 15.6 | python3 | 0 | 3.6.15-150300.10.65.2 |
| openSUSE:Leap 15.6 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| openSUSE:Leap 15.6 | python3-documentation | 0 | 3.6.15-150300.10.65.1 |
| openSUSE:Leap 15.6 | python311 | 0 | 3.11.9-150600.3.3.1 |
| openSUSE:Leap 15.6 | python311-core | 0 | 3.11.9-150600.3.3.1 |
| openSUSE:Leap 15.6 | python311-documentation | 0 | 3.11.9-150600.3.3.1 |
| openSUSE:Leap 15.6 | python312 | 0 | 3.12.4-150600.3.3.1 |
| openSUSE:Leap 15.6 | python312-core | 0 | 3.12.4-150600.3.3.1 |
| openSUSE:Leap 15.6 | python312-documentation | 0 | 3.12.4-150600.3.3.1 |
| openSUSE:Leap 15.6 | python39 | 0 | 3.9.19-150300.4.46.1 |
| openSUSE:Leap 15.6 | python39-core | 0 | 3.9.19-150300.4.46.1 |
| openSUSE:Leap 15.6 | python39-documentation | 0 | 3.9.19-150300.4.46.1 |
| openSUSE:Leap Micro 5.3 | python3 | 0 | 3.6.15-150300.10.65.2 |
| openSUSE:Leap Micro 5.3 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| openSUSE:Leap Micro 5.4 | python3 | 0 | 3.6.15-150300.10.65.2 |
| openSUSE:Leap Micro 5.4 | python3-core | 0 | 3.6.15-150300.10.65.1 |
| openSUSE:Tumbleweed | python310 | 0 | 3.10.14-2.1 |
| openSUSE:Tumbleweed | python311 | 0 | 3.11.9-3.1 |
| openSUSE:Tumbleweed | python312 | 0 | 3.12.5-1.1 |
| openSUSE:Tumbleweed | python38 | 0 | 3.8.19-3.1 |
| openSUSE:Tumbleweed | python39 | 0 | 3.9.19-2.1 |
Related vulnerabilities
- CVE-2026-1299 The email module, specifically the "BytesGenerator" class, didn’t properly quote newlines… Also affects libpython
- PSF-2026-8 The email module, specifically the "BytesGenerator" class, didn’t properly quote newlines… Also affects libpython
- CVE-2025-12781 When passing data to the b64decode(), standard_b64decode(), and urlsafe_b64decode()… Also affects libpython
- PSF-2026-7 When passing data to the b64decode(), standard_b64decode(), and urlsafe_b64decode()… Also affects libpython
- CVE-2026-0672 When using http.cookies.Morsel, user-controlled cookie values and parameters can allow… Also affects libpython
- CVE-2026-0865 User-controlled header names and values containing newlines can allow injecting HTTP… Also affects libpython
- CVE-2025-15367 The poplib module, when passed a user-controlled command, can have additional commands… Also affects libpython
- CVE-2025-15366 The imaplib module, when passed a user-controlled command, can have additional commands… Also affects libpython