Skip to main content

CPython CVE-2026-12003

| EUVDEUVD-2026-37125 MEDIUM
Uncontrolled Search Path Element (CWE-427)
2026-06-16 PSF GHSA-2wqx-fp26-qh5v
5.3
CVSS 4.0 · Vendor: PSF
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Identify target with legacy all-users Python install at default path
  2. Delivery
    Create C:\Modules\Setup.local and trojanized C:\Lib\ as low-privileged user
  3. Exploit
    Wait for privileged user to invoke python.exe (UI:A)
  4. Execution
    VPATH landmark fallback triggers due to absent pybuilddir.txt
  5. Persist
    CPython loads attacker-controlled Lib as sys.path entry
  6. Impact
    Malicious modules execute under privileged context

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A08:2025 - Software or Data Integrity Failures
ASVS 5.0
V13 - Configuration Search path element control
Exploitation Conditions

Exploitation requires all of the following specific, concurrent conditions: (1) CPython must be installed on Windows using the legacy EXE installer in all-users mode at the default path (e.g., C:\Python313\), placing the install such that the directory two levels above it is the OS drive root (C:\), which Windows grants all authenticated users CreateFolder permissions on by default; (2) pybuilddir.txt must be absent from the executable directory, activating the VPATH-based BUILD_LANDMARK fallback in Modules/getpath.py; (3) a low-privileged local account (PR:L per CVSS vector) must be able to create the directory C:\Modules\ and place Setup.local within it before a privileged user runs Python; (4) a user with higher privileges must actively invoke python.exe from the vulnerable install (UI:A per CVSS 4.0 vector). Exploitation is explicitly NOT possible against per-user installs, installs in paths where the grandparent directory has restricted permissions, any install where pybuilddir.txt is already present, or any non-Windows platform. These compounding conditions meaningfully limit realistic attacker opportunity beyond the raw CVSS impact scores.

Impact

The CVSS 4.0 base score of 5.3 accurately reflects the layered constraints: local access is required (AV:L), specific attack preconditions must be present (AT:P - legacy all-users EXE installer at default OS-root-adjacent path), only a low-privileged account is needed (PR:L), and active interaction by a higher-privileged user is required to trigger loading (UI:A). This is not a remotely triggerable flaw and is not listed in CISA KEV. No EPSS score was included in the provided intelligence, limiting probabilistic exploitation forecasting; however, the narrow preconditions - legacy installer, default path, specific Windows directory permission behavior - suggest limited widespread exposure. The high VC:H and VI:H impacts are realistic once conditions are met, since full module substitution grants code execution as the victim user. Real-world priority is moderate: environments still using the legacy all-users EXE installer at default locations represent the materially affected population. Per-user installs and new pymanager-based installs are unaffected. No conflicting signals exist between the CVSS vector and the description.

Exploit ScenarioDerived

A low-privileged user on a Windows system where Python 3.13 is installed for all users via the legacy EXE installer at C:\Python313\ creates the directory C:\Modules\ and places a crafted Setup.local file there, then populates C:\Lib\ with trojanized Python standard library modules. When an administrator or privileged service account subsequently invokes python.exe from that installation - for example, running a scheduled maintenance script - CPython's VPATH-based fallback landmark detection triggers (because pybuilddir.txt is absent), causing the interpreter to discover and load from the attacker-controlled C:\Lib\ directory, executing arbitrary code under the victim's elevated privileges. No public exploit code has been identified at time of analysis.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 16, 2026

Privilege escalation in CPython on Windows enables a low-privileged local user to hijack the module search path of a more-privileged Python process running from a legacy all-users installation, enabling arbitrary code execution under an elevated context. The root cause is a VPATH-based fallback landmark mechanism compiled into release builds: on Windows, VPATH resolves two directory levels above PCbuild/, placing the Modules/Setup.local landmark outside the install directory in a location writable by unprivileged users under the legacy EXE installer's default all-users path. No public exploit identified at time of analysis, and the vulnerability is not listed in CISA KEV; however, high confidentiality and integrity impact (VC:H/VI:H) reflect the ability to fully substitute Python's module loading path.

RemediationAI

The upstream fix is available as PR https://github.com/python/cpython/pull/151545, which removes the VPATH-based BUILD_LANDMARK fallback from Modules/getpath.py and ensures pybuilddir.txt is the sole source-tree indicator; updated legacy installers will be released for Python 3.13 and 3.14 only. Users on earlier versions must apply the source patch and rebuild. The vendor's primary recommended mitigation is to migrate from the legacy EXE installer to the new Python install manager (https://www.python.org/downloads/latest/pymanager/), which defaults to per-user installation and eliminates the vulnerable directory permission model entirely. As a compensating control before migration, administrators can preemptively create the directory two levels above the Python installation (e.g., C:\Modules\ for an install at C:\Python313\) and apply restrictive ACLs preventing unprivileged users from writing there; this blocks the attacker from placing the landmark but must be applied before any attacker creates the directory, and requires knowing the exact install path for each Python version. Alternatively, restricting non-admin write access to the OS drive root (C:\) removes the underlying Windows permission that enables the attack, though this may break legacy application compatibility that depends on drive-root writability.

