Skip to main content
Mallory
Medium

Privilege escalation in CPython on Windows via VPATH-based sys.path landmark detection

IdentifiersCVE-2026-12003CWE-427· Uncontrolled Search Path Element

CVE-2026-12003 is a CPython vulnerability affecting Windows installations in which release builds retain in-tree source-layout detection logic intended for development builds. CPython defines the VPATH variable at build time and uses it to locate landmarks such as Modules/setup.local. If that landmark is found relative to VPATH and the executable, Python assumes it is running from a source tree and generates an alternate default sys.path. On Windows, builds under PCbuild/<arch> set VPATH to ..\.., causing the fallback landmark path to resolve to ..\..\Modules\setup.local, which can be outside the Python installation directory. In certain legacy all-users installations created by the superseded EXE installer, the directory two levels above the install path may be writable by low-privilege users. An attacker can create the expected Modules/setup.local landmark and a malicious alternative Lib directory at that external location, causing the interpreter to discover and use attacker-controlled libraries. The vulnerable behavior is part of a compatibility fallback used when .\pybuilddir.txt is absent.

Share:
For your environment

Are you exposed to this one?

Mallory correlates every CVE against your assets, your vendors, and active adversary campaigns. Know which vulnerabilities matter for you, not just which ones are loud.

ANALYST BRIEF

Impact, mitigation & remediation

What it means. What to do now. Patch path, mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

On affected Windows systems, a low-privilege local user may be able to influence Python's module search path for an otherwise restricted installation by planting the external Modules/setup.local landmark and an alternate Lib tree. This can result in unauthorized library loading and, depending on how the Python installation is used, privilege escalation or execution of attacker-controlled Python code in the security context of a more privileged user or service invoking that interpreter.

Mitigation

If you can’t patch tonight, do this now.

Avoid legacy all-users Windows installations where the directory two levels above the Python install path is writable by less-privileged users. Prefer per-user installs via the Python install manager. As an interim mitigation, pre-create the relevant external Modules directory and restrict its permissions so unprivileged users cannot create Modules/setup.local or a parallel Lib tree. Installations where the directory two levels above the Python installation directory has equivalent permissions to the install directory are generally unaffected.

Remediation

Patch, then assume compromise.

Upgrade to vendor-fixed CPython releases or apply the upstream source fixes. On Windows, Python recommends migrating away from the legacy all-users EXE installer to the newer Python install manager using current-user installs. Only Python 3.13 and 3.14 will receive updated legacy installers; earlier affected branches receive fixes in source form only. Future Python releases will remove the VPATH fallback entirely and rely on pybuilddir.txt for in-tree builds.
PUBLIC EXPLOITS

Exploits

No public exploits tracked yet. Mallory keeps watching.

VALID 0 / 0 TOTALView more in app

No public exploit code observed for this vulnerability.

ACTIVITY FEED

Recent activity

9 sources tracked across advisories and community write-ups. News coverage will land here when it surfaces.

No news coverage yet. Advisories and community discussion only.

What this page doesn’t show

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, which detections to deploy, and what to do tonight.
Exposure mapping

Query your assets running an affected version, and investigate the blast radius.

Threat actor evidence

Every observed campaign linking this CVE to a named adversary.

Associated malware

Malware families riding this exploit, with evidence and IOCs.

Detection signatures

YARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.

Vendor-by-vendor mapping

Cross-references every affected SKU, including bundled OEM variants.

Social activity8

Community discussion across Reddit, Mastodon, and other social sources.