Join our Newsletter — 33% off our NHI Course
Home› FAQ› Threats, Abuse & Incident Response› What is the difference between dependency confusion and…
Threats, Abuse & Incident Response

What is the difference between dependency confusion and slopsquatting?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated November 25, 2026 Domain: Threats, Abuse & Incident Response

Dependency confusion is an attack on package resolution, where an internal package name is registered in a public repository so build tools pull the attacker’s package instead of the private one. Slopsquatting is a software supply chain attack where an AI model hallucinates a package name and an attacker publishes that name, so developers install malware from the model output itself. Both are mitigated by scoped package registries, allowlists, and dependency pinning.

How dependency confusion differs from slopsquatting

Both attacks abuse software dependency trust, but they start from different failure points. Dependency confusion works when a build or install process resolves a package name to a public repository instead of the intended private source. Slopsquatting begins one step earlier: an AI system invents a plausible package name, and the attacker publishes that name to catch developers who trust the model output.

The practical difference is where the dangerous name comes from. In dependency confusion, the attacker exploits package namespace resolution and repository precedence. In slopsquatting, the attacker exploits model hallucination and then turns that hallucination into a real malicious package. The first is a package-resolution problem; the second is an AI-to-supply-chain translation problem.

That distinction matters because the control emphasis changes. Package registries, scope rules, and pinning help in both cases, but slopsquatting also requires treating AI-generated dependency suggestions as untrusted inputs. A developer can be fully aware of the private package name and still be exposed if a tool or assistant introduces a convincing fake alternative.

Where the attack path changes

Dependency confusion usually appears in build systems, CI pipelines, package managers, and internal package naming conventions. If a private name is not protected by scoped registries, allowlists, or explicit repository precedence, the resolver may select the attacker-controlled package. The key issue is ambiguity in where the dependency should come from.

Slopsquatting usually appears during code generation or assisted development. An LLM suggests a package name that sounds legitimate, but no such package exists yet. If the developer copies that suggestion into a manifest or install command, the attacker can later publish malware under that exact name. The weakness is not the package manager first, it is the trust placed in the model output.

For readers who want the broader supply chain context, the Malicious Package and Dependency Confusion Guide covers the package-name abuse patterns that sit behind both attacks. The related Software Supply Chain Security Guide frames them as part of dependency, build, and provenance risk rather than as isolated incidents.

How to defend against both without overcorrecting

The core defense is to make dependency choice deterministic. Scoped package registries, explicit repository configuration, lockfiles, and pinning reduce the chance that a build resolves the wrong source. For slopsquatting, the extra step is to verify that any model-suggested dependency actually exists, is maintained, and is approved before it reaches a manifest or install step.

Good teams also separate convenience from trust. AI assistants can help surface candidates, but they should not be allowed to author dependency decisions on their own. A package name suggested by a model should be treated like an external recommendation, not a verified artifact. If the package is new, unfamiliar, or unusually similar to an existing internal name, it deserves manual validation before inclusion.

If you want a focused control path for package abuse, the Slopsquatting and Package Hallucination Guide is the most direct match, because it addresses the AI hallucination step as well as the publishing step. For broader dependency governance, the Vendoring Dependencies vs Private Registry Proxies guide is useful when deciding whether to reduce exposure by proxying or freezing dependencies.

Risk and Threat Considerations

Both attacks can turn ordinary dependency installation into code execution, credential exposure, or pipeline compromise. The risk is highest where package resolution is automated and developers assume that a familiar-looking name is safe.

Failure mechanism: An attacker wins by controlling name resolution or by publishing a package that matches a hallucinated suggestion, then relying on an unguarded install path to pull malicious code into the environment.

Impact: The result can be malicious code execution, supply chain contamination, theft of secrets from build environments, and downstream trust loss in released software.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack and risk surface, while OWASP ASVS, CIS Controls v8, SLSA and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP ASVSV13 — ConfigurationDependency source selection is a security-critical configuration choice.
Recommendation — Lock dependency sources to approved repositories and verify resolution settings.
CIS Controls v8CIS-16 — Application Software SecurityCovers secure dependency handling and software acquisition risks.
Recommendation — Harden software acquisition workflows and restrict untrusted package sources.
OWASP API Security Top 10API8 — Security MisconfigurationPackage resolution misconfiguration enables dependency confusion.
Recommendation — Remove ambiguous resolution paths and enforce explicit package source rules.
SLSASupply-chain Levels for Software ArtifactsBuild provenance and dependency integrity are central to both attacks.
Recommendation — Require provenance and integrity checks before accepting third-party dependencies.
NIST CSF 2.0PR.DS-01 — Data-at-rest is protectedProtects sensitive build assets and secrets exposed through malicious dependencies.
Recommendation — Protect stored secrets and build artefacts from exposure to untrusted packages.

Practitioner Guidance

What to verify: Check whether your build and package tooling has a single, explicit source of truth for private names. If a package can be resolved from more than one place, dependency confusion remains possible even when the package list looks clean.

Decision rule: If the dependency name came from an AI tool, require a separate validation step before it is added to code, a lockfile, or a CI pipeline. Treat the model output as a suggestion only, never as proof that the package should exist.

What practitioners underestimate: These attacks are often enabled by process shortcuts rather than by novel malware. The attacker does not need to break your build if your workflow already trusts ambiguous names or unverified AI suggestions.

Practitioner takeaway: Dependency confusion is a resolver problem, slopsquatting is a hallucination problem, but both become the same security issue once an untrusted package name is allowed to reach production.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org