medium severityCurated advisory

Stale dependency exploitation in AI environments

AI agents often work with projects that have outdated dependencies. When an agent suggests or installs packages based on a stale package.json, it can introduce known-vulnerable versions — and in AI environments, the vulnerability is amplified because the agent can execute commands.

Affected surfacespackage.jsonlockfilestransitive dependenciesagent install commands
The attack

What happens

An agent working on a project with outdated dependencies may install or suggest packages with known vulnerabilities. In an AI environment, the vulnerability is amplified because the agent can execute commands, read files, and call tools — turning a library vulnerability into a full system compromise.

Step by step

How the attack unfolds

1Agent works on a project with a package.json that hasn't been updated in months.
2Agent installs a package version that has a known vulnerability (e.g., lodash 4.17.4 with prototype pollution).
3The vulnerability allows code execution when processing untrusted input.
4Agent processes a file or tool output that triggers the vulnerability.
5Attacker gains code execution within the agent's process.
Example

What it looks like in practice

Scenario

A developer asks Cursor to "add a date formatting library." Cursor installs [email protected] (which has a known ReDoS vulnerability) instead of the patched version. A file the agent processes contains a crafted date string that triggers the ReDoS, causing the agent to hang and potentially crash.

Detection

How Guard catches this

Guard cross-references installed packages against the npm audit database.
Guard flags when an agent installs a package with known vulnerabilities.
Guard Cloud maintains a database of AI-relevant vulnerabilities and alerts on matches.
Mitigation

How to stop it

Recommended action

Keep dependencies updated. Use Guard to flag when an agent installs a package with known vulnerabilities. Pin versions and use lockfiles to prevent unexpected version changes.

Guard configuration
Enable "Dependency vulnerability scanning" to check installed packages against vulnerability databases.
Enable "Stale dependency detection" to alert when project dependencies are more than 6 months old.
Enable "Install review" to show vulnerability information before allowing an install.
FAQ

Common questions

Stop this threat before it reaches your agent

Install HOL Guard to get real-time protection against this attack and others like it.