Skip to main content
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

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).

AI-Powered Analysis

AILast updated: 10/14/2025, 17:10:53 UTC

Technical Analysis

CVE-2024-5642 is a vulnerability identified in CPython versions 3.9 and earlier, including early 3.10 alpha releases, where the SSLContext.set_npn_protocols() method does not properly validate input. Specifically, it allows configuring an empty list ("[]") as the set of Next Protocol Negotiation (NPN) protocols, which is invalid for the underlying OpenSSL API. This improper validation leads to a buffer over-read condition when NPN is used, as the OpenSSL library expects a non-empty list of protocols. The vulnerability stems from CPython passing this empty list unchecked, causing OpenSSL to read beyond allocated memory boundaries. While the impact is limited to confidentiality (due to potential information leakage) and availability (due to possible crashes), integrity is not affected. The Common Vulnerability Scoring System (CVSS) rates this vulnerability at 6.5 (medium severity), with a vector indicating network attack vector, low attack complexity, no privileges or user interaction required, and limited confidentiality and availability impact. NPN itself is a legacy TLS extension largely superseded by ALPN, reducing the practical attack surface. No public exploits have been reported, and the vulnerability requires the use of NPN, which is uncommon in modern deployments. The issue was reserved in early June 2024 and published later that month. No official patches are linked yet, but mitigation involves avoiding empty lists in set_npn_protocols() or upgrading to fixed CPython versions once available.

Potential Impact

For European organizations, the impact of CVE-2024-5642 is moderate but situational. Organizations using CPython 3.9 or earlier in networked applications that leverage SSL/TLS with NPN enabled could experience buffer over-read conditions leading to potential information disclosure or application crashes. This could affect services relying on Python for secure communications, such as web servers, APIs, or internal tools. However, since NPN is deprecated and replaced by ALPN in most modern TLS deployments, the actual exposure is limited. The vulnerability does not require authentication or user interaction, increasing the risk of remote exploitation if NPN is in use. Confidentiality impact is low, but availability could be slightly affected if the buffer over-read causes crashes. The lack of known exploits reduces immediate risk, but organizations should not ignore the vulnerability, especially those in sectors with high security requirements like finance, healthcare, or critical infrastructure. Failure to address this could lead to targeted attacks exploiting legacy systems or misconfigured environments.

Mitigation Recommendations

European organizations should take the following specific actions to mitigate CVE-2024-5642: 1) Audit all Python environments to identify usage of CPython versions 3.9 and earlier, especially in network-facing applications. 2) Review application code and configurations to detect any use of SSLContext.set_npn_protocols() with empty lists and correct these to specify valid protocol names or avoid NPN usage altogether. 3) Plan and execute upgrades to the latest CPython versions where this vulnerability is patched; monitor Python Software Foundation announcements for official patches. 4) Where upgrading is not immediately feasible, consider disabling NPN support in OpenSSL or the application layer to eliminate the attack vector. 5) Implement runtime monitoring and logging to detect anomalous crashes or unusual TLS negotiation failures that could indicate exploitation attempts. 6) Educate developers and DevOps teams about the deprecation of NPN and encourage migration to ALPN for protocol negotiation. 7) Incorporate this vulnerability into vulnerability management and patching workflows to ensure timely remediation. These steps go beyond generic advice by focusing on protocol usage auditing, configuration validation, and proactive migration away from legacy TLS extensions.

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/14/2025, 5:10:53 PM

Last updated: 12/4/2025, 8:41:28 PM

Views: 255

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 require Pro Console access. Upgrade inside Console → Billing.

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