back

The Keyv Worm: When the Software Supply Chain Starts Targeting AI Agents

An npm supply-chain attack compromised 400+ packages and targeted AI development environments, stealing credentials and planting persistence through tools like Claude Code and VS Code. It signals a new threat to AI-assisted software development.

The Keyv Worm: When the Software Supply Chain Starts Targeting AI Agents

A compromised npm package is already a serious problem. A compromised package that can steal your developer credentials, replicate itself into hundreds of other packages, and plant persistence inside the tools your developers use to work with AI is something else entirely.

That is what made the August 2026 Keyv supply-chain attack worth paying attention to.

The incident began with malicious releases of keyv and related packages and quickly turned into a self-propagating worm. Within roughly 90 minutes, more than 400 package names had been infected according to Aikido's analysis, with later research finding an even larger footprint as the campaign expanded.

But the number of compromised packages isn't actually the most interesting part.

The more important shift was what the malware was looking for once it reached a developer environment.

It wasn't satisfied with npm credentials or cloud keys. The campaign specifically looked for credentials and configuration associated with AI development tools, including Claude, OpenAI, Cursor, Gemini and Codex. It also introduced persistence mechanisms involving Claude Code and VS Code.

That changes the supply-chain security conversation.

It Started With a Package Developers Had Little Reason to Suspect

keyv is a caching library. It isn't an obvious high-value target from a developer's perspective, which is exactly what makes the incident instructive.

On August 4, attackers compromised the GitHub account associated with the package ecosystem and pushed malicious releases, including [email protected]. Related packages such as cacheable, cache-manager, flat-cache and file-entry-cache were also affected. Some of these packages have enormous downstream reach; Datadog noted that Keyv, file-entry-cache and flat-cache each account for roughly 150 million monthly downloads. The malicious package used an npm preinstall lifecycle hook to execute its payload.

That matters because developers don't have to deliberately run suspicious code for a supply-chain attack to become dangerous. Installing a dependency can be enough.

And once the worm obtained npm credentials, it could look at the packages those credentials were allowed to publish, modify their contents, bump their versions and publish the infected versions back to npm.

That's how one compromised package became hundreds.

The attack wasn't simply distributing malware.

It was using the software supply chain to manufacture more entry points.

Then the Attack Moved Into AI Development Environments

This is where the Keyv incident becomes more significant than another npm compromise.

Modern development environments increasingly contain valuable credentials that never existed in the traditional software workflow. Developers aren't just connected to GitHub and cloud infrastructure anymore. They may have API keys for AI models, credentials for coding agents, access to agent configuration files and permissions that allow those tools to modify repositories or execute commands.

The worm was designed to look for exactly this kind of information.

InstallSafe's analysis says the malware searched for AI-agent credentials and configurations associated with Claude, OpenAI, Cursor, Gemini and Codex.

That creates an interesting attack chain.

A developer installs what appears to be a normal dependency. The malicious package executes. The attacker gets access to credentials sitting in the development environment. Those credentials can then provide access to repositories, cloud infrastructure, package registries or AI services.

The AI agent itself doesn't necessarily have to be compromised.

The environment surrounding the agent can be enough.

That's an important distinction as companies increasingly give coding agents access to terminals, repositories, CI systems and production-adjacent infrastructure.

The Worm Didn't Stop at Credential Theft

Credential theft would already have made this a serious incident.

The Keyv worm went further by attempting to establish persistence.

Researchers found malicious configuration targeting .claude/settings.json and .vscode/tasks.json. These mechanisms could cause malicious code to execute when a developer started a Claude Code session or opened a project in VS Code.

This is a very different threat model from the familiar "malicious package runs during installation" scenario.

Deleting node_modules isn't necessarily enough.

A developer can remove the compromised dependency, reinstall clean packages and still have malicious configuration sitting inside the repository. The next time the project is opened or an AI coding session begins, that persistence mechanism can potentially execute again.

And because these files live alongside legitimate development configuration, they can be much harder to recognize than a conventional executable sitting on a machine.

