# The Dependency Trap

`The Artificial Dossier · Case File 005`

---

A developer asks an AI assistant to build a feature.

The assistant produces the code, identifies a library that appears suitable for the task and provides the command needed to install it. The package name looks familiar. The documentation is convincing. The code works.

So the developer installs it.

Somewhere in that process, a decision has been made: a third-party component has been invited into the project, granted access to the development environment and potentially given an opportunity to execute code.

But what if the package was never legitimate?

What if the name was invented by the AI? What if an attacker registered that name before the developer ever searched for it? Or what if the package was deliberately designed to appeal to an AI coding assistant, rather than a human developer?

The danger is not necessarily in the code the AI writes.

Sometimes, it is in the code it tells us to trust.

As AI-assisted development becomes more integrated into everyday software engineering, the software supply chain is gaining another point of exposure. The tools helping developers build applications can also influence which external components enter those applications.

And that raises an uncomfortable question:

> When an AI assistant recommends a dependency, who is responsible for checking whether it belongs there?

# 1\. A World Built on Dependencies

Modern software is rarely built entirely from scratch.

A web application might rely on hundreds of external libraries, frameworks and packages. These components provide functionality that developers would otherwise have to create themselves, from handling authentication and processing data to managing network requests and displaying interfaces.

Package managers make this process relatively straightforward.

In JavaScript, developers commonly use npm. Python developers may use pip and the Python Package Index (PyPI). Other ecosystems have their own package managers and repositories.

A developer can install a dependency with a command such as:

`npm install express` or `pip install requests`

The package manager retrieves the requested component and its dependencies, allowing the project to use functionality maintained elsewhere.

This is convenient, but it also introduces a chain of trust.

A developer is not simply relying on their own code. They are relying on the package, its maintainers, its dependencies, the repository distributing it and the processes used to build and publish it.

This collection of relationships forms part of the software supply chain.

The supply chain extends beyond the final application. It includes the source code, third-party components, development environments, build systems, repositories and deployment pipelines involved in producing software.

Every additional component creates another relationship that needs to be understood and secured.

AI coding assistants add a new participant to this process.

They can recommend libraries, generate import statements, suggest installation commands and modify project dependencies. More autonomous coding agents may even have permission to execute terminal commands or install packages themselves.

That means an AI system can influence not only what code is written, but also what software is brought into the development environment.

And unlike a conventional search engine, a language model can produce an answer that looks authoritative without necessarily having verified that the package it recommends exists.

# 2\. When AI Invents a Dependency

Language models generate responses based on patterns learned during training. They can produce plausible-looking package names, function calls and installation commands even when the underlying information is incorrect.

This is a form of hallucination.

In ordinary conversation, an invented name might be an inconvenience. In software development, it can become an entry point into the supply chain.

Imagine asking an AI assistant for a Python library that handles a particular encryption task.

It recommends a package called `secure-encrypt-utils`.

The name sounds reasonable. The installation command is correctly formatted. The accompanying code appears to use the package appropriately.

But the package does not exist.

A developer might search for it, find nothing and move on. However, an attacker could anticipate this behaviour, register the fabricated name on a public package repository and publish a malicious version.

If a developer or an automated coding agent subsequently installs that package, the attacker-controlled code may enter the project.

This technique is known as *slopsquatting*.

The term was coined by Seth Larson of the Python Software Foundation and draws on the older practice of *typosquatting*. Rather than registering a misspelt version of a legitimate package, an attacker registers a name that an AI model is likely to invent.

The important difference is where the mistake originates.

With typosquatting, the attacker hopes a human will mistype a package name.

With slopsquatting, the attacker hopes an AI system will confidently recommend a package that does not exist yet.

## How predictable are these hallucinations?

Research presented at the 34th USENIX Security Symposium in 2025 examined package hallucinations across 16 code-generating language models.

The researchers generated and analysed 576,000 code samples across Python and JavaScript.