Affected VersionsENISA

CPython 0 <3.15.0

Affected Packages

euvd cpython fix: 3.15.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

CPython's path initialization subsystem (Modules/getpath.py) uses two ordered mechanisms to determine whether the interpreter is running from a source tree: a primary landmark file pybuilddir.txt, and a fallback BUILD_LANDMARK resolving to Modules/Setup.local via the VPATH compile-time variable. On Windows, VPATH is set to '..\..' relative to the PCbuild/ output directory, so the fallback landmark resolves two directories above the python.exe install location. Under the legacy EXE all-users installer (historically defaulting to C:\PythonXY\), this places the landmark at C:\Modules\Setup.local - on the root of the OS drive, where Windows grants all authenticated users the CreateFolder permission by default. CWE-427 (Uncontrolled Search Path Element) precisely characterizes the flaw: the application incorporates an externally controllable path element (VPATH-derived) when locating trusted resources, allowing an adversary to redirect the interpreter's module discovery. The CPE cpe:2.3:a:python_software_foundation:cpython:*:*:*:*:*:*:*:* covers all CPython versions, though practical exploitation is confined to Windows legacy all-users installs. The fix confirmed in upstream PR #151545 removes the BUILD_LANDMARK fallback entirely from Modules/getpath.py and adds a dummy pybuilddir.txt in Makefile.pre.in, making the primary landmark the sole source-tree indicator.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (PSF) PRIMARY 5.3 MEDIUM
CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:A/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N
vuln.today AI 7.2 HIGH

Requires legacy all-users install at OS-root-adjacent default path (AC:H), low-privileged local account (AV:L, PR:L), and a privileged user must actively run Python (UI:R), with scope change enabling code execution as that user (S:C).

3.1 AV:L/AC:H/PR:L/UI:R/S:C/C:H/I:H/A:N
4.0 AV:L/AC:L/AT:P/PR:L/UI:A/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N
Red Hat 7.8 HIGH

Primary rating from Vendor (PSF).

CVSS VectorVendor: PSF

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
Low
User Interaction
Active
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
None
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

DescriptionCVE.org

To allow builds of Python to be run from an in-tree layout (rather than an installed file layout), the VPATH variable is defined at build time and used to locate certain landmarks - specifically, Modules/setup.local. When this landmark is found relative to VPATH relative to the executable, Python assumes it is running in a source tree and generates a different default sys.path. This code remains in release builds, so that release-ready builds can be built in-tree.

On Windows, since builds are written to 'PCbuild/', the value of VPATH is set to '..\..', which results in a landmark of '..\..\Modules\setup.local'. This path is outside the install directory of Python, and may have different permissions, potentially allowing a low-privilege user to create the landmark and an alternative Lib folder that will be discovered by an otherwise restricted install.

Such a setup occurs with the legacy default install location for all users (in the now superseded EXE installer), due to how Windows allows all users to create folders in the root directory of their OS drive.

Our recommended mitigation on Windows is to migrate away from the legacy installer and use the new Python install manager to install for the current user. Installs where the directory two levels above the Python installation directory have equivalent permissions are unaffected (in general, a per-user install cannot be modified at all by other users, removing any escalation of privilege risk, and could be directly modified by a privileged user, making the potential tampering irrelevant). Alternative mitigations might include preemptively creating and restricting access to a Modules directory. Be aware that only 3.13 and 3.14 will receive updated legacy installers - earlier fixes are only provided as sources.

Platforms other than Windows allow VPATH to be overridden, but as they don't usually use a separated directory in the build for binaries, are unlikely to have a landmark reference outside of the install directory.

The landmark detection involving VPATH is a fallback for when a more specific landmark - .\pybuilddir.txt - is absent, and was included for compatibility. Future releases of Python will no longer include the fallback, and so builds will need to generate or preserve the pybuilddir.txt file in order to work in-tree. This landmark file has been generated on Windows since 3.11, and on other platforms for longer.

Threat Intelligence Overview

EPSS Score
0.1%
Top 97% exploitable
Social Media
1
Sightings
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment MSRC Vendor CIRCL GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Medium
Technical Impact
Total

Priority Score

26
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +26
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Privilege escalation occurs when an attacker leverages flaws in access control mechanisms to gain permissions beyond what they were originally granted.

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy