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

Published Oct 22, 2024
·
Updated

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.

Other sources

This CVE was automatically created from a reference found in an email or other text. If you are reading this, then this CVE entry is probably erroneous, since this text should be replaced by the official CVE description automatically.

— Launchpad

Virtual environment (venv) activation scripts don't quote paths

— Microsoft

Affected Software

27 affected componentsFixes available
F5 BIG-IP Next SPK>=1.7.0<=1.9.2
F5 BIG-IP Next CNF>=1.1.0<=1.4.0
All of the following
azurelinux/python3<3.9.19-11
3.9.19-11
Microsoft CBL-Mariner=2.0
All of the following
azurelinux/python3<3.12.9-1
3.12.9-1
Microsoft Azure Linux=3.0
Python Python<3.9.21
Python Python>=3.10.0<3.10.16
Python Python>=3.11.0<3.11.11
Python Python>=3.12.0<3.12.8
Python Python>=3.13.0<3.13.1
Python Python=3.14.0-alpha1
alpine/python3<3.11.11-r0
3.11.11-r0
alpine/python3<3.11.11-r0
3.11.11-r0
alpine/python3<3.12.8-r0
3.12.8-r0
alpine/python3<3.12.8-r0
3.12.8-r0
alpine/python3<3.12.8-r0
3.12.8-r0
alpine/python3<3.12.8-r0
3.12.8-r0
alpine/python3<3.12.8-r0
3.12.8-r0
debian/pypy3<7.3.11+dfsg-2+deb12u3
7.3.11+dfsg-2+deb12u3
debian/pypy3<7.3.17+dfsg-3
7.3.17+dfsg-3
debian/pypy3<7.3.17+dfsg-3
7.3.17+dfsg-3
debian/python3.11<3.11.2-6+deb12u5
3.11.2-6+deb12u5
debian/python3.13<3.13.1-1
3.13.1-1
debian/pypy3
7.3.11+dfsg-2+deb12u37.3.19+dfsg-28.0.1+dfsg-1
debian/python3.11
3.11.2-6+deb12u83.11.2-6+deb12u9
debian/python3.13
3.13.5-2+deb13u53.13.18-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade azurelinux/python3 to a version that resolves this vulnerability.

    Fixed in 3.9.19-11
  2. Upgrade

    Upgrade azurelinux/python3 to a version that resolves this vulnerability.

    Fixed in 3.12.9-1
  3. Upgrade

    Upgrade alpine/python3 to a version that resolves this vulnerability.

    Fixed in 3.11.11-r0
  4. Upgrade

    Upgrade alpine/python3 to a version that resolves this vulnerability.

    Fixed in 3.12.8-r0
  5. Upgrade

    Upgrade debian/pypy3 to a version that resolves this vulnerability.

    Fixed in 7.3.11+dfsg-2+deb12u3
  6. Upgrade

    Upgrade debian/pypy3 to a version that resolves this vulnerability.

    Fixed in 7.3.17+dfsg-3
  7. Upgrade

    Upgrade debian/python3.11 to a version that resolves this vulnerability.

    Fixed in 3.11.2-6+deb12u5
  8. Upgrade

    Upgrade debian/python3.13 to a version that resolves this vulnerability.

    Fixed in 3.13.1-1
  9. Upgrade

    Upgrade debian/pypy3 to a version that resolves this vulnerability.

    Fixed in 7.3.11+dfsg-2+deb12u3Fixed in 7.3.19+dfsg-2Fixed in 8.0.1+dfsg-1
  10. Upgrade

    Upgrade debian/python3.11 to a version that resolves this vulnerability.

    Fixed in 3.11.2-6+deb12u8Fixed in 3.11.2-6+deb12u9
  11. Upgrade

    Upgrade debian/python3.13 to a version that resolves this vulnerability.

    Fixed in 3.13.5-2+deb13u5Fixed in 3.13.18-1
  12. Compensating control

    Do not activate virtual environments created by attackers or untrusted sources; invoke the virtual environment interpreter directly instead, such as "./venv/bin/python".

Event History

Oct 22, 2024
CVE Published
via MITRE·04:34 PM
Data Sourced
via MITRE·04:34 PM
DescriptionWeakness
Data Sourced
via OSV·04:34 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·05:15 PM
Affected Software
Oct 24, 2024
Data Sourced
via Red Hat·10:14 AM
DescriptionSeverityAffected Software
Feb 11, 2025
Advisory Published
via F5·11:40 PM
Mar 8, 2025
Data Sourced
via Microsoft·08:00 AM
DescriptionSeverityWeaknessAffected Software

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

What is the severity of CVE-2024-9287?

CVE-2024-9287 has been classified as a high-severity vulnerability due to the potential for command injection.

2

How do I fix CVE-2024-9287?

To remediate CVE-2024-9287, update to the latest version of Python that addresses this vulnerability.

3

Which versions of Python are affected by CVE-2024-9287?

CVE-2024-9287 affects multiple versions of Python including versions prior to 3.10.17, 3.11.11, 3.12.8, and 3.13.1.

4

What type of vulnerability is CVE-2024-9287?

CVE-2024-9287 is a command injection vulnerability due to improper quoting of path names in the CPython venv module.

5

How can I verify if my system is vulnerable to CVE-2024-9287?

You can verify your vulnerability by checking the version of Python installed on your system and comparing it to the affected versions of CVE-2024-9287.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203