Skip to main content
DashboardThreatsMapFeedsAPI
reconnecting
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2024-5642: Vulnerability in Python Software Foundation CPython

0
Medium
VulnerabilityCVE-2024-5642cvecve-2024-5642
Published: Thu Jun 27 2024 (06/27/2024, 21:05:31 UTC)
Source: CVE Database V5
Vendor/Project: Python Software Foundation
Product: CPython

Description

CVE-2024-5642 is a medium severity vulnerability in CPython 3. 9 and earlier where configuring an empty list for SSLContext. set_npn_protocols() leads to a buffer over-read due to invalid interaction with the underlying OpenSSL API. This issue arises because CPython does not disallow an empty list, which is not a typical configuration. The vulnerability impacts confidentiality slightly and availability minimally, with no integrity impact. It requires no privileges or user interaction and can be exploited remotely over the network. The threat is limited by the uncommon use of NPN (Next Protocol Negotiation) and the rarity of setting an empty protocol list. European organizations using affected CPython versions in network-facing applications that utilize NPN could be exposed. Mitigation involves upgrading CPython to versions that enforce valid protocol lists or applying patches once available, and auditing code to avoid empty NPN protocol configurations. Countries with significant Python usage in critical infrastructure and technology sectors, such as Germany, France, the UK, and the Netherlands, are more likely to be affected.

AI-Powered Analysis

AILast updated: 10/07/2025, 16:45:27 UTC

Technical Analysis

CVE-2024-5642 is a vulnerability identified in CPython versions 3.9 and earlier, related to the handling of the SSLContext.set_npn_protocols() method. This method allows configuration of Next Protocol Negotiation (NPN) protocols for SSL/TLS connections. The vulnerability occurs because CPython does not prevent an empty list ("[]") from being set as the NPN protocols, which is invalid for the underlying OpenSSL API. When an empty list is configured, it causes a buffer over-read condition in OpenSSL (linked to CVE-2024-5535), potentially leading to information disclosure or application instability. NPN is a TLS extension used to negotiate the protocol (e.g., HTTP/2) during the TLS handshake, but it is not widely adopted, having been largely superseded by ALPN (Application-Layer Protocol Negotiation). The vulnerability has a CVSS 3.1 base score of 6.5 (medium severity), reflecting network attack vector, low attack complexity, no privileges or user interaction required, and limited confidentiality and availability impact. There is no known exploitation in the wild at this time. The flaw primarily affects applications that use CPython’s SSL module with NPN enabled and configure an empty protocol list, which is an uncommon scenario. The issue can lead to a buffer over-read, which might expose sensitive memory contents or cause a denial of service due to application crashes. The vulnerability was reserved in early June 2024 and published later that month, with no patches currently linked, indicating that users should monitor for updates from the Python Software Foundation. This vulnerability highlights the importance of input validation in security-sensitive APIs and the risks of legacy protocol support in cryptographic libraries.

Potential Impact

For European organizations, the impact of CVE-2024-5642 is moderate but context-dependent. Organizations running Python-based applications that utilize SSL/TLS with NPN enabled and that might inadvertently configure empty protocol lists could face confidentiality risks due to buffer over-reads exposing memory contents. Availability could also be affected if the buffer over-read causes application crashes or service disruptions. However, since NPN is not widely used and empty lists are unlikely to be configured in practice, the overall risk is limited. Critical infrastructure, financial services, and technology companies that rely heavily on Python for network services or automation could be more exposed, especially if they have legacy systems or custom SSL configurations. The vulnerability does not affect integrity and requires no authentication or user interaction, making remote exploitation feasible but constrained by the uncommon triggering conditions. The lack of known exploits in the wild reduces immediate risk but does not eliminate the need for vigilance. Organizations should assess their use of CPython SSL features and consider the potential for indirect impacts on dependent services and supply chains.

Mitigation Recommendations

To mitigate CVE-2024-5642, European organizations should: 1) Upgrade CPython to the latest supported versions where this vulnerability is addressed or where input validation for SSLContext.set_npn_protocols() is enforced. 2) Audit codebases and configurations to ensure that empty lists are not passed to set_npn_protocols(), and avoid using NPN where possible, favoring ALPN instead. 3) Monitor Python Software Foundation and OpenSSL advisories for patches and apply them promptly once available. 4) Implement runtime monitoring and anomaly detection for unexpected SSL/TLS handshake behaviors that could indicate exploitation attempts. 5) Conduct security testing on Python applications that use SSL/TLS to identify and remediate unsafe protocol configurations. 6) For critical systems, consider network segmentation and limiting exposure of vulnerable services to reduce attack surface. 7) Educate developers and system administrators about the risks of legacy TLS extensions and the importance of secure protocol negotiation configurations. These steps go beyond generic advice by focusing on code audit, configuration hygiene, and proactive monitoring specific to the vulnerability’s nature.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
PSF
Date Reserved
2024-06-04T18:40:21.539Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 68e54032a677756fc996bc83

Added to database: 10/7/2025, 4:30:42 PM

Last enriched: 10/7/2025, 4:45:27 PM

Last updated: 10/7/2025, 7:47:42 PM

Views: 166

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats