threatdeck
Live 13:45 UTC ·

Learn / Securing AI coding assistants in an organisation

Lesson 5 of 610 minReviewed

Supply chain: malware that drives your agent, poisoned tools and instruction files

Learn from s1ngularity, Shai-Hulud, the Amazon Q extension compromise, package hallucination and hidden-Unicode rules files, and map each to a control you can deploy.

Coding assistants change the software supply chain in two directions. Malware that lands on a developer machine can now drive the AI agent that is already installed and authorised there, and the assistant itself, its extensions and the packages it suggests, become dependencies an attacker can target.

Malware that drives your AI CLI

On 26 August 2025, malicious versions of the nx build package and several plugins were published to npm. Their post-install script searched the file system, wrote a list of paths to /tmp/inventory.txt, uploaded the results to a new repository under the victim's own GitHub account with s1ngularity-repository in its name, and appended a shutdown command to .bashrc and .zshrc [1]. Wiz found that the malware called the locally installed Claude, Gemini and Q command-line tools with --dangerously-skip-permissions, --yolo and --trust-all-tools to do the file search, and counted over a thousand valid GitHub tokens among the leaked data [2].

The lesson is not that one tool was unsafe; it is that every bypass flag on every installed agent is now a capability available to any code that runs as the developer. Disable bypass modes in managed settings where the tool supports it, and alert on AI CLIs started non-interactively with bypass flags by a script interpreter.

In September 2025 the Shai-Hulud worm compromised more than 500 npm packages: it harvested GitHub tokens and AWS, Google Cloud and Azure keys, then used stolen npm credentials to publish infected versions of the victims' other packages. CISA's guidance was to rotate all developer credentials, pin dependencies to releases from before 16 September 2025 and require phishing-resistant MFA on developer accounts [3].

The assistant is a dependency too

In July 2025 AWS disclosed that version 1.84.0 of the Amazon Q Developer extension for VS Code shipped with malicious code, committed through an over-scoped GitHub token in a CodeBuild configuration. A syntax error stopped it from running; AWS pulled the version and told customers to move to 1.85.0 (CVE-2025-8217) [4]. Pin extension and CLI versions through your software management, and treat an advisory for an AI tool like any other dependency advisory.

Suggested packages carry their own risk. Across 576,000 generated code samples from 16 models, Spracklen and colleagues found that at least 5.2% of package references from commercial models and 21.7% from open-source models named packages that did not exist, 205,474 unique names in all [5]. An attacker who registers a frequently hallucinated name gets installed by anyone who accepts the suggestion. Route installs through a registry proxy, and block packages that are new or have no history.

Instruction files are code

Claude Code loads a repository's CLAUDE.md, or its AGENTS.md, as instructions in every session [6], and Cursor reads project rules from .cursor/rules [7]. Pillar Security showed in March 2025 that rules files for Cursor and GitHub Copilot could carry instructions hidden with invisible Unicode characters, steering generated code while looking harmless in review; GitHub later added a warning for hidden Unicode text on github.com [7].

  • Require code-owner review for instruction, rules, .mcp.json and agent settings files.
  • Scan those files and pull requests for invisible and bidirectional Unicode characters.
  • Rotate tokens on any machine where a compromised package or extension version was installed.

Try it on ThreatDeck

Self-check

4 questions

Pick an answer to see whether it is right and why. Only your score is saved, in this browser.

  1. What was new about how the s1ngularity malware searched victims' machines?
  2. AWS reports that an extension version you run fleet-wide contained malicious code that failed to execute. What is the right response?
  3. In the package hallucination study, roughly what share of package references from open-source models named non-existent packages?
  4. How did the "Rules File Backdoor" research hide instructions in rules files?

References

  1. Malicious versions of Nx and some supporting plugins were published (GHSA-cxm3-wv7p-598c). Nx (nrwl) on GitHub, 2025-08.
  2. s1ngularity: supply chain attack leaks secrets on GitHub. Wiz, 2025-08-27.
  3. Widespread Supply Chain Compromise Impacting npm Ecosystem. CISA, 2025-09-23.
  4. Security Update for Amazon Q Developer Extension for Visual Studio Code (Version #1.84), AWS-2025-015. AWS, 2025-07-23.
  5. We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs. Spracklen et al. (arXiv:2406.10279), 2024-06.
  6. Explore the .claude directory. Anthropic (Claude Code docs).
  7. New Vulnerability in GitHub Copilot and Cursor: How Hackers Can Weaponize Code Agents. Pillar Security, 2025-03-18.
Completing the self-check also marks the lesson complete. Saved in this browser only.

Following

Follow the vendors, products, AI tools, techniques and actors you care about. Matching stories, CVEs and exploited bugs are marked, a Following tab appears in the feed, and returning visits show what changed. Saved only in this browser.

Presets

Get updates

A personal RSS feed of new stories on everything you follow. Paste it into any feed reader, Slack or Teams RSS app.