Skip to the content
AI and Cybersecurity Learning and Practice Center Test automation Open the Learning Center

IncidentSupply chain

TrapDoor: packages steal secrets and plant hidden orders for AI coding assistants

HighSocket

Socket found more than 34 malicious packages across npm, PyPI and crates.io, dressed up as wallet and smart-contract security tools. Besides stealing wallet keys, SSH keys and cloud and GitHub tokens, they wrote hidden instructions into .cursorrules and CLAUDE.md files so that AI coding assistants would later run fake "security scans" that send secrets out.

Replay the attack step by step in the Learning Center

How it happened

  1. Installing a package ran code: npm postinstall hooks, a Python import that fetched remote JavaScript, or a Rust build.rs script.
  2. The payload collected wallet files, private keys, SSH keys, GitHub tokens and cloud credentials.
  3. It added instructions to AI assistant config files using zero-width Unicode characters, invisible in most editors.
  4. The attackers also opened pull requests trying to get poisoned config files into open-source projects.

Impact

Developers who installed the packages lost credentials and wallet keys, and their AI assistants were primed to leak more later.

The fix

Socket published the package list; anyone who installed one must rotate every credential it could reach and clean their AI assistant config files.

Lessons

  • AI assistant config files are code. Review them, and show invisible characters in diffs.
  • Security-themed package names are a lure; install only what has been vetted.
  • Treat one malicious install as a full credential compromise.

Sources