The MemTensor npm Worm: What It Means for AI Agent Supply Chain Security

Hamza Fazal, Founder, DEESUHamza FazalFounder, DEESUUpdated 8 min readCloud & DevOps

Between 02:23 and 05:55 UTC on September 23, 2026, security researchers watched a new kind of supply chain worm spread through npm and PyPI in real time. The target wasn't a general-purpose utility library like the ones hit in last year's Shai-Hulud waves — it was MemOS, an open-source memory framework that AI agents use to persist context across sessions, published by a company called MemTensor. Within hours it was being called the first supply-chain worm built specifically to target AI agent memory infrastructure, and it's been covered across Semgrep, StepSecurity, Aikido, Wiz, and half a dozen other security research blogs in the week since. For any team building, deploying, or even just depending on AI agent tooling, this is the npm supply chain attack worth actually reading past the headline on, because the mechanics reveal gaps that last year's defenses don't cover.

What actually happened on September 23

The attacker compromised the GitHub account of a MemTensor maintainer (leason1974) and used it to push malicious releases of @memtensor/memos-cloud-openclaw-plugin — versions 0.1.21, 0.1.23, and 0.1.25 — to npm, alongside a matching malicious release of the MemoryOS package (2.0.34) on PyPI. The telltale sign researchers flagged almost immediately: the published packages had no gitHead, meaning they didn't come from the project's normal CI workflow at all. Someone was publishing directly, bypassing the pipeline entirely.

The payload is a cross-platform Go binary called sckit, bundled in six variants covering Linux, macOS, and Windows on both AMD64 and ARM64. It harvests npm, PyPI, GitHub, GitLab, AWS, HashiCorp Vault, Hugging Face, Slack, Stripe, and SendGrid credentials, along with SSH keys and environment variables, then exfiltrates everything to attacker-controlled infrastructure and carries templates to reinstall itself into other packages and GitHub Actions workflows it can reach — the same self-propagating pattern that made the original Shai-Hulud worm so hard to contain in 2025.

Why this is a genuinely new kind of AI agent supply chain security problem

npm shipped v12 back in July 2026 specifically to blunt attacks like this, disabling preinstall, install, and postinstall scripts by default — the mechanism nearly every prior npm worm relied on to execute the moment a package was installed. It wouldn't have stopped this one. The MemTensor payload doesn't run on install at all; it runs on import, and specifically whenever the compromised plugin handles a memory-recall event inside an agent's runtime. That's a meaningfully different attack surface than a postinstall script, and it's one that's specific to how AI agent frameworks are built: a memory plugin that's wired into an agent's recall path runs constantly, with access to whatever the agent is currently working on.

That last detail is the part that should actually worry teams running agents in production: the launcher passes the host process environment to the malicious binary at startup, and during each recall event it also passes the user's prompt text directly to it. This isn't just credential theft bolted onto a popular package — it's a worm built to sit inside an AI agent's own memory path and watch what the agent is being asked to do, which is a new category of exposure that standard npm or PyPI dependency scanning wasn't built to catch, because the package itself behaves normally until the agent actually calls it.

The CI pipeline hole this exposes

How did the attacker get a legitimate maintainer's publish token in the first place? Not through phishing this time — through the project's own GitHub Actions release pipeline. The attacker modified a validation script to inject a path into the BASH_ENV environment variable pointing at a malicious shell script, so that script ran automatically before the real npm publish step executed, handing over the token the workflow held. It's a reminder that a CI pipeline holding a long-lived publish token is itself an attack surface, independent of whatever supply chain hygiene a project practices around its own dependencies.

The fix that actually closes this gap, rather than just reacting to the next incident, is moving npm and PyPI publishing off long-lived tokens entirely and onto OIDC-based trusted publishing — both npm and PyPI now support it. Instead of a secret sitting in repository settings indefinitely, GitHub Actions exchanges a short-lived JWT, cryptographically bound to a specific repository, workflow, and environment, for a publish credential that expires in minutes. A BASH_ENV injection or any other mid-pipeline compromise still can't hand over a credential that's no longer there to steal.

What this means if you're adopting AI agent frameworks right now

AI agent tooling is one of the fastest-moving dependency categories any team is pulling into production right now, and it's also one of the least scrutinized — memory frameworks, tool-calling plugins, and orchestration libraries are often months old, maintained by small teams, and installed with the same blind trust as a decade-old utility package. The MemTensor incident is a direct argument for treating that category differently: pin exact versions and commit lockfiles for any AI agent dependency, review diffs on every version bump rather than auto-updating, and specifically check whether a package's publish history lines up with its actual CI runs — a release with no gitHead, like this one, is exactly the kind of anomaly a quick look at npm's package page would have surfaced before installing.

This is also a case where generic dependency scanning isn't enough on its own. A scanner built to flag known-malicious packages after the fact is reacting to Tuesday's incident, not this one from eight days ago. SBOM generation and continuous monitoring for newly published versions of what you depend on catch this class of attack faster than periodic audits do, and that gap matters more for AI agent dependencies specifically, given how actively that ecosystem is being targeted right now.

What to do if you might be affected

  1. Identify exposure. Search lockfiles and installed environments for the affected package names and versions.
  2. Assume secrets on those machines are compromised. Rotate npm and PyPI tokens, cloud keys, GitHub and GitLab credentials and SSH keys.
  3. Check for new or changed access. Review recent logins, repository changes and published packages for activity you do not recognise.
  4. Rebuild from a clean state. Do not trust an environment that ran the compromised code.
  5. Tell people. Customers and teammates need to know which credentials were rotated and why.

Hardening a dependency workflow for agent tooling

  • Lockfiles are committed and installs in CI use them exactly.
  • New dependency versions are not adopted automatically in production builds.
  • Packages without provenance, or with unexpected publisher changes, raise a flag in review.
  • Agent frameworks and plugins run with the minimum credentials they need, in isolated environments.
  • Secrets are not exposed as ambient environment variables to code that does not need them.
  • A software bill of materials is generated for each release.

Publishing safely: trusted publishing in practice

Trusted publishing replaces a stored secret with a short-lived credential that your CI provider issues for a specific repository and workflow. If an attacker cannot read a long-lived token because none exists, an entire attack path closes.

  • Configure npm and PyPI to trust a specific repository, workflow file and environment.
  • Give the publishing workflow only the permissions it needs, and protect the release environment with required reviewers.
  • Pin third-party actions to full commit hashes and review changes to workflow files like code.
  • Treat edits to release scripts as security-sensitive changes.

What we'd actually recommend

If you're running any MemTensor MemOS packages — @memtensor/memos-cloud-openclaw-plugin or the MemoryOS PyPI package — treat every credential on any machine that installed versions 0.1.21, 0.1.23, 0.1.25, or 2.0.34 as compromised and rotate it: npm and PyPI tokens, GitHub and GitLab credentials, cloud keys, SSH keys, and anything else sckit was built to harvest. Don't wait for confirmation that your specific environment was hit; the rotation is cheap and the alternative isn't.

More broadly, audit any CI/CD release pipeline that still publishes with a long-lived npm or PyPI token sitting in repository secrets, and move it to OIDC-based trusted publishing — that single change would have stopped this exact attack chain at the point of credential theft, not after the fact. And before pulling in the next AI agent framework, memory plugin, or tool-calling library, give it the scrutiny you'd give a dependency with direct access to production credentials, because for an agent wired into its own memory and tool-calling path, that's precisely what it has. The convenience of these frameworks is real; so is the fact that this attack surface barely existed eighteen months ago and is now being actively targeted.

Frequently asked questions

The malicious code ran when the package was imported and used, not during installation, so disabling install scripts does not stop it.

A way for CI to prove its identity to npm or PyPI with a short-lived token tied to a repository and workflow, instead of storing a long-lived secret.

Look for missing provenance, unexpected publisher or maintainer changes, new network behaviour and releases that do not match the repository's tags.

They are often young and fast-moving and sit close to prompts and credentials, which raises the stakes. They deserve the same scrutiny as any critical dependency.

Yes. Our Cloud and DevOps service includes pipeline setup and security reviews. Send a brief to start.

Sources

ShareLinkedInX
Hamza Fazal, Founder, DEESU

Written by

Hamza Fazal

Founder, DEESU

Muhammad Hamza Fazal is the Founder of DEESU. An Android and full-stack web developer and digital marketer based in Islamabad, he founded DEESU in May 2022 and leads its engineering operations, product strategy, and client software delivery.

More from Hamza

Need help with this?

Reply within 1 business day

Tell us what you're building.

Send the problem, not a polished brief. We'll tell you what it actually takes to ship it: stack, timeline and cost, before you commit to anything.