The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • 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
      DFIR, Breach Readiness, & Compromise Assessments
    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
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • 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-2024-9287

CVE-2024-9287: Python venv RCE Vulnerability

CVE-2024-9287 is a remote code execution flaw in Python's venv module where improper path quoting allows attackers to inject commands into activation scripts. This article covers technical details, affected versions, and mitigation.

Published: January 28, 2026

CVE-2024-9287 Overview

A command injection vulnerability has been discovered in the CPython venv module and CLI where path names provided when creating a virtual environment were not quoted properly. This allows an attacker who controls the virtual environment creation process to inject arbitrary commands into virtual environment activation scripts (e.g., source venv/bin/activate). When a user subsequently activates the malicious virtual environment, the injected commands execute with the user's privileges.

Critical Impact

Attacker-controlled virtual environments can execute arbitrary commands when activated, potentially leading to code execution on developer workstations or CI/CD systems.

Affected Products

  • Python (multiple versions prior to patched releases)
  • Python 3.14.0 alpha1
  • Systems using CPython's venv module for virtual environment management

Discovery Timeline

  • October 22, 2024 - CVE-2024-9287 published to NVD
  • November 3, 2025 - Last updated in NVD database

Technical Details for CVE-2024-9287

Vulnerability Analysis

This vulnerability stems from improper handling of path names within the CPython venv module. When a virtual environment is created using a path that contains shell metacharacters or special characters, these characters are not properly escaped or quoted in the generated activation scripts. The activation scripts (activate, activate.csh, activate.fish, etc.) are shell scripts that set up environment variables and modify the PATH to use the virtual environment's Python interpreter.

The vulnerability specifically affects scenarios where an attacker can control or influence the directory path used to create a virtual environment. This is particularly relevant in scenarios involving:

  • Downloading and extracting projects from untrusted sources
  • Automated CI/CD pipelines processing external repositories
  • Development environments where paths may be influenced by user input

Importantly, virtual environments that are used without activation (e.g., directly invoking ./venv/bin/python) are not affected by this vulnerability.

Root Cause

The root cause is classified under CWE-428 (Unquoted Search Path or Element) and CWE-77 (Command Injection). The venv module failed to properly quote or escape the virtual environment path when writing it into the activation shell scripts. This creates an opportunity for shell command injection when the path contains characters with special meaning to the shell, such as backticks, semicolons, or $() constructs.

Attack Vector

The attack requires local access and involves creating a maliciously crafted virtual environment with a specially constructed path name. When an unsuspecting user activates this virtual environment using the standard source venv/bin/activate command, the injected commands execute in the context of the user's shell session.

Attack scenarios include:

  • An attacker providing a malicious project repository with a pre-created virtual environment
  • Supply chain attacks where build scripts create virtual environments using attacker-influenced paths
  • Shared development environments where one user can influence paths used by others

The attack requires some level of privilege to create the malicious virtual environment and depends on user interaction to activate it.

Detection Methods for CVE-2024-9287

Indicators of Compromise

  • Unusual characters in virtual environment directory paths, particularly shell metacharacters like backticks, $(), semicolons, or pipes
  • Activation scripts (activate, activate.csh, activate.fish) containing unexpected command sequences
  • Unexpected process spawning when activating virtual environments
  • Virtual environment paths containing encoded or obfuscated shell commands

Detection Strategies

  • Monitor file system events for virtual environment creation in directories with suspicious path names
  • Implement static analysis of activation scripts before sourcing them to detect injected commands
  • Review virtual environment paths in repositories and CI/CD pipelines for shell metacharacters
  • Use endpoint detection to identify unusual process trees originating from shell activation scripts

Monitoring Recommendations

  • Enable logging for shell script execution in development and build environments
  • Monitor for process creation events following virtual environment activation
  • Implement code review policies for any committed virtual environment directories
  • Configure SentinelOne to alert on suspicious command execution patterns from Python-related directories

How to Mitigate CVE-2024-9287

Immediate Actions Required

  • Upgrade Python to a patched version that properly quotes path names in activation scripts
  • Audit existing virtual environments, especially those from untrusted sources, for suspicious activation scripts
  • Avoid activating virtual environments from untrusted projects; instead, invoke the interpreter directly using ./venv/bin/python
  • Review CI/CD pipelines to ensure virtual environment paths are controlled and validated

Patch Information

The Python Software Foundation has released patches across multiple Python version branches. The fix ensures proper quoting of path names in virtual environment activation scripts. Relevant commits include:

  • GitHub Commit 633555735
  • GitHub Commit 8450b248
  • GitHub Commit 9286ab3a
  • GitHub Commit ae961ae9
  • GitHub Commit d48cc82e
  • GitHub Commit e52095a0

For additional details, see the Python Security Announcement and GitHub Pull Request #124712.

Linux distributions have also released updates, including Debian LTS announcements for November and December 2024.

Workarounds

  • Use direct Python interpreter invocation (./venv/bin/python script.py) instead of activating virtual environments from untrusted sources
  • Manually inspect activation scripts before sourcing them to verify they contain no injected commands
  • Create virtual environments only in trusted, controlled directory paths without special characters
  • Implement repository policies to prevent committing virtual environment directories
bash
# Safe usage without activation
# Instead of: source venv/bin/activate && python script.py
# Use direct invocation:
./venv/bin/python script.py

# Verify activation script contents before use
cat venv/bin/activate | grep -E '[\`\$\(\);|&]'

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

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechPython

  • SeverityMEDIUM

  • CVSS Score5.3

  • EPSS Probability0.06%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:4.0/AV:L/AC:L/AT:P/PR:H/UI:A/VC:H/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:Green
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityNone
  • CWE References
  • CWE-428

  • CWE-77
  • Technical References
  • GitHub Issue #124651

  • Debian LTS Announcement November 2024

  • Debian LTS Announcement December 2024

  • NetApp Security Advisory ntap-20250425-0006
  • Vendor Resources
  • GitHub Commit 633555735

  • GitHub Commit 8450b248

  • GitHub Commit 9286ab3a

  • GitHub Commit ae961ae9

  • GitHub Commit d48cc82e

  • GitHub Commit e52095a0

  • GitHub Pull Request #124712

  • Python Security Announcement
  • Related CVEs
  • CVE-2025-15366: Python imaplib Module RCE Vulnerability

  • CVE-2021-3177: Python Buffer Overflow RCE Vulnerability

  • CVE-2020-27619: Python RCE Vulnerability via eval()

  • CVE-2020-15801: Python 3.8.4 RCE Vulnerability
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
  • 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

English