Skip to main content
EPSS 0.6%top 51%

Python: Virtual environment (venv) activation scripts don't quote paths (CVE-2024-9287)

0
Medium
Published: 12/13/2024 (12/13/2024, 12:39:42 UTC)
Source: GCVE Database
Product: python

Description

CVE-2024-9287 is a vulnerability in the Python CPython venv module where activation scripts do not properly quote path names. This allows an attacker who creates a malicious virtual environment to inject commands that execute when the environment is activated using the 'source venv/bin/activate' command. Virtual environments created by trusted users or those used without activation (e.g., directly invoking the Python binary) are not affected. The issue affects multiple Python versions from 3.6.8 through versions prior to fixed releases in 3.9.21, 3.10.16, 3.11.11, 3.12.8, and 3.13.1. A patch is available and has been issued by Red Hat and other vendors. The severity is assessed as medium.

Affected software

Affected versions
>=3.6.8 <=3.6.8<3.9.21>=3.10.0 <3.10.16>=3.11.0 <3.11.11>=3.12.0 <3.12.8>=3.13.0 <3.13.1

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 09/08/2026, 15:12:18 UTC

Technical Analysis

The vulnerability CVE-2024-9287 in the CPython venv module arises because activation scripts generated during virtual environment creation do not properly quote path names. This improper quoting allows command injection when the virtual environment is activated via the standard 'source venv/bin/activate' shell command. An attacker who can create a virtual environment can embed malicious commands that execute upon activation. This does not affect virtual environments that are not activated or those created by trusted users. The issue affects Python versions including 3.6.8, all versions prior to 3.9.21, versions from 3.10.0 up to but not including 3.10.16, 3.11.0 up to 3.11.11, 3.12.0 up to 3.12.8, and 3.13.0 up to 3.13.1. Red Hat has issued a security advisory (RHSA-2024:10779) with patches for affected Python packages. No known exploits in the wild have been reported.

Potential Impact

An attacker able to create a virtual environment on a system can inject arbitrary commands into the activation scripts. These commands execute when a user activates the virtual environment using 'source venv/bin/activate'. This could lead to execution of unauthorized commands under the user's context. However, virtual environments not activated or created by attackers are not affected. There are no reports of active exploitation in the wild.

Mitigation Recommendations

A patch is available and should be applied to affected Python versions. Red Hat has released updated packages addressing this vulnerability. Users should update their Python installations to fixed versions as indicated by their vendor advisories. Avoid activating virtual environments created by untrusted sources until patched. Since a fix is available, remediation by applying official updates is the recommended course of action.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Csaf Category
csaf_security_advisory
Csaf Version
2.0
Publisher
Red Hat Product Security
Advisory Id
RHSA-2024:10779
Cve Count
2
Additional Cves
["CVE-2024-11168"]

Threat ID: 6a3da2014853345fc1837183

Added to database: 06/25/2026, 21:47:45 UTC

Last enriched: 09/08/2026, 15:12:18 UTC

Last updated: 09/10/2026, 19:24:55 UTC

Views: 54

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.

Need more coverage?

Upgrade to Pro Console 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