The attack effectively turns the developer workflow itself into part of the persistence layer.

Even Provenance Wasn't a Silver Bullet

One of the strangest details of the incident concerns software provenance.

Modern supply-chain security increasingly relies on proving where a package came from and how it was built. SLSA provenance and signed build attestations are designed to give organizations greater confidence that an artifact corresponds to a legitimate source and build process.

The compromised packages could still carry valid provenance.

That doesn't mean SLSA was "broken." The distinction is important.

The provenance could correctly describe the legitimate GitHub Actions workflow that produced the package. The problem was that malicious source had entered that legitimate workflow.

In other words, the system could prove how the package was built without proving that the code being built was trustworthy. The Hacker News analysis reached the same conclusion: the provenance and signing records verified the build path, but didn't establish that the source was safe.

That's a useful lesson for security teams.

A signed artifact isn't automatically a safe artifact.

Provenance answers questions about origin and build integrity. It doesn't replace behavioral analysis, dependency controls, credential isolation or install-time policy.

Why AI Agents Make This Problem More Dangerous

AI coding agents change the value of a compromised development environment.

A traditional developer workstation might contain access to source code, Git credentials and cloud accounts. An AI-enabled environment can contain all of those things while also giving an automated system permission to read files, execute commands, modify code and interact with external services.

That makes credentials stored around AI tooling particularly attractive.

It also creates a new possibility for attackers: persistence through the tools developers trust to operate on their behalf.

A malicious dependency doesn't necessarily need to attack the AI model itself. It can attack the environment in which the model operates.

This is why the Keyv worm represents a broader shift in supply-chain security.

The target is no longer simply the application being built.

The target is the development system that builds it.

That system includes package managers, repositories, CI/CD pipelines, IDEs, cloud credentials, developer machines and increasingly autonomous coding agents.

The Real Lesson Isn't "Don't Use npm"

The obvious response to an npm supply-chain attack is to become suspicious of npm.

That isn't particularly useful.

Modern software depends on enormous open-source ecosystems. The realistic security question isn't whether an organization can eliminate third-party dependencies. It is whether it can control what those dependencies are allowed to do.

That means knowing exactly what enters development environments, restricting lifecycle scripts where practical, pinning dependencies, monitoring newly published versions and limiting the credentials available to build processes.

It also means treating AI coding environments as security-sensitive infrastructure rather than simply developer productivity tools.

An agent with repository access should not automatically have unrestricted access to production credentials. A development machine shouldn't expose every cloud credential an organization owns. CI runners should be treated as potentially hostile execution environments rather than trusted machines.

And when an incident occurs, credential rotation shouldn't necessarily be the first action.

Researchers found persistence mechanisms in this campaign that could interfere with remediation. InstallSafe specifically recommends removing the malicious persistence mechanisms before rotating credentials, followed by rebuilding affected environments and auditing for lateral spread.

The order matters because a compromised environment can potentially observe or abuse newly rotated secrets.

The Supply Chain Has Become Part of the AI Attack Surface

The most important thing about the Keyv worm isn't that 400-plus npm packages were compromised.

It's that an attack which began in an ordinary software dependency deliberately moved toward the infrastructure surrounding AI-assisted development.

That's the direction security teams need to watch.

AI agents are becoming deeply embedded in engineering workflows. They can read repositories, modify code, execute commands and interact with development infrastructure. That makes the security of everything around them increasingly important.

A malicious dependency doesn't need to defeat the model.

It only needs to reach the environment where the model has permission to operate.

The Keyv worm showed what that can look like in practice: a trusted package becomes the entry point, stolen credentials fuel propagation, AI tooling becomes a target, developer configuration becomes persistence, and even trusted provenance signals can fail to answer the question security teams actually care about:

Is this code safe to run?

That is a much bigger question than npm security.

It's the beginning of a new supply-chain problem—one where the thing being protected isn't just the software you're shipping, but the increasingly autonomous systems you use to build it.

Category

Tags

Follow us