banner logoJoin us at RSAC™ 2026 Conference, March 23–March 26 | North Expo, Booth N-5863Join us at RSAC™ 2026, March 23–March 26Learn More
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI Security Portfolio
      Leading the Way in AI-Powered Security Solutions
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      Digital Forensics, IRR & Breach Readiness
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-2297

CVE-2026-2297: CPython Information Disclosure Vulnerability

CVE-2026-2297 is an information disclosure vulnerability in CPython where import hooks fail to trigger sys.audit handlers when reading legacy .pyc files. This article covers technical details, affected versions, and mitigation.

Published: March 6, 2026

CVE-2026-2297 Overview

The import hook in CPython that handles legacy *.pyc files (SourcelessFileLoader) is incorrectly handled in FileLoader (a base class) and does not use io.open_code() to read .pyc files. As a result, sys.audit handlers for this audit event do not fire, allowing potential security monitoring bypass when loading compiled Python bytecode files.

Critical Impact

Security audit mechanisms can be bypassed when loading .pyc files, potentially allowing malicious bytecode execution without triggering security monitoring systems.

Affected Products

  • CPython (multiple versions)
  • Python applications relying on sys.audit for security monitoring
  • Security tools that depend on io.open_code() audit events

Discovery Timeline

  • 2026-03-04 - CVE CVE-2026-2297 published to NVD
  • 2026-03-05 - Last updated in NVD database

Technical Details for CVE-2026-2297

Vulnerability Analysis

This vulnerability stems from an incomplete implementation in CPython's import machinery. The FileLoader base class contains a get_data() method that is responsible for reading file contents. This method was designed to use io.open_code() for certain loader types to ensure that security audit hooks are properly triggered when code files are accessed.

The issue lies in the conditional check within get_data() that determines whether to use io.open_code(). The original implementation only checked for SourceLoader and ExtensionFileLoader instances, but critically omitted SourcelessFileLoader from this check. When SourcelessFileLoader loads a .pyc file, it falls through to a standard file read operation that does not trigger the open_code audit event.

This allows an attacker who can place a malicious .pyc file on the system to have that bytecode loaded and executed without triggering sys.audit handlers that organizations may rely upon for security monitoring and intrusion detection.

Root Cause

The root cause is an incomplete type check in the FileLoader.get_data() method within Lib/importlib/_bootstrap_external.py. The isinstance() check that determines whether to use io.open_code() did not include SourcelessFileLoader in its tuple of loader types, causing .pyc file reads to bypass the secure file opening mechanism.

Attack Vector

An attacker with local access to the system could exploit this vulnerability by placing a malicious .pyc file in a location where it would be imported by a Python application. Since the audit event does not fire for SourcelessFileLoader, security monitoring tools relying on sys.audit hooks would not detect the loading of the malicious bytecode, allowing the attacker to evade detection.

python
# Security patch from CPython repository
# Source: https://github.com/python/cpython/commit/482d6f8bdba9da3725d272e8bb4a2d25fb6a603e

    def get_data(self, path):
        """Return the data from path as raw bytes."""
-        if isinstance(self, (SourceLoader, ExtensionFileLoader)):
+        if isinstance(self, (SourceLoader, SourcelessFileLoader, ExtensionFileLoader)):
            with _io.open_code(str(path)) as file:
                return file.read()
        else:

Detection Methods for CVE-2026-2297

Indicators of Compromise

  • Unexpected .pyc files appearing in Python import paths
  • Python applications loading bytecode without corresponding open_code audit events
  • Gaps in sys.audit logs where .pyc file loads are not recorded
  • Suspicious compiled Python bytecode files in writable directories

Detection Strategies

  • Monitor for .pyc file creation or modification in Python library paths
  • Implement file integrity monitoring for Python installation directories
  • Compare sys.audit logs against actual file system activity to identify gaps
  • Deploy endpoint detection that monitors Python process file access patterns independently of sys.audit

Monitoring Recommendations

  • Enable comprehensive file access logging at the operating system level to supplement Python's audit system
  • Implement hash-based verification of .pyc files before execution
  • Use SentinelOne's behavioral AI to detect anomalous Python bytecode loading patterns
  • Monitor for Python processes accessing .pyc files from unexpected locations

How to Mitigate CVE-2026-2297

Immediate Actions Required

  • Update CPython to a patched version that includes the fix for this vulnerability
  • Review existing .pyc files in your environment for unexpected or suspicious content
  • Restrict write access to directories in Python's import path
  • Consider removing .pyc files and relying solely on source files where feasible

Patch Information

The Python Software Foundation has released patches addressing this vulnerability. The fix modifies the get_data() method in Lib/importlib/_bootstrap_external.py to include SourcelessFileLoader in the isinstance() check, ensuring that .pyc file reads properly use io.open_code() and trigger the appropriate audit events.

Patch commits are available for multiple Python versions:

  • Python 3.13 patch
  • Python 3.14 patch
  • Additional commit

For more details, see the GitHub Issue Report and GitHub Pull Request.

Workarounds

  • Implement operating system-level file access auditing to detect .pyc file loads independently
  • Use mandatory access control (SELinux/AppArmor) to restrict which .pyc files Python can load
  • Remove all .pyc files and configure Python with PYTHONDONTWRITEBYTECODE=1 to prevent bytecode caching
  • Deploy additional security monitoring that does not rely solely on Python's sys.audit mechanism
bash
# Configuration example - Prevent bytecode file creation and remove existing .pyc files
export PYTHONDONTWRITEBYTECODE=1
find /path/to/python/libs -name "*.pyc" -delete
find /path/to/python/libs -type d -name "__pycache__" -exec rm -rf {} +

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeInformation Disclosure

  • Vendor/TechPython

  • SeverityMEDIUM

  • CVSS Score5.7

  • EPSS Probability0.01%

  • Known ExploitedNo
  • CVSS Vector
  • 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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityNone
  • Technical References
  • GitHub Commit Update

  • GitHub Commit Update

  • GitHub Commit Update

  • GitHub Issue Report

  • GitHub Pull Request

  • OpenWall Security List Post
  • Related CVEs
  • CVE-2025-12781: Python base64 Module Data Integrity Flaw

  • CVE-2021-28861: Python Open Redirection Vulnerability

  • CVE-2024-4032: Python ipaddress Module Info Disclosure

  • CVE-2023-40217: Python TLS Information Disclosure Flaw
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • English
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use