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-2026-2297: Vulnerability in Python Software Foundation CPython

0
Medium
VulnerabilityCVE-2026-2297cvecve-2026-2297
Published: Wed Mar 04 2026 (03/04/2026, 22:10:43 UTC)
Source: CVE Database V5
Vendor/Project: Python Software Foundation
Product: CPython

Description

CVE-2026-2297 is a medium severity vulnerability in the Python Software Foundation's CPython implementation. The issue lies in the import hook mechanism that handles legacy . pyc files via SourcelessFileLoader and its base class FileLoader. Specifically, FileLoader does not use io. open_code() when reading . pyc files, causing sys. audit events related to this operation to not trigger. This bypass of audit logging could allow attackers with limited privileges to evade detection when manipulating or loading malicious . pyc files. The vulnerability requires local access with low privileges and partial authentication, but no user interaction.

AI-Powered Analysis

AILast updated: 03/04/2026, 22:32:54 UTC

Technical Analysis

CVE-2026-2297 is a vulnerability discovered in the CPython interpreter's import system, specifically affecting the handling of legacy compiled Python files (.pyc). The import hook mechanism uses a class called SourcelessFileLoader to load these .pyc files. However, the base class FileLoader, which is responsible for reading the .pyc files, does not utilize the recommended io.open_code() function to open these files. io.open_code() is designed to properly handle source code files and trigger sys.audit events, which are part of Python's auditing framework used to monitor and log security-relevant operations. Because FileLoader bypasses io.open_code(), the corresponding sys.audit events for reading .pyc files do not fire, effectively disabling audit logging for this operation. This gap can be exploited by an attacker with low-level privileges who can place or manipulate .pyc files to execute malicious code without triggering audit logs, reducing the chance of detection. The vulnerability has a CVSS 4.0 score of 5.7, indicating medium severity. It requires local access with partial authentication and no user interaction, and it impacts confidentiality and integrity by enabling stealthy code execution. No known exploits have been reported in the wild, and no official patches have been linked yet. The vulnerability affects all versions of CPython as indicated, though the exact affected versions are not detailed beyond the placeholder '0'.

Potential Impact

The primary impact of CVE-2026-2297 is the potential for attackers with limited local access to evade audit detection when loading or manipulating legacy .pyc files in Python environments. This can facilitate stealthy execution of malicious code, undermining system integrity and potentially confidentiality if sensitive operations are performed by the malicious code. Organizations relying heavily on Python for automation, web services, or internal tools may face increased risk of undetected compromise. The lack of audit logging reduces the ability of security teams to detect suspicious import activity, delaying incident response. While the vulnerability does not directly allow remote exploitation or privilege escalation, it can be a component in a larger attack chain. The medium severity rating reflects the moderate difficulty of exploitation and the limited scope requiring local access. However, given Python's widespread use in enterprise and cloud environments, the potential impact on operational security and trustworthiness of Python-based systems is significant.

Mitigation Recommendations

To mitigate CVE-2026-2297, organizations should: 1) Monitor official Python Software Foundation channels for patches or updates addressing this vulnerability and apply them promptly once available. 2) Implement enhanced monitoring of file system changes, especially for .pyc files, using host-based intrusion detection systems or file integrity monitoring tools to detect unauthorized modifications. 3) Restrict local access to systems running Python to trusted users only, minimizing the risk of unauthorized .pyc file manipulation. 4) Employ additional auditing mechanisms outside of Python's sys.audit framework, such as OS-level auditing or third-party security agents, to capture suspicious file access or execution events. 5) Review and harden Python import paths and environment configurations to prevent loading of untrusted or legacy .pyc files. 6) Educate developers and system administrators about the risks of legacy .pyc files and encourage use of updated Python versions and secure coding practices. 7) Consider disabling legacy .pyc file support if not required, or using containerization and sandboxing to limit the impact of potential exploitation. These steps go beyond generic advice by focusing on compensating controls and proactive detection until an official patch is released.

Need more detailed analysis?Upgrade to Pro Console

Technical Details

Data Version
5.2
Assigner Short Name
PSF
Date Reserved
2026-02-10T16:26:08.298Z
Cvss Version
4.0
State
PUBLISHED

Threat ID: 69a8afacd1a09e29cb7ac729

Added to database: 3/4/2026, 10:18:20 PM

Last enriched: 3/4/2026, 10:32:54 PM

Last updated: 3/4/2026, 11:23:50 PM

Views: 5

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 more coverage?

Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses