By NHI Mgmt Group Editorial TeamDomain: Breaches & IncidentsSource: PantherPublished June 25, 2026

TL;DR: A two-stage npm supply chain attack let polymarket-stake-math disguise a clean math library before swapping in a 2,255-line infostealer that harvested browser sessions, crypto wallets, Telegram data, and cloud and developer secrets, then shifted delivery to hot-swappable Vercel infrastructure, according to Panther. The pattern shows why install-time review alone is no longer enough when developer endpoints hold both human credentials and non-human identity material.


At a glance

What this is: This is a supply chain malware analysis showing how a benign-first npm package turned into a staged infostealer targeting developer credentials, wallet keys, and cloud secrets.

Why it matters: It matters because developer machines often hold both human sessions and NHI material, so one compromised workstation can become a pivot into pipelines, wallets, and production access.

👉 Read Panther's analysis of the npm supply chain attack behind polymarket-stake-math


Context

npm supply chain abuse works because developers trust small utilities, especially when a package looks clean at first and only turns malicious later. In this case, the core security problem is not just malicious code in a registry, but the gap between package publication, installation-time checks, and what actually executes on the endpoint. The article also has a clear identity angle because stolen browser sessions, API tokens, and cloud credentials blur human and non-human identity boundaries.

The security lesson is straightforward: a build or install event can be the first stage of compromise, not the end of the decision. For IAM and PAM teams, the overlap matters because developer endpoints often contain reusable secrets, session cookies, and API tokens that behave like NHIs in practice, even when they are created and managed outside a formal identity governance process.


Key questions

Q: What breaks when malicious npm packages are reviewed only at publish time?

A: Publish-time review misses the key deception in staged supply chain attacks: the package can be clean when inspected and malicious only after installation or after a later version update. That means the real risk is runtime behaviour, especially postinstall hooks, file replacement, and outbound connections from lifecycle processes. Defenders need execution-time visibility, not just repository trust.

Q: Why do developer endpoints create such high identity risk?

A: Developer endpoints often hold browser sessions, API tokens, cloud keys, and wallet material in one place. Those assets behave like identities because they can authenticate actions without a human present, so compromise can lead to account takeover, pipeline access, or financial theft. The governance gap is treating them as local files instead of governed credentials.

Q: How do security teams detect hot-swappable supply chain payloads?

A: Use behavioural detections that look for install-time child processes, temporary extraction paths, file overwrites inside package directories, and unusual egress immediately after dependency installation. Hot-swappable payloads defeat single IOC matching because domains and hashes can change quickly, but their lifecycle behaviour is much harder to hide.

Q: Who is accountable when stolen developer tokens are reused to reach production systems?

A: Accountability is shared across endpoint security, IAM, and secrets governance because the compromise usually begins on a workstation but ends as an access-control failure. Teams should map the incident to identity lifecycle controls, secret storage rules, and privileged access boundaries so ownership is clear before the next compromise.


Technical breakdown

How the two-stage npm dropper works

The attack uses a staged design to separate trust from payload. Early package versions are clean and functional, which helps them pass casual review and routine scanning. A later version adds a postinstall hook that runs automatically and fetches or overwrites files after install, turning the package itself into a delivery mechanism. That matters because the package does not need to be malicious at publication time to become malicious at execution time. The attacker can keep the original source looking harmless while the runtime behavior changes after dependency resolution, extraction, and lifecycle execution.

Practical implication: inspect postinstall behavior and runtime egress, not just the published package contents.

Why environment-variable indirection makes detection harder

The dropper does not hardcode everything it needs. Package name, payload version, and C2 endpoint can be redirected through environment variables, which lets the operator change targets and infrastructure without republishing the package. That design weakens IOC-only defence because a single domain or hash can be swapped out quickly. It also means the same artifact can behave differently across victims, which complicates both forensic replay and registry takedown response. In practical terms, the persistence is in the delivery logic, not in any one indicator.

Practical implication: hunt for install-time process spawning, file replacement, and unusual outbound requests from package lifecycle hooks.

