CVE-2024-9287: CPython venv CLI Command Injection via Unquoted Paths
CVE-2024-9287 Published on October 22, 2024
Virtual environment (venv) activation scripts don't quote paths
A vulnerability has been found in the CPython `venv` module and CLI where path names provided when creating a virtual environment were not quoted properly, allowing the creator to inject commands into virtual environment "activation" scripts (ie "source venv/bin/activate"). This means that attacker-controlled virtual environments are able to run commands when the virtual environment is activated. Virtual environments which are not created by an attacker or which aren't activated before being used (ie "./venv/bin/python") are not affected.
Weakness Type
Unquoted Search Path or Element
The product uses a search path that contains an unquoted element, in which the element contains whitespace or other separators. This can cause the product to access resources in a parent path. If a malicious individual has access to the file system, it is possible to elevate privileges by inserting such a file as "C:\Program.exe" to be run by a privileged program making use of WinExec.
Products Associated with CVE-2024-9287
You can be notified by email with stack.watch whenever vulnerabilities like CVE-2024-9287 are published in these products:
Affected Versions
Python Software Foundation CPython:- Before 3.9.21 is affected.
- Version 3.10.0 and below 3.10.16 is affected.
- Version 3.11.0 and below 3.11.11 is affected.
- Version 3.12.0 and below 3.12.8 is affected.
- Version 3.13.0 and below 3.13.1 is affected.
- Version 3.14.0a1 and below 3.14.0a2 is affected.
- Before and including 3.13.0 is affected.
Exploit Probability
EPSS (Exploit Prediction Scoring System) scores estimate the probability that a vulnerability will be exploited in the wild within the next 30 days. The percentile shows you how this score compares to all other vulnerabilities.