Dependency confusion: CVE-2026-54232, torchtriton, and the package name nobody registered
A package name is not an address. When two indexes can answer for the same name, the resolver picks the winner, and in pip's default mode the winner is whoever published the higher version. How vLLM's build got caught, how PyTorch's did, and how to find the same gap in your own manifests.
By Ahmed PingerPublished
9 min read8 views
pip install flashinfer-jit-cache==0.6.11.post2 --extra-index-url https://flashinfer.ai/whl/
Read that line the way the person who wrote it read it: "install this package from that index." Now read it the way pip reads it: "find every index I know about, collect every candidate called flashinfer-jit-cache, and pick the best version." Those are different instructions, and the gap between them is the whole of dependency confusion.
The bug in one distinction
A package name is not an address. requests does not mean "the requests on PyPI"; it means "whatever the resolver finds when it asks for requests." On a machine with one index configured, the two readings coincide and nobody notices. On a machine with two indexes, an internal one for your own libraries and a public one for everything else, the resolver has to choose, and the rules it uses to choose were written for version selection, not for trust.
Dependency confusion is what happens when an attacker notices that one of your internal package names does not exist on the public index, registers it there, and lets your own build pull it in. Nothing is broken into. The build does exactly what it was configured to do.
Why it varies by tool
The failure is a policy in each package manager, and the policies differ.
pip is the loudest case. Its documentation says there is "no priority in the locations that are searched," and that the best match by version number is selected across all of them. The same page now carries a warning that using --extra-index-url for private packages "is unsafe" and names the class of issue. --extra-index-url does not mean "fallback." It means "also."
uv defaults to first-index: it stops at the first index that has the package and never looks at PyPI for a name the internal index already serves. Its documentation says the intent is to prevent dependency confusion and points at the torchtriton incident. It also offers unsafe-best-match, which is pip's behaviour, and the docs say plainly that it "exposes users to the risk." That setting is what did for vLLM.
npm has scopes. A package published as @yourorg/auth can only be published by whoever controls the @yourorg scope on the public registry, and .npmrc can bind a scope to a registry. An unscoped internal name is exactly as exposed as an unscoped Python one.
Bundler was itself the bug for a while: CVE-2020-36327 records that Bundler 1.16.0 through 2.2.9, and again 2.2.11 through 2.2.16, "sometimes chooses a dependency source based on the highest gem version number," so a rogue public gem could win over a private one. The fix was a change to source priorities, and NVD's own note on that record says it is not correct to file every dependency confusion issue under Microsoft's umbrella CVE-2021-24105.
Gradle introduced repository content filtering after the original research and then had a bug in it: CVE-2021-29427 covers a case where filters declared in a pluginManagement block were ignored and all repositories were searched.
Five tools, five policies, one shape.
The real CVE
CVE-2026-54232 is a dependency confusion in the vLLM Dockerfile, fixed in vLLM 0.22.1, rated 8.8 and classed under CWE-427. The GitHub advisory describes three conditions that lined up:
- The build installed
flashinfer-jit-cachefrom a custom index using--extra-index-url. - The package name was not registered on PyPI.
UV_INDEX_STRATEGY="unsafe-best-match"was set globally, so uv behaved like pip.
Anyone could have registered flashinfer-jit-cache on PyPI at version 0.6.11.post2 and their code would have been selected over the real one. The build then ran the package's own command-line tool as root, so every image built from that Dockerfile would have carried whatever the attacker put in. The reporter is credited as jstawinski and the advisory was published in June 2026.
The incident that made this class famous had the same three conditions. Between 25 and 30 December 2022, PyTorch nightly builds for Linux installed via pip pulled a dependency called torchtriton. PyTorch shipped that package on its own index. Someone uploaded a package with the same name to PyPI, and because, in PyTorch's words, "the PyPI index takes precedence," the PyPI copy was installed instead. Its binary collected nameservers, hostname, username, environment variables, /etc/passwd, .gitconfig, everything under .ssh, and the first 1,000 files in the home directory, and sent them out as encrypted DNS queries to a domain under h4ck[.]cfd. PyTorch's fix is instructive: the dependency was renamed to pytorch-triton and a dummy package was registered on PyPI under the new name "so that this issue doesn't repeat."
That is the whole defence in one sentence. If you cannot make the resolver stop looking, occupy the name it will look for.
A lab you can build
You need a Linux VM with Python 3 and nothing else. The lab serves two local indexes and watches which one wins. Nothing in it calls out anywhere.
python3 -m venv lab && . lab/bin/activate
pip install --upgrade pip build
mkdir -p internal/acme-billing public/acme-billing
Create two versions of a package called acme-billing. The internal one is version 1.0.0 and does nothing. The "public" one is version 9.0.0 and prints a marker when imported.
# internal/acme-billing/pyproject.toml
[project]
name = "acme-billing"
version = "1.0.0"
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
Give each a package directory (acme_billing/__init__.py), put print("PUBLIC COPY IMPORTED") in the 9.0.0 one, and build wheels into two directories laid out as PEP 503 simple indexes:
for side in internal public; do
(cd $side/acme-billing && python -m build --wheel -o ../../$side-index/acme-billing/)
(cd $side-index/acme-billing && ls *.whl | sed 's|.*|<a href="&">&</a>|' > index.html)
done
(cd internal-index && python3 -m http.server 8001 &)
(cd public-index && python3 -m http.server 8002 &)
Now the experiment:
pip install --index-url http://127.0.0.1:8001/ --extra-index-url http://127.0.0.1:8002/ acme-billing
python -c "import acme_billing"
The 9.0.0 wheel from port 8002 wins, and the marker prints. Reverse the two URLs and it still wins, because ordering is not priority. Then repeat with uv installed into the same venv and its default strategy, and watch it stop at the first index. Run pip install -v once as well and read the Found link lines: that is the audit trail you will want later.
Finding it in source
The search is for two things: where a second index is introduced, and which names are internal.
grep -rn -- '--extra-index-url\|extra-index-url\|UV_INDEX_STRATEGY\|unsafe-best-match' \
--include='*.txt' --include='*.toml' --include='*.cfg' --include='*.ini' \
--include='Dockerfile*' --include='*.yml' --include='*.yaml' --include='*.sh' .
grep -rn 'registry=' .npmrc */.npmrc 2>/dev/null
grep -n '^source ' Gemfile
Then list every dependency that is meant to come from an internal index and check whether the same name exists on the public registry. For PyPI, a request to https://pypi.org/simple/<name>/ returns 404 for an unregistered name; for npm, npm view <name> does the same job. Every internal name that returns 404 on the public index is a name someone else can still take.
The vLLM case adds a third check: any environment variable or config file that changes the resolver's strategy globally. A UV_INDEX_STRATEGY set in a Dockerfile applies to every uv pip install in that build, including the ones written by people who never saw the line.
Fixing it
In order of how much each buys you:
Occupy the names. Register every internal package name on the public registry, as PyTorch did, with a placeholder that installs nothing. This is cheap, reversible, and it works regardless of what any client's resolver does.
Use scopes where the ecosystem has them. For npm, publish internal packages under an organisation scope and bind the scope to your registry in .npmrc. A scoped name cannot be squatted by an outsider.
Make the resolver stop looking. For uv, keep the default first-index and mark internal indexes explicit = true with [tool.uv.sources] pins for the packages that must come from them. For pip, do not use --extra-index-url for private packages at all. Point --index-url at one internal proxy that mirrors the public index and serves your packages, so the client only ever sees one index and the proxy owns the precedence rule. For Bundler, use source blocks that scope each gem to its source, on a version outside the CVE-2020-36327 ranges.
Pin by hash. pip install --require-hashes with a lock file of hashes rejects a substituted artefact even if resolution goes wrong. Lockfiles that record the resolved URL, not only the version, do the same job in other ecosystems.
Standards work is catching up, slowly. PEP 708 proposed repository-level metadata (tracks and alternate-locations) so installers could refuse to merge a name across indexes unless both sides agreed. It sat as provisionally accepted for three years and is now marked rejected, so today the controls above are what exists.
Detection
Three signals, all on the build host rather than in the code:
Which index served each package. pip install -v logs the link it chose; capture it in CI logs and alert when an internal name resolves to a public URL. That single grep would have caught both incidents above at install time.
Outbound DNS from build agents. torchtriton exfiltrated over DNS because DNS is the channel that always works. A build agent that resolves names under a domain it has never used before is worth a look, and a build agent that is not allowed arbitrary egress in the first place cannot exfiltrate that way at all.
New publications of your names. Watch the public registries for the internal names you have not yet occupied. A registration event for acme-billing on PyPI is either your placeholder or the start of an incident.
Take this away
The resolver is not deciding whom to trust. It is picking the best version from everything it can see, and --extra-index-url widens what it can see. Every internal package name that is absent from the public index is a name an attacker can fill, and pip will thank them for the newer version.
Occupy the names, scope what can be scoped, give the client one index to talk to, and read the install log for where each artefact actually came from.
Further reading
- NVD: CVE-2026-54232 and the vLLM advisory GHSA-jrf6-vqxq-pjv2
- PyTorch: Compromised PyTorch-nightly dependency chain between December 25th and December 30th, 2022
- Alex Birsan: Dependency Confusion, February 2021: the original research across npm, PyPI and RubyGems
- pip documentation: pip install: the "no priority" rule and the
--extra-index-urlwarning - uv documentation: Package indexes: index strategies and
explicit = true - PEP 708: Extending the Repository API to Mitigate Dependency Confusion Attacks
- NVD: CVE-2020-36327 and Bundler: a more secure Bundler, we fixed our source priorities
- NVD: CVE-2021-29427: Gradle repository content filtering
- npm documentation: About scopes
- Include Security: Dependency Confusion, when are your npm packages vulnerable?
- CWE-427: Uncontrolled Search Path Element
Was this useful?
Get the next write-up by email
New technical write-ups by email when we publish. No sales sequence, and every email has an unsubscribe link.
Prefer a feed? RSS. How we handle your address: privacy notice.
Comments
Loading comments…