What the infostealer actually targets on developer systems

The payload is built to collect high-value material from developer endpoints, including browser passwords and cookies, wallet files, Telegram sessions, shell history, and cloud or developer tokens such as AWS, npm, GitHub, and PyPI credentials. That target set matters because it spans both access to personal accounts and access to non-human services. In identity terms, the attack turns a developer workstation into a secrets aggregation point where session state, token material, and local config files can all be harvested in one run.

Practical implication: treat developer endpoints as credential-rich assets and monitor for access to browser stores, wallet directories, and .env files.


Threat narrative

Attacker objective: The attacker’s objective is to steal developer credentials and session material that can be reused for direct financial theft, service takeover, and downstream pipeline access.

  1. Entry occurred through a trusted-looking npm package that was published as a clean utility before later versions turned malicious.
  2. Credential harvesting followed when the installed payload copied browser sessions, wallet material, shell history, and cloud tokens from the developer host.
  3. Impact came from multipart exfiltration to attacker-controlled infrastructure, creating a path to account takeover, wallet theft, and pipeline compromise.

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


NHI Mgmt Group analysis

Benign-first staging is now a core supply chain deception pattern. The package starts clean, then changes after trust has already formed, which makes single-scan review structurally weak. This is not just malware hiding in a registry, it is malware exploiting the assumption that publication time and execution time are the same. For IAM programmes, the lesson is that trust decisions around developer tooling need lifecycle monitoring, not one-time approval.

Developer endpoints function as shadow identity stores. The package targets browser cookies, API tokens, cloud keys, and chat sessions because all of them can operate like reusable identities in practice. That creates an identity governance blind spot: the organisation may manage formal users and service accounts while leaving local secret stores, browser state, and CLI tokens outside effective control. Practitioners should treat those assets as governed credentials, not just files on disk.

Hot-swappable delivery is a detection problem, not just a malware problem. The attacker’s ability to move from npm to a hosted payload server in hours shows that static indicators decay too quickly to anchor response. Delivery-channel agility: the real failure mode is assuming the registry, the package hash, or a single domain will remain stable long enough for manual remediation. Teams should build controls around install-time behaviour, process lineage, and egress monitoring.

Secrets management and identity governance now overlap at the endpoint. This campaign shows why NHI governance cannot stop at service-account inventories. Tokens, cookies, and local developer secrets can all be stolen, replayed, and chained into broader access, especially when workstation hygiene and access governance are treated as separate problems. The right control model is shared responsibility between IAM, endpoint security, and secrets governance.

Package identity spoofing is becoming more operationally credible. The use of a real-looking repository, plausible naming, and staged benign releases raises the bar for simple reputation checks. That makes software provenance, publisher history, and behavioural analytics part of identity assurance for code. Practitioners should assume that package identity can be manufactured just as easily as user identity when the goal is to reach secrets.

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.
  • From our research: Only 44% of developers are reported to follow security best practices for secrets management, according to The State of Secrets in AppSec.
  • That gap makes developer secret exposure a governance issue, not just a tooling issue, and the broader NHI confidence gap is documented in The State of Non-Human Identity Security.

What this signals

The next control boundary is the developer workstation, where browser state, CLI tokens, and local config files behave like identities in their own right. That creates a developer secret collapse problem: one compromise can expose both human sessions and machine-access credentials, so IAM, endpoint security, and secrets governance now need a shared operating model rather than separate response plans.

Teams should expect package-level supply chain abuse to blend into ordinary developer workflow noise, which makes install-time monitoring more valuable than registry reputation. The practical shift is toward continuous behavioural controls, backed by standards such as NIST SP 800-53 Rev 5 Security and Privacy Controls, especially where secrets, auditability, and system integrity intersect.

For identity programmes, the implication is that exposed secrets cannot stay in a backlog for weeks while remediation is organised. The remediation clock now starts at first compromise, not first detection, and the 27-day average leakage window from The State of Secrets in AppSec is already too long for an attacker that can hot-swap delivery infrastructure in hours.


For practitioners

  • Monitor install-time process behaviour Flag npm, yarn, or pnpm lifecycle processes that spawn node children, make outbound connections, or rewrite files inside node_modules after installation. This catches the dropper pattern more reliably than hash-based blocking alone.
  • Treat browser and token stores as governed credentials Inventory developer machines for Chrome, Firefox, wallet, Telegram, and CLI token stores, then include them in credential rotation and incident response playbooks. If those stores are exposed, assume the associated sessions and secrets are compromised.
  • Block secrets from living in local project files Prevent .env, config files, and shell history from containing long-lived credentials, and scan workstation and CI images for AWS, GitHub, npm, and PyPI tokens before and after package installs.
  • Use behaviour-based hunting for supply chain abuse Look for multipart exfiltration, temp-directory extraction, and package-file overwrites occurring immediately after install. Behavioural detections survive longer than a single C2 domain or one malicious package version.
  • Separate developer trust from runtime trust Require provenance review, maintain allowlists for critical packages, and add post-install integrity checks for packages that can touch credentials or build pipelines. A package that is safe to publish is not automatically safe to execute.

Key takeaways

  • This campaign shows how benign-first npm staging can bypass single-point package review and still end in credential theft.
  • The impact goes beyond developer laptops because browser sessions, wallet keys, and cloud tokens can all be harvested from the same endpoint.
  • Behaviour-based detection and secret governance must now extend into install-time activity, not just registry vetting or periodic scanning.

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 and MITRE ATT&CK address the attack and risk surface, while NIST CSF 2.0, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-03The article centres on secret exposure and stolen credentials from developer systems.
MITRE ATT&CKTA0006 , Credential Access; TA0010 , ExfiltrationThe attack harvests credentials and exfiltrates them through staged payload delivery.
NIST CSF 2.0PR.AC-1Identity and credential governance are central to limiting token reuse after compromise.
NIST SP 800-53 Rev 5IA-5Authenticator management covers the stolen tokens, keys, and session material in this attack.
CIS Controls v8CIS-5 , Account ManagementThe incident shows how unmanaged accounts and tokens expand blast radius after theft.

Map install-time credential theft and multipart exfiltration to ATT&CK and tune detections for both stages.


Key terms

  • Supply Chain Malware: Malware delivered through trusted software distribution paths such as packages, dependencies, or build tooling. It succeeds by inheriting trust from legitimate workflows, which makes publication-time checks insufficient if the malicious behaviour appears only after install or in a later version.
  • Preinstall Hook: A preinstall hook is package code that runs before an application installs or starts. In supply-chain attacks, it becomes a hidden execution point that can steal secrets, alter environments, or drop further payloads before normal controls see the package's behaviour.
  • Developer Secret: A developer secret is a credential used to access code, services, or infrastructure, such as an API key, SSH key, token, or certificate. In practice, it becomes an identity artifact when it can authorize action, not just authenticate a person. Its risk lies in spread, reuse, and weak revocation.
  • Behavioral Detection: A monitoring approach that looks for unusual activity rather than relying only on static inventories. For SaaS integrations, it detects drift in token use, data movement, timing, and endpoint behavior so teams can spot compromise, misuse, or automation that no longer matches its expected pattern.

What's in the full report

Panther's full analysis covers the operational detail this post intentionally leaves for the source:

  • Line-by-line breakdown of the dropper code and the exact postinstall sequence it uses.
  • File and process indicators tied to the Vercel-hosted payload pivot and multipart exfiltration.
  • Detection logic examples for npm lifecycle abuse, browser-store access, and wallet-directory harvesting.
  • IOC details for the package versions, publisher identities, and payload infrastructure.

👉 The full Panther post covers the attack chain, the payload logic, and the response guidance in detail.

Deepen your knowledge

NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, machine identity security, secrets management, and identity lifecycle control. It helps practitioners connect endpoint exposure to the access patterns their programmes are meant to govern.
NHIMG Editorial Note
Published by the NHIMG editorial team on August 1, 2026.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org