AI Coding Assistant Hijack Spreads Shai-Hulud Worm

Authors: Cloud Security Alliance AI Safety Initiative
Published: 2026-09-18

Categories: AI Supply Chain Security
Download PDF

Key Takeaways

Mandiant’s “AI Risk and Resilience Report 2026” discloses a supply chain intrusion at an unnamed software-as-a-service provider in which an attacker hijacked an active AI coding-assistant session on a developer’s workstation and used it to seed the Shai-Hulud worm across roughly 100 internal code repositories [1][2]. According to the public case study, the assistant recommended an external package that the attacker had already poisoned; once the developer accepted that recommendation, the attacker used the live session to install an information stealer through a compromised PyPI package and harvested the developer’s GitHub OAuth tokens, which the worm then used to self-propagate and exfiltrate repository secrets and source code [1]. A second employee was infected when the worm republished a poisoned package inside the company’s own npm namespace [1]. Based on the mechanics Mandiant describes, this second infection appears to have required no further action by the attacker beyond the initial session hijack, illustrating how a single hijacked session can cascade into an organization-wide compromise. Mandiant did not name the victim, disclose when the intrusion occurred, or explain how the attacker gained control of the assistant session in the first place, leaving the initial-access vector as the case study’s most significant open question [1][2]. The same Mandiant report attributes a related pattern of AI supply chain abuse to the financially motivated threat actor UNC6780, tracked elsewhere as TeamPCP, which has used more than half a dozen distinct techniques to compromise PyPI, npm, and Docker Hub packages and to manipulate AI coding assistants and LLM-based security scanners through prompt injection [3][4]. For security leaders, the case study is significant not as an isolated incident but as further evidence that AI coding assistants function as a trusted decision-making layer inside the software supply chain, one that attackers can now target directly rather than only through the dependencies it recommends.

Background

Shai-Hulud is not a new name in supply chain security. Security researchers and CISA first disclosed the worm in September 2025, when it spread through the npm ecosystem by stealing developer and maintainer credentials — widely reported at the time to have begun with the compromise of the “s1ngularity/Nx” GitHub account — and using stolen npm tokens to automatically republish backdoored versions of any package the victim had publish rights to [5]. That original campaign compromised more than 500 npm packages, harvested secrets from CI/CD environments and cloud metadata endpoints, and created public GitHub repositories containing dumps of stolen credentials as a signature of infection [5]. Microsoft documented a second wave, “Shai-Hulud 2.0,” in December 2025, describing continued self-replication through compromised maintainer accounts and offering detection and defense guidance for the npm ecosystem [6]. By mid-2026, the threat actor associated with the framework, TeamPCP, had open-sourced a “Mini Shai-Hulud” toolkit [12]; one campaign that followed, tracked as Miasma, compromised 32 packages inside Red Hat’s @redhat-cloud-services npm scope and reached more than 80,000 weekly downloads, or roughly 320,000 per month, before it was contained, suggesting the toolkit lowered the barrier to entry for copycat activity [11].

The September 2026 case study Mandiant describes represents a distinct evolution of this lineage rather than a simple repeat of it. Earlier Shai-Hulud campaigns propagated primarily through stolen npm publishing credentials and compromised maintainer accounts [5][6]; in CSA’s assessment, that mechanism is one defenders can address through token rotation, provenance attestation, and account hardening. The incident Mandiant investigated instead began with the compromise of an active AI coding-assistant session, a channel that sits closer to the developer’s own trust decisions than a registry credential does [1]. The assistant’s package recommendation was the point of initial compromise, and the developer’s acceptance of that recommendation was sufficient to give the attacker a foothold inside the SaaS provider’s internal environment [1]. In this analysis, that acceptance was an otherwise ordinary interaction with a tool explicitly designed to be trusted, which is precisely why the compromise succeeded. Mandiant’s report situates this case alongside a broader pattern of AI supply chain abuse it attributes to UNC6780, which has used prompt injection to manipulate both AI coding assistants and the LLM-based security scanners meant to catch malicious code, including hiding payloads inside project directories and files that coding assistants treat as legitimate project context [3][4]. Whether the SaaS provider incident and UNC6780’s broader campaign share the same operator is not established in the public reporting; Mandiant presents them as separate findings within the same report rather than as a single attributed operation [1][2][3].

Security Analysis

The mechanism Mandiant describes exposes a trust boundary that many organizations’ security architectures do not yet account for: the AI coding assistant itself, rather than only the packages it touches, is now a viable initial-access vector. In a conventional supply chain compromise, a developer evaluates a dependency, however cursorily, before adopting it. When an AI assistant makes that recommendation instead, the evaluation step is plausibly skipped more often or reduced to a single acceptance click, since the assistant’s suggestion inherits an implicit credibility that a cold search result or a stranger’s pull request would not receive. CSA’s own research on AI coding assistants as an attack surface has documented this dynamic independently, finding that AI-assisted commits leak secrets at more than double the baseline rate and that more than 24,000 unique secrets have been found exposed in Model Context Protocol configuration files alone, a pattern consistent with assistants operating with more privilege and less scrutiny than the humans they are meant to support [8]. The Mandiant case study adds a sharper edge to that finding: it is not only that AI-assisted workflows leak secrets faster, but that the assistant’s own recommendation surface can be the initial payload delivery mechanism, with everything downstream, credential theft, self-propagation, and secondary infection, following automatically once that first recommendation is accepted.

