Skip to main content

CPython CVE-2026-2297

MEDIUM
Exposure of Resource to Wrong Sphere (CWE-668)
2026-03-04 cna@python.org
5.7
CVSS 4.0 · Vendor: python
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Gain local low-privilege access
  2. Delivery
    Write malicious .pyc to Python import path
  3. Exploit
    Trigger application import of sourceless .pyc
  4. Execution
    SourcelessFileLoader loads file without io.open_code()
  5. Persist
    sys.audit hooks do not fire
  6. Impact
    Malicious bytecode executes undetected

Vulnerability Assessment

Weakness
CWE
MITRE ATT&CK

1 technique across 1 tactic: Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires three concurrent conditions: (1) the attacker must have local system access with at least low privileges sufficient to write a .pyc file to a location on the Python import path; (2) the target environment must have sys.audit hooks registered for the 'open' event or related file-load events as a security enforcement mechanism - environments without audit hooks are not meaningfully impacted; (3) the application must actually trigger a SourcelessFileLoader import of the attacker-influenced .pyc file, meaning the application must load sourceless precompiled modules during a relevant execution path. Remote unauthenticated exploitation is not applicable - the CVSS 4.0 vector is strictly AV:L. Standard CPython deployments lacking custom PEP 578 audit hooks experience the audit bypass as a latent defect with no exploitable security consequence.

Impact

The CVSS 4.0 vector (AV:L/AC:L/AT:P/PR:L/VI:H) assigns local attack vector and low complexity once access is established, but the AT:P qualifier (attack requires pre-conditions) is critical: the high integrity impact is only realized in environments that have deployed sys.audit hooks as a security enforcement mechanism. Environments without audit hooks experience the same code path but face no meaningful security consequence, since there is no control to bypass. EPSS at 0.02% (3rd percentile) confirms near-zero likelihood of automated or widespread exploitation. KEV status is absent - no active exploitation is confirmed. The vulnerability is best characterized as a targeted security-control bypass requiring local access, low privileges, and a specifically hardened Python deployment; raw CVSS scores overstate risk for the majority of unaudited environments. The existence of five separate branch-specific backport commits indicates broad version coverage but also reflects vendor urgency consistent with defense-in-depth patching rather than emergency response.

Exploit ScenarioDerived

A local attacker with low-privilege access plants a malicious .pyc file in a directory on the Python import path. When the target application imports a module that resolves to the malicious .pyc via SourcelessFileLoader, io.open_code() is never invoked, so any sys.audit hook monitoring or blocking unauthorized file loads does not fire. The malicious bytecode executes with the privileges of the Python process, undetected by the audit framework.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv2 – Jul 24, 2026

CPython's import subsystem silently bypasses sys.audit security hooks when loading legacy precompiled .pyc files via SourcelessFileLoader, because the base class FileLoader omits SourcelessFileLoader from the isinstance check that gates calls to io.open_code(). Environments relying on PEP 578 audit hooks for security monitoring or enforcement are therefore blind to .pyc file loads through this path, allowing unauthorized bytecode to execute without triggering registered handlers. No public exploit has been identified at time of analysis and EPSS is negligible (0.02%, 3rd percentile), but the CVSS 4.0 vector assigns VI:H reflecting the integrity consequence of bypassing an active security control.

Earlier versions of this analysis (1)
v1 Mar 12, 2026 - 22:05

The import hook in CPython that handles legacy *.pyc files (SourcelessFileLoader) is incorrectly handled in FileLoader (a base class) and so does not use io.open_code() to read the .pyc files. sys.audit handlers for this audit event therefore do not fire.

RemediationAI