Their findings reported average hallucinated-package rates of at least:

- 5.2% for commercial models
- 21.7% for open-source models

The study also identified 205,474 unique examples of hallucinated package names.

These figures should be understood in the context of the models and testing conditions examined in that research, rather than treated as current rates for every AI coding assistant.

However, the underlying security concern remains significant.

If a model repeatedly produces the same fabricated package name in response to similar prompts, an attacker may be able to anticipate which names developers are likely to encounter.

The hallucination is no longer just an isolated error.

It can become a predictable opportunity.

# 3\. A Package with an Agenda

Slopsquatting is not the only way attackers can exploit the relationship between AI coding tools and external software.

A malicious package does not necessarily need to rely on an invented name. It can imitate a legitimate library, present itself as a useful developer tool or deliberately write its documentation to appeal to AI systems.

This brings us to a related technique sometimes described as LLM Optimisation (LLMO) abuse.

Instead of waiting for an AI model to hallucinate a package name, attackers attempt to influence which existing package an AI coding agent selects.

They can do this by creating convincing package descriptions, documentation, examples and metadata that make a malicious component appear relevant to a particular programming task.

The distinction is important:

- Slopsquatting exploits a package name an AI is likely to invent.
- LLMO abuse attempts to make an AI coding agent discover and select an attacker-controlled package.

Both approaches exploit the growing role of AI in software dependency selection.

And both can turn a seemingly ordinary development recommendation into a security decision.