The self-propagation phase of the incident follows the same worm mechanics CSA and other researchers have tracked since the original Shai-Hulud disclosure: once the attacker obtained GitHub OAuth tokens through the infostealer, the worm used those tokens to spread across roughly 100 internal repositories and to poison a package inside the company’s own namespace, which is what produced the second infection [1][5]. This is consistent with the pattern CSA’s research note on Shai-Hulud’s targeting of AI developer toolchains describes, in which stolen developer credentials are used to inject malicious code into other packages and republish them autonomously, with persistence mechanisms such as modified Git hooks and semantic-release patches designed to survive a first round of token rotation [7]. The practical implication is that credential theft inside an AI-assisted development environment does not stay contained to the single compromised workstation; because coding assistants, CI/CD systems, and internal package registries are all connected by the same developer credentials, a single accepted recommendation can escalate into an organization-wide incident within a single session, often faster than manual detection processes can respond.

Mandiant’s three recommended controls for AI-assisted development, checking AI-recommended third-party dependencies against cryptographic checksums and approved allowlists, keeping raw API keys and long-lived OAuth tokens out of direct reach of assistant extensions, and routing dependency traffic through controlled internal repositories, target the propagation phase of the attack rather than the initial-access phase [1][3]. That is a reasonable prioritization given what is publicly known, since the case study does not explain how the attacker took over the assistant session in the first place, but it also means the control set does not close the door on the entry vector that made this incident distinct from earlier Shai-Hulud campaigns. Organizations that adopt Mandiant’s dependency-verification and secret-isolation controls will reduce the odds that a compromised assistant session escalates into a worm outbreak, but they will not by themselves prevent an attacker from hijacking the session, through a compromised extension, a poisoned MCP server, or a stolen assistant credential, in the first place. Security teams should treat the session itself, not just the dependencies it recommends, as a control point requiring its own authentication, monitoring, and anomaly detection.

The following table summarizes how the propagation mechanics of this incident compare to the earlier Shai-Hulud and Miasma campaigns, illustrating both the continuity in worm behavior and the discontinuity in initial access.

Campaign Disclosed Initial Access Propagation Mechanism Scale
Shai-Hulud (original) September 2025 Stolen maintainer/npm credentials via account phishing [5] Auto-republish of packages using stolen npm tokens 500+ npm packages [5]
Shai-Hulud 2.0 December 2025 Compromised maintainer accounts [6] Continued credential-based self-replication Ecosystem-wide npm re-infection [6]
Miasma (Red Hat) June 2026 Mini Shai-Hulud toolkit reuse [12] Worm compromise of scoped npm namespace 32 packages, 80,000+ weekly downloads (~320,000/month) [11]
SaaS provider (Mandiant case study) September 2026 Hijacked AI coding-assistant session; poisoned package recommendation accepted [1] GitHub OAuth token theft; internal repository self-propagation ~100 internal repositories [1]

Recommendations

Immediate Actions

Security teams should inventory every AI coding assistant, IDE extension, and Model Context Protocol server in active use across development environments and confirm that none of them hold direct, standing access to long-lived npm tokens, GitHub OAuth tokens, cloud credentials, or LLM API keys, since Mandiant’s case study shows that an attacker who gains control of an assistant session can immediately weaponize whatever credentials that session can reach [1][3]. Organizations should also establish, if they have not already, a checksum or allowlist verification step for any third-party package an AI assistant recommends, so that a poisoned dependency cannot reach a developer’s environment purely on the strength of the assistant’s suggestion [3]. Any organization that identifies unexplained package publications, unfamiliar Git hooks, or semantic-release configuration changes in its own namespaces should treat those as potential indicators of the same self-propagation behavior documented in this and prior Shai-Hulud campaigns and should rotate all developer and CI/CD credentials immediately rather than assuming the anomaly is isolated [5][7].

Short-Term Mitigations

Enterprises should route AI-recommended dependencies through an internally controlled package repository or proxy rather than allowing direct installation from public registries, which gives security teams a chokepoint to apply provenance and integrity checks before code reaches a developer’s machine [1][3]. Secret management practices should be extended explicitly to AI assistant extensions and MCP server configurations, since CSA’s research on AI coding assistants as an attack surface found that AI-assisted commits leak secrets at more than double the baseline rate and that MCP configuration files alone have exposed tens of thousands of unique secrets, a risk surface that predates and compounds the specific worm-propagation risk this case study describes [8]. Development teams should also apply least-privilege scoping to the OAuth tokens and API keys used by coding assistants themselves, limiting what a compromised session can reach even if the underlying credential theft succeeds, and should monitor assistant activity for anomalous package installation requests or unusual outbound network connections that would indicate an active session has been hijacked.

Strategic Considerations

Because Mandiant’s public case study leaves the initial-access mechanism undisclosed, organizations should not assume that dependency verification and secret isolation alone are sufficient; security architecture for AI-assisted development needs to treat the assistant session as an authenticated, monitored resource in its own right, comparable to a privileged service account, rather than as a transparent extension of the developer’s own identity. This means extending existing identity and access management practices, session timeout policies, anomaly detection, and step-up authentication for sensitive actions, to AI coding assistants specifically, rather than relying solely on the credential-hygiene controls that address propagation after a session is already compromised. Given that TeamPCP and other actors have already demonstrated repeatable techniques for manipulating AI coding assistants and the LLM-based scanners meant to catch malicious code through prompt injection, organizations should also expect that any single defensive control, whether dependency allowlisting, secret isolation, or scanner review, can itself become a target, and should plan for layered, overlapping controls rather than a single point of verification [3][4].

CSA Resource Alignment

CSA’s Shai-Hulud: npm Worm Targeting AI Developer Toolchains is the most directly relevant prior CSA analysis, having tracked this same worm family across three earlier campaigns and documented the exact self-propagation mechanics, credential theft followed by autonomous republishing, that reappear in Mandiant’s SaaS provider case study, along with persistence techniques such as modified Git hooks and semantic-release patches designed to survive credential rotation [7]. Security teams responding to this new case study should treat that note’s recommended controls, immediate rotation of npm, GitHub, cloud, SSH, and LLM API credentials, audit of Git configurations and GitHub Actions workflows, and MCP server configuration review across common coding assistants, as directly applicable, since the underlying propagation behavior Mandiant observed matches what CSA had already characterized.

CSA’s AI Coding Assistants as Attack Surface: Code, Skills, and Secrets supplies the broader context for why the assistant session itself, rather than only the dependencies it touches, is a viable point of compromise. Its finding that AI-assisted commits leak secrets at more than double the baseline rate, and that tens of thousands of unique secrets have already been found exposed in MCP configuration files, helps explain why an attacker who hijacks a single assistant session can move as quickly as Mandiant describes: the credentials needed for propagation are frequently already within reach of the compromised session rather than requiring a separate escalation step [8].

CSA’s TeamPCP (UNC6780): AI Supply Chain’s Most Active Threat Actor profiles the threat actor Mandiant’s report links to the broader pattern of prompt injection against AI coding assistants and LLM security scanners, documenting campaigns against Trivy, LiteLLM, xinference, and a trojanized VS Code extension that breached GitHub’s own internal repositories [9]. Its recommendation to pin dependencies to immutable commit SHAs rather than floating tags, and to treat any exposed credential as compromised rather than merely suspicious, applies directly to organizations assessing their exposure to the same actor class described in Mandiant’s report. CSA’s dedicated notes on the Miasma campaign and the Mini Shai-Hulud toolkit provide further detail on the copycat activity that followed TeamPCP’s open-sourcing of its tooling and should be consulted alongside the TeamPCP profile for a fuller picture of the ecosystem this case study sits within [11][12]. Underlying all four of these more specific artifacts, CSA’s AI Controls Matrix (AICM) v1.1 provides the governance baseline, spanning threat and vulnerability management and identity and access management domains, that organizations can use to formalize AI coding assistant sessions as a controlled resource class rather than an implicitly trusted extension of developer identity [10].

References

[1] The Hacker News. “Attacker Hijacks AI Coding Assistant Session, Spreads Shai-Hulud Across About 100 Repositories.” The Hacker News, September 16, 2026.

[2] Google Cloud. “Mandiant AI Risk and Resilience Report 2026.” Google Cloud, September 2026.

[3] iTWire. “Attackers turn AI coding tools and agent skills into supply-chain entry points.” iTWire, September 2026.

[4] Help Net Security. “One runaway AI agent racked up a $50,000 cloud bill.” Help Net Security, September 16, 2026.

[5] Cybersecurity and Infrastructure Security Agency. “Widespread Supply Chain Compromise Impacting npm Ecosystem.” CISA, September 23, 2025.

[6] Microsoft. “Shai-Hulud 2.0: Guidance for detecting, investigating, and defending against the supply chain attack.” Microsoft Security Blog, December 9, 2025.

[7] Cloud Security Alliance. “Shai-Hulud: npm Worm Targeting AI Developer Toolchains.” Cloud Security Alliance, 2026.

[8] Cloud Security Alliance. “AI Coding Assistants as Attack Surface: Code, Skills, and Secrets.” Cloud Security Alliance, April 2026.

[9] Cloud Security Alliance. “TeamPCP (UNC6780): AI Supply Chain’s Most Active Threat Actor.” Cloud Security Alliance, 2026.

[10] Cloud Security Alliance. “AI Controls Matrix (AICM) v1.1.” Cloud Security Alliance, 2026.

[11] Cloud Security Alliance. “Miasma: Red Hat npm Supply Chain Worm.” Cloud Security Alliance, 2026.

[12] Cloud Security Alliance. “Mini Shai-Hulud: TeamPCP Worm Targets AI Developer Toolchain.” Cloud Security Alliance, 2026.

← Back to Research Index