When an npm Install Becomes an AI Agent Backdoor

HackWednesday AI Desk2 min read

AI in SecurityAI-assistedAwaiting editor review2 linked sources

A malicious CRM package shows why AI agent security starts with dependency execution, build permissions, and persistent services.

The HackWednesday purple owl mascot standing among stylized trees for blog pages.
Editorial note: This AI-assisted article is published without a completed human review and should be read with extra scrutiny.

SafeDep reported on November 19 that the malicious npm package @leadstack/crm-connect used Hermes Agent as an attacker-controlled backdoor. Its investigation describes nine versions published on November 16 and says npm subsequently removed the package. The case puts an immediate AI security question in front of development teams: what can an ordinary dependency installation leave running after the build finishes?

According to SafeDep, an early version used a postinstall script to install the agent, retrieve configuration and instructions from attacker infrastructure, and connect it to a Telegram bot. A disguised systemd service provided persistence. Running the installation as root gave the agent root privileges; another version supported a user service. Later versions changed delivery mechanisms, so the report should not be read as nine identical agent implants. These are findings from package analysis, not a measurement of how many organizations were compromised.

The defensive implication is that agent governance must extend into build environments. Our recommendation is to run dependency installation in disposable environments with minimal privileges, restrict outbound connectivity, and keep production credentials out of the installation context. Review newly introduced lifecycle scripts and unexpected service creation alongside dependency changes. A familiar open-source agent can become dangerous when an attacker controls its configuration and execution identity.

npm documents that ignore-scripts prevents scripts in package.json from running. Teams can evaluate this setting for dependency installation, then explicitly review any required build steps. It is a limited control: npm says commands explicitly intended to run a script still run that requested script, although their pre- and post-scripts are suppressed. Disabling installation scripts also cannot make malicious code safe when an application later imports or invokes it. The npm documentation supports this control guidance; it does not independently corroborate the SafeDep incident.

This Wednesday, check dependency inventories and retained build logs for the reported package, then investigate unexpected persistent services and network activity on affected runners. If execution is confirmed, preserve evidence, isolate the runner, and assess credentials accessible to that process before rebuilding from a trusted baseline. The operational priority is to prevent an installation job from silently becoming a durable, remotely directed agent. Track both dependency execution and what survives it.

Source notes

Follow these links to check the reporting and documentation behind this article.

Explore related topics
Topic labels in other languages