The primary fix is to upgrade CPython to a version incorporating the upstream patches, available in the CPython repository via commits 482d6f8bdba9, a51b1b512de1, e58e9802b9be, 69ddd9bb2cc4, and 876858c9f65d (https://github.com/python/cpython/pull/145507). Red Hat users should apply whichever of RHSA-2026:10950, RHSA-2026:7443, RHSA-2026:7661, RHSA-2026:8822, or RHSA-2026:8824 corresponds to their platform (https://access.redhat.com/errata/). SUSE users should apply SUSE-SU-2026:0971 (https://www.suse.com/support/update/SUSE-SU-2026:0971/). Where immediate patching is not feasible and audit hooks are in use for security enforcement, a targeted compensating control is to replace or wrap SourcelessFileLoader with a custom loader that calls io.open_code() explicitly before delegating to the parent; this preserves audit semantics without disabling .pyc imports entirely. Disabling .pyc imports entirely is an option only if the application does not depend on sourceless bytecode distribution, and carries a performance trade-off from always recompiling from source.

Affects your stack

Find out whether the stacks and servers you run are on an affected version.

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The flaw resides in Lib/importlib/_bootstrap_external.py, specifically in FileLoader - the abstract base class for CPython's file-based module loaders. SourcelessFileLoader is the concrete loader used to import precompiled .pyc bytecode files that have no corresponding .py source counterpart. FileLoader.get_filename() contains an isinstance guard that determines whether to call io.open_code() (the audited file-open function introduced by PEP 578), but prior to the fix that guard tested only for SourceLoader and ExtensionFileLoader, leaving SourcelessFileLoader uncovered. The fix (commit 482d6f8) adds SourcelessFileLoader to the isinstance tuple, restoring the audit event for all loader types. CWE-668 (Exposure of Resource to Wrong Sphere) accurately describes the root cause: the .pyc resource enters the runtime through an unaudited channel, sidestepping the security boundary that io.open_code() was designed to enforce.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (python) PRIMARY 5.7 MEDIUM
CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N
vuln.today AI 4.7 MEDIUM

Local vector with AC:H captures the AT:P pre-condition (audit hooks must be deployed); PR:L reflects minimum local privileges; I:H for security-control bypass enabling unauthorized code execution.

3.1 AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N
4.0 AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N
SUSE 5.5 MEDIUM
AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N
Red Hat 3.3 LOW

Primary rating from Vendor (python).

CVSS VectorVendor: python

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
Low
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
High
Vulnerable system: Availability
None
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

3
CVSS changed
May 01, 2026 - 16:22 NVD
5.7 (MEDIUM)
CVE Published
Mar 04, 2026 - 23:16 cve.org
MEDIUM 5.7
CVE Published
Mar 04, 2026 - 23:16 nvd
N/A

DescriptionCVE.org

The import hook in CPython that handles legacy *.pyc files (SourcelessFileLoader) is incorrectly handled in FileLoader (a base class) and so does not use io.open_code() to read the .pyc files. sys.audit handlers for this audit event therefore do not fire.

Threat Intelligence Overview

EPSS Score
0.0%
Top 97% exploitable
Prevalence
Ubiquitous
CPython installed on virtually every Linux, macOS, and cloud workload
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Small
Automatable· derived
No
Human Impact· derived
High

Priority Score

28
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +28
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

Affected Products (CPE)CVE.org

cpe:2.3:a:python:python:*:*:*:*:*:*:*:*
cpe:2.3:a:python:python:*:*:*:*:*:*:*:*
cpe:2.3:a:python:python:*:*:*:*:*:*:*:*
cpe:2.3:a:python:python:*:*:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha1:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha2:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha3:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha4:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha5:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha6:*:*:*:*:*:*

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

Vendor StatusVendor

SUSE

Severity: Medium
Product Status
Container suse/multi-linux-manager/5.1/x86_64/proxy-salt-broker:5.1.3.9.16.1 Container suse/multi-linux-manager/5.1/x86_64/server:5.1.3.8.16.1 Image SLES15-SP6 Image SLES15-SP6-EC2 Image SLES15-SP6-EC2-ECS-HVM Image SLES15-SP6-SAP Image SLES15-SP6-SAP-EC2 Image SLES15-SP6-SAPCAL Image SLES15-SP6-SAPCAL-EC2 Image SLES15-SP7-Azure-3P Image SLES15-SP7-Azure-Basic Image SLES15-SP7-Azure-Standard Image SLES15-SP7-BYOS-Azure Image SLES15-SP7-BYOS-EC2 Image SLES15-SP7-BYOS-GCE Image SLES15-SP7-EC2 Image SLES15-SP7-EC2-ECS-HVM Image SLES15-SP7-Hardened-BYOS-Azure Image SLES15-SP7-Hardened-BYOS-EC2 Image SLES15-SP7-Hardened-BYOS-GCE Image SLES15-SP7-SAPCAL-Azure Image SLES15-SP7-SAPCAL-EC2 Affected
Container suse/multi-linux-manager/5.1/x86_64/server-saline:5.1.3.9.16.1 Affected
Container suse/sl-micro/6.0/baremetal-os-container:2.1.3-6.112 Image SLE-Micro Image SLE-Micro-Azure Image SLE-Micro-BYOS Image SLE-Micro-BYOS-Azure Image SLE-Micro-BYOS-EC2 Image SLE-Micro-BYOS-GCE Image SLE-Micro-EC2 Image SLE-Micro-GCE Affected
Container suse/sl-micro/6.0/toolbox:latest Affected
Container suse/sl-micro/6.1/baremetal-os-container:2.2.1-7.81 Image SUSE-Multi-Linux-Manager-Proxy-BYOS-EC2 Image SUSE-Multi-Linux-Manager-Server-BYOS-EC2 Affected

References

Advisories & patches
ADVISORY https://access.redhat.com/errata/RHSA-2026:10950 ADVISORY https://access.redhat.com/errata/RHSA-2026:7443 ADVISORY https://access.redhat.com/errata/RHSA-2026:7661 ADVISORY https://access.redhat.com/errata/RHSA-2026:8822 ADVISORY https://access.redhat.com/errata/RHSA-2026:8824 ADVISORY https://ubuntu.com/security/notices/USN-8509-1 ADVISORY https://vuldb.com/vuln/348840 ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:0971/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:1062/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:1107/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:1117/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:1349/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:1354/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:20951/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:20956/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:21104/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:21178/ REF http://www.openwall.com/lists/oss-security/2026/03/05/6 REF https://github.com/python/cpython/commit/482d6f8bdba9da3725d272e8bb4a2d25fb6a603e REF https://github.com/python/cpython/commit/69ddd9bb2cc4bd69b1565647c18659c6a789ccd9 REF https://github.com/python/cpython/commit/876858c9f65d9ab656c7fa639f268ce7856d89dd REF https://github.com/python/cpython/commit/a51b1b512de1d56b3714b65628a2eae2b07e535e REF https://github.com/python/cpython/commit/c70adad78caeeea33f92f560ecb93331ca11bf66 REF https://github.com/python/cpython/commit/e58e9802b9bec5cdbf48fc9bf1da5f4fda482e86 REF https://github.com/python/cpython/issues/145506 REF https://github.com/python/cpython/pull/145507

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy