By NHI Mgmt Group Editorial TeamPublished 2026-04-01Domain: Breaches & IncidentsSource: WorkOS

TL;DR: A hijacked npm maintainer account turned Axios into a supply chain weapon, and malicious versions executed a cross-platform RAT during a two-to-three-hour exposure window, according to WorkOS. Lockfiles, provenance, and script controls help, but this incident shows that package identity trust still breaks faster than most teams can detect it.


At a glance

What this is: Axios was compromised through a hijacked npm maintainer account, allowing malicious package versions to execute a remote access trojan during a short exposure window.

Why it matters: IAM and security teams should treat package registries as identity systems because token hygiene, publishing trust, and lifecycle controls now shape supply chain risk across NHI, autonomous, and human programmes.

By the numbers:

👉 Read WorkOS's analysis of the Axios npm supply chain compromise


Context

The Axios compromise is a supply chain identity failure, not just a malware incident. A long-lived npm token, a maintainer account takeover, and an unexpected dependency allowed attacker code to run inside developer and CI environments before most teams could react.

For IAM and NHI programmes, the lesson is that publishing trust is part of identity governance. Package registries, automation tokens, and lifecycle scripts behave like privileged non-human identities, which means rotation, provenance, and approval boundaries matter as much here as they do in cloud infrastructure.


Key questions

Q: What breaks when a trusted npm package publisher is compromised?

A: When a trusted publisher is compromised, registry trust collapses because malicious code can arrive through a legitimate release path. The immediate failure is not only package integrity, but also the downstream assumption that a maintainer identity is a reliable control point. In practice, one hijacked publishing account can turn install-time trust into broad credential exposure.

Q: Why do package registries create NHI governance risk?

A: Package registries create NHI governance risk because publishing tokens, automation accounts, and CI identities behave like privileged non-human identities. If those identities are long-lived or poorly scoped, they can be abused to release code, alter dependencies, and trigger execution across many downstream systems. That makes lifecycle control and provenance part of identity governance, not just software hygiene.

Q: How do security teams know if install-time scripts are unsafe?

A: Install-time scripts are unsafe when they can execute automatically from packages that have not been fully trusted or provenance-checked. A practical warning sign is any package that adds a new dependency, changes its release shape, or requires script execution without a clear business reason. Teams should treat automatic script execution as privileged code path access.

Q: Who is accountable when malicious code enters through a package registry?

A: Accountability usually spans the package maintainer, the registry controls, and the consuming organisation’s build governance. The maintainer identity is the publishing control point, but the consumer still owns script restrictions, lockfile enforcement, and credential protection on build systems. The right question is who owned each control layer, not who noticed the attack first.


Technical breakdown

Maintainer account takeover and token abuse

The attacker’s entry point was account control, likely through a stolen long-lived npm classic access token. Once the maintainer account was compromised, the registry no longer saw an obvious intrusion, only an apparently legitimate publish. That is the core weakness of token-based publishing when credentials live too long and do not carry enough provenance or binding to the publishing context. In practice, the security boundary is the identity used to publish, not the repository that later consumes the package.

Practical implication: publishing identities need short-lived credentials, strong MFA, and auditable provenance for every release.

Postinstall scripts as code execution

The malicious dependency used a postinstall script, which means code executed automatically during package installation. In Node.js ecosystems, lifecycle scripts are often treated as convenience, but they are effectively execution privileges granted to transitive dependencies. Once a package can run a script at install time, it can fingerprint the host, retrieve second-stage payloads, and establish persistent access before the application even starts.

Practical implication: restrict lifecycle scripts for untrusted packages and treat install-time execution as a privileged action.

Dependency substitution and registry trust

The attack also inserted a decoy dependency, plain-crypto-js, to make the malicious release look normal inside the dependency graph. This is a classic trust-abuse pattern in supply chain compromises: the package name, version, and dependency shape are used to disguise intent. For defenders, the real problem is not just malware detection after install, but validating whether a new dependency belongs in the graph at all.

Practical implication: monitor for unexpected transitive dependencies and require provenance checks before accepting new package paths.


Threat narrative

Attacker objective: The objective was to turn a trusted package publish path into broad downstream credential access and machine compromise across developer environments.

  1. Entry occurred when the attacker compromised the npm maintainer account and changed the registered email to attacker-controlled infrastructure, which gave them publishing control over Axios releases.
  2. Escalation happened when malicious versions added a runtime dependency and postinstall script that executed automatically during npm install, enabling host fingerprinting and second-stage retrieval.
  3. Impact followed as the payload deployed a remote access trojan capable of credential theft, reconnaissance, and persistence across developer and CI/CD machines.

Read our 52 NHI Breaches Analysis report for a comprehensive view of breaches impacting Non-Human Identities including AI Agents.


NHI Mgmt Group analysis

Package publishing trust is a privileged NHI problem, not a developer convenience problem. The Axios incident shows that npm tokens, maintainer accounts, and release workflows function as non-human identities with real blast radius. When those identities are long-lived or weakly bound to release context, a single compromise can push malicious code at scale. The practitioner conclusion is that package publishing must be governed like any other privileged non-human access path.

Dependency graph trust broke because the registry accepted a plausible release shape, not because the code was obviously hostile. The attacker used a decoy package and a runtime dependency to blend malware into an ordinary install path. That means integrity controls have to examine provenance, unexpected dependency changes, and install-time behaviour together. The practitioner conclusion is that dependency approval cannot rely on version strings alone.

Standing publish privilege is the named failure mode this attack illustrates. The attacker likely benefited from a long-lived npm classic access token, which was designed for durable publishing access. That assumption fails when a publishing identity can be hijacked and immediately used to release malware under a trusted maintainer name. The implication is that release authority needs tighter lifecycle boundaries than traditional human-centric developer access models provide.

Lockfiles are necessary, but they do not repair compromised identity trust. The attack window was short enough that some teams were protected by pinned versions and script suppression, while others were exposed through fresh installs and automation. This shows that build controls reduce exposure, but they do not solve the upstream question of who can publish trusted artifacts. The practitioner conclusion is that supply chain governance has to cover both install-time enforcement and publisher identity governance.

Open-source package ecosystems are now identity attack surfaces with downstream IAM impact. Once malicious code executes in a developer or pipeline context, it can reach cloud keys, SSH credentials, environment variables, and repository tokens. That makes package compromise an IAM event as much as a malware event. The practitioner conclusion is that security teams should align package provenance, secret handling, and workload identity controls under one governance model.

From our research:

  • The average estimated time to remediate a leaked secret is 27 days, despite 75% of organisations expressing strong confidence in their secrets management capabilities, according to The State of Secrets in AppSec.
  • Only 44% of developers are reported to follow security best practices for secrets management, exposing a significant behaviour gap that supply chain attacks can exploit.
  • That gap reinforces why teams should pair package provenance controls with the 52 NHI Breaches Analysis and review how compromise moves from identity abuse to credential theft.

What this signals

Package identity is now part of the same governance surface as cloud and CI identities. Teams that still treat npm tokens and maintainer accounts as developer convenience are missing the real risk: publishing identity can become the fastest route from a trusted release to enterprise credential theft. The control conversation has to move from code review alone to release provenance, token lifecycle, and install-time execution boundaries.

Standing publish privilege is the deeper design flaw exposed here. Long-lived publishing access was built for continuity, but supply chain attackers exploit continuity as a persistence mechanism. That means security and platform teams should review whether their package governance assumes stable human control in a registry that now behaves like a high-value non-human identity system.

With 27 days as the average estimated remediation time for a leaked secret, compromised build or developer credentials can remain useful long after the original package incident has been contained. Teams should assume that package compromise is a credential governance event and prepare monitoring, rotation, and revalidation workflows accordingly.


For practitioners

  • Shorten and harden package publishing credentials Replace long-lived npm classic tokens with granular, short-lived publishing credentials, enforce MFA on maintainer accounts, and review who can publish under each package namespace.
  • Block install-time execution for untrusted packages Use npm install --ignore-scripts in CI/CD where possible, and only allow lifecycle scripts for packages that have been explicitly trusted and reviewed.
  • Require provenance before accepting releases Treat unsigned or non-provenanced releases as suspicious, especially when a critical package gains a new dependency or version pattern without a clear source lineage.
  • Detect unexpected transitive dependency changes Alert on new dependencies appearing in high-trust packages, because the sudden addition of a package such as plain-crypto-js is often the first sign of tampering.
  • Isolate and re-image impacted build machines If malicious install-time code ran, assume full credential exposure on the affected machine, isolate it, and rebuild from a verified clean image before restoring access.

Key takeaways

  • The Axios compromise shows that package publishing identities can be more dangerous than the code they release when token hygiene and provenance are weak.
  • Its short exposure window still created meaningful downstream risk because install-time scripts can turn a trusted dependency into immediate machine compromise.
  • Preventing a repeat requires treating npm publishing, lockfile enforcement, and script execution as one identity governance problem.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST CSF 2.0 and NIST Zero Trust (SP 800-207) set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-01Publish-token abuse and package trust failures map to NHI identity control gaps.
NIST CSF 2.0PR.AC-1Registry access and build identity are access-control issues, not just code issues.
NIST Zero Trust (SP 800-207)PR.AC-4Install-time trust should be continuously verified, not assumed from package reputation.

Review privileged package-publishing access and remove standing credentials where possible.


Key terms

  • Package Publishing Identity: The account, token, or workflow that authorises a software package release into a registry. In practice, this identity behaves like a privileged non-human identity because compromise lets an attacker publish trusted code to many downstream consumers.
  • Postinstall Script: A package lifecycle hook that runs automatically after installation. It is useful for legitimate setup tasks, but it also creates an execution path that can be abused to run malicious code as soon as a dependency is installed.
  • Dependency Provenance: Evidence that a package release came from the expected source, build pipeline, and repository state. Provenance matters because version numbers alone do not prove trust, and malicious actors can use legitimate-looking releases to hide harmful code.
  • Standing Publish Privilege: Persistent authority to release or update a package without temporary approval or expiry. This creates risk because the same access that supports routine maintenance can be hijacked and reused immediately for malicious publishing.

Deepen your knowledge

Package publishing trust and secret hygiene are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If your team is responsible for build pipelines, dependency controls, or developer identities, it is worth exploring.

This post draws on content published by WorkOS: The Axios npm supply chain attack and what developers need to know. Read the original.

NHIMG Editorial Note
Published by the NHIMG editorial team on 2026-04-01.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org