![](https://cdn.hashnode.com/uploads/covers/6ad64a6a5605359157e47354/f8de0dcf-180a-4fa2-bb0a-28653f6d8ee8.png align="center")

**Figure 1: The anatomy of an AI-assisted software supply-chain attack.** *The diagram illustrates how an AI-assisted development workflow can introduce malicious dependencies into a software project, tracing the progression from a developer's request and an AI-generated package recommendation to an unverified or malicious dependency, its installation and potential execution. It highlights how package hallucinations, slopsquatting and deceptive third-party components can create opportunities for compromise, reinforcing the importance of dependency verification, restricted execution permissions, least privilege and monitoring of AI agent activity.*

# 4\. Case Study: PromptMink and the Dependency That Shouldn't Have Been There

In April 2026, security researchers at ReversingLabs published an investigation into a malware campaign they named PromptMink.

The investigation revealed how malicious packages could be designed to deceive developers and AI coding agents, ultimately introducing malware into an autonomous cryptocurrency trading project.

The campaign was associated by ReversingLabs with the North Korean-linked threat group Famous Chollima.

What made the investigation particularly interesting was the way the attackers separated their malicious functionality across multiple packages.

## The bait and the payload

Rather than publishing one obviously malicious package, the attackers used a layered dependency structure.

The first layer consisted of packages that appeared to provide legitimate cryptocurrency-related functionality. They included names associated with Solana development, wallet operations and other Web3 tools.

On their own, these packages could appear relatively ordinary.

However, some included dependencies on a second layer of packages containing malicious functionality.

One of these was `@validate-sdk/v2`, which presented itself as a data-validation utility while collecting sensitive information from the host environment.

The separation served a purpose.

The first-layer packages acted as bait. They could appear useful to a developer or AI coding assistant, while the actual malicious behaviour was hidden further down the dependency tree.

This is particularly concerning because developers do not always inspect every transitive dependency introduced by a package.

A project might directly request one library while indirectly installing several others.

The developer sees the dependency they selected. The package manager resolves the wider tree.

And somewhere within that tree, a malicious component may be waiting.

## When the AI agent becomes part of the delivery chain

ReversingLabs identified a February 2026 commit to the open-source openpaw-graveyard autonomous cryptocurrency trading project that introduced a malicious dependency.

The commit was co-authored by Anthropic's Claude Opus model.

The resulting dependency chain included `@validate-sdk/v2`, which could collect secrets from the environment and send them to attacker-controlled infrastructure.

The researchers reported that the activity exposed sensitive information and provided attackers with access to cryptocurrency wallet credentials and funds.

This was not simply a case of an AI model producing an incorrect line of code.

The more important issue was the role of the coding agent in introducing an external component that should have been scrutinised before it entered the project.

The package did not need to advertise itself as malware. It presented a useful function, appeared within a plausible dependency chain and relied on the trust developers place in familiar development workflows.

## Why the layered approach matters

The attackers' separation of bait and payload packages also created a practical advantage.

If a malicious second-layer dependency was detected and removed, the attackers could replace it while keeping the first-layer packages available.

The lure could retain its apparent legitimacy while the underlying payload changed.

ReversingLabs also documented how the malware evolved, moving from obfuscated JavaScript to other delivery techniques, including Python packages and compiled Rust components.

The campaign was not static. Its developers adapted their methods as earlier versions were detected.

This is an important reminder that supply-chain attacks are not always built around one suspicious file or one obvious malicious command.

Sometimes the danger only becomes visible when the relationships between seemingly ordinary components are examined.

The incident demonstrates a particularly uncomfortable possibility: an AI coding assistant can become part of the route through which an attacker-controlled dependency enters a project.

It does not mean that the model provider was compromised or that the AI intentionally selected malware. It means the development workflow failed to establish sufficient trust in the dependency before it was introduced.

# 5\. The Wider Picture: Not Every Malicious Package Needs AI

The PromptMink investigation is particularly relevant because it directly connects AI-assisted development with a malicious dependency.

However, it would be a mistake to suggest that software supply-chain attacks only become dangerous when AI is involved.

A useful comparison appeared in the TLDR Infosec archive in July 2026.

Socket researchers investigated a three-month npm campaign involving 18 packages targeting Alibaba developers.

The packages were designed to resemble legitimate internal tools and split their functionality across multiple dependencies.

The resulting chain delivered a cross-platform remote access trojan capable of executing commands, transferring files, capturing screenshots and supporting lateral movement through DingTalk.

Some individual packages appeared harmless when examined in isolation. Their malicious purpose became clearer when researchers investigated how the packages depended on one another and what the complete chain achieved.

This was not established as a slopsquatting or AI-generated recommendation attack. It was a conventional malicious package campaign.

But it illustrates the same underlying weakness: trusting a package based on its name or apparent functionality is not enough.

The wider software supply chain can contain malicious relationships that are difficult to identify by examining a single component.

## Another example: PhantomRaven

In September 2026, CrowdStrike reported on a financially motivated threat actor distributing an information stealer called PhantomRaven through malicious npm packages.

The researchers assessed with high confidence that the malware had been developed with the assistance of a large language model, citing features such as verbose comments, placeholder code and statistical token-analysis patterns.

The packages used typosquatted names and a remote dependency technique to retrieve malicious code during installation.

This example adds another dimension to the investigation.

AI is not only changing how developers select and install software. It can also assist attackers in producing and distributing malicious components.

The distinction matters. PhantomRaven was an example of AI-assisted malware development, not proof that a victim's coding assistant had recommended the malicious packages.

Taken together, these incidents show a broader shift: attackers can exploit the software supply chain through traditional package attacks, AI-targeted recommendations and AI-assisted malware development.

The technologies may change. The underlying trust problem remains.

# 6\. The Problem with Installing First and Asking Questions Later

One of the difficulties with package security is that installation can involve more than downloading a collection of files.

Depending on the ecosystem and package configuration, installation may execute scripts or trigger other behaviour.

In npm, for example, packages can define lifecycle scripts such as `preinstall`, `install` and `postinstall`.

These scripts can perform legitimate setup tasks, but they can also be abused to execute malicious code during installation.

This creates an important distinction between reviewing what a package claims to do and examining what it actually does.

A package description might promise a convenient utility. Its installation process might retrieve additional code from an external server, access environment variables or execute commands on the developer's machine.

And if the package has dependencies of its own, the developer may be trusting an entire chain of components rather than one library.

AI coding agents can make this process more complicated.

If an agent has terminal access and permission to manage dependencies, it may be able to move from recommendation to installation with very little human intervention.

The speed is useful when the package is legitimate.

It is equally useful to an attacker when the package is not.

This is why package selection should not be treated as a minor implementation detail. It is a security decision that deserves independent verification.

# 7\. Building a Safer Supply Chain

The answer is not to abandon AI coding assistants or stop using open-source software.

Modern development depends on external components, and AI can provide genuine benefits when used responsibly.

The objective is to ensure that convenience does not replace verification.

Several established software security practices become particularly important in AI-assisted development.

## 1\. Verify every dependency

An AI-generated package recommendation should be treated as an unverified suggestion.

Before installation, developers should check whether the package exists in the intended registry, whether the publisher is legitimate, whether the repository matches the claimed project and whether the package is actually the one required.

A plausible name is not evidence of authenticity.

## 2\. Review the dependency tree

Direct dependencies are only part of the picture.

A package may introduce additional components, some of which may themselves have further dependencies.

Software composition analysis (SCA) tools can help identify known vulnerabilities, suspicious components and dependency relationships.

However, scanning should not be treated as a guarantee that a package is safe. New or deliberately evasive malicious components may not yet have known signatures or reported vulnerabilities.

## 3\. Use lockfiles and version controls

Lockfiles record the exact versions of dependencies resolved for a project.

They help ensure that subsequent installations use the same dependency versions rather than silently retrieving newer releases.

Where supported, teams should also verify package integrity using hashes and signatures.

This does not establish that a package is benign, but it helps protect against unexpected changes and tampering.

## 4\. Restrict installation-time execution

A package should not automatically receive permission to execute arbitrary scripts simply because a developer wants to use its functionality.

npm 12 introduced an important change in this area: dependency installation scripts are no longer automatically allowed by default, requiring developers to explicitly approve scripts they trust.

The change is significant because it adds a decision point between installing a dependency and executing its installation-time code.

It is not a complete defence against malicious packages, but it reduces one avenue for automatic execution.

## 5\. Generate and maintain an SBOM

A Software Bill of Materials (SBOM) is an inventory of the components included in a software product.

It can help organisations understand which libraries and dependencies their applications contain, where those components came from and which relationships exist between them.

An SBOM is particularly useful when a vulnerability or malicious package is discovered after software has already been deployed.

Rather than trying to reconstruct the entire dependency tree from memory, security teams have a record they can use to identify potentially affected systems.

However, an SBOM is only as useful as its accuracy and maintenance. It is not a security certificate.

## 6\. Keep AI agents away from unrestricted package installation

Where coding agents can use terminal commands or package managers, their permissions should be carefully controlled.

An agent may be allowed to suggest a dependency without being allowed to install it automatically.

High-risk actions should require human review, particularly when they involve new packages, unfamiliar registries, remote dependencies or installation scripts.

The objective is to separate code generation from the authority to introduce and execute external software.

The AI can make a recommendation.

The development workflow should independently decide whether that recommendation is safe enough to accept.

# 8\. The Verdict: Never Trust an Import Blindly

The software supply chain has always depended on trust.

Developers trust maintainers to publish legitimate packages. Organisations trust repositories to distribute the correct software. Applications trust their dependencies to perform the functions they were designed to perform.

AI-assisted development does not remove these relationships.

It adds another layer to them.

A coding assistant may recommend a package that does not exist. An attacker may register that name. A malicious developer may create a package specifically designed to appeal to an AI agent. Or a coding assistant may introduce a dependency that appears harmless while concealing a malicious component further down the chain.

The resulting risk is not simply that AI can write insecure code.

It is that AI can influence which software enters the systems we build, sometimes with very little scrutiny.

The PromptMink investigation demonstrates how that influence can become part of a real supply-chain compromise. The wider package campaigns show that malicious dependencies can hide behind convincing names, layered functionality and apparently legitimate development tools.

The answer is not to assume that every AI-generated recommendation is dangerous.

It is to stop treating recommendations as verification.

A package should be examined because of what it is, where it came from and what it does; not because an AI assistant confidently suggested it.

AI may help us write the software. It should never be the only thing deciding what software we trust.

---

# The Evidence Ledger

**\[1\] ReversingLabs — Claude adds malware to crypto agent 29 April 2026**\
<https://www.reversinglabs.com/blog/claude-promptmink-malware-crypto>\
Primary investigation underpinning the PromptMink case study. Examines the malicious @validate-sdk/v2 dependency, its role in the openpaw-graveyard cryptocurrency trading project, the layered bait-and-payload approach and the evolution of the malware.

**\[2\] USENIX Security 2025 — We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs August 2025**\
<https://www.usenix.org/conference/usenixsecurity25/presentation/spracklen>\
Academic research evaluating package hallucinations across 16 code-generating language models and 576,000 code samples. Provides the research basis for the discussion of hallucinated package names and slopsquatting.

**\[3\] Socket — Distributed npm Package Cluster Delivers Cross-Platform RAT Targeting Alibaba Developers 28 July 2026**\
<https://socket.dev/blog/npm-rat-targets-alibaba>\
Technical investigation of an 18-package npm campaign targeting Alibaba developers. Explains how seemingly harmless packages were connected through a dependency chain to deliver a cross-platform remote access trojan. This was included in the TLDR Infosec archive.

**\[4\] CrowdStrike — PhantomRaven: An LLM-Generated Information Stealer Developed for Bug Bounty Hunting 15 September 2026**\
<https://www.crowdstrike.com/en-us/blog/phantomraven-llm-generated-information-stealer-for-bug-bounty-hunting/>\
Threat research into malicious npm packages distributing PhantomRaven, an information stealer assessed to have been developed with LLM assistance. Provides an example of AI being used on the attacker side of the software supply chain.

**\[5\] GitHub — Upcoming breaking changes for npm v12 9 June 2026**\
<https://github.blog/changelog/2026-06-24-upcoming-breaking-changes-for-npm-v12/>\
Official announcement of npm 12 security-related changes, including the default-deny approach to dependency installation scripts and restrictions on Git and remote URL dependencies.

**\[6\] NIST — Strategies for the Integration of Software Supply Chain Security in DevSecOps CI/CD Pipelines (SP 800-204D) February 2024**\
<https://doi.org/10.6028/NIST.SP.800-204D>\
Technical guidance on software supply-chain security throughout development and deployment pipelines, including component verification, provenance, vulnerability scanning, SBOMs and secure CI/CD practices.

## A Note on Scope

The PromptMink investigation describes a malicious dependency introduced into an autonomous cryptocurrency trading project through an AI-assisted development process. It should not be interpreted as evidence that the AI model itself was compromised or intentionally malicious.

The USENIX package-hallucination figures relate to the models and experimental conditions examined in the 2025 study. They should not be treated as current performance measurements for every model available in 2026.

The Alibaba npm campaign is included as an example of a conventional malicious dependency-chain attack. It was not established as a slopsquatting campaign or as an attack caused by AI-generated package recommendations.

The PhantomRaven investigation concerns suspected LLM-assisted malware development by an attacker. It is a separate example from an AI coding agent recommending a malicious dependency.

npm 12's installation-script restrictions reduce certain execution risks, but they do not establish that an installed package is trustworthy or prevent every form of malicious behaviour.

The defensive recommendations in this article draw on NIST and package-management security guidance. They should be adapted to the development environment, software ecosystem and risk profile of the organisation.

---

# ✦ A Note on the Making

♡ Cover image: Created with the help of AI and a little human imagination to guide the way.

♡ Diagram: Made with a little help from AI, a dash of human imagination, and a healthy dose of creative direction.

Every dossier has its makers; these are mine.
