TrapDoor: A Credential-Stealing Campaign Targets AI Assistant Instruction Files
Socket linked 34+ malicious packages and 384+ related versions and artifacts across npm, PyPI and Crates.io to the TrapDoor credential-stealing campaign. Alongside working package payloads, the attacker planted AI-facing instructions in .cursorrules and CLAUDE.md and opened documentation-style pull requests. Socket describes an attempt to induce AI assistants to run a disguised security scan; it does not establish that every proposed pull request was merged or that cloning alone caused successful AI-assisted theft.
Threat Analysis
- Two ways in, and one targets AI assistant config. TrapDoor reaches developers through the usual malicious-package route, but its distinctive move is poisoning the configuration files an AI coding assistant reads -
.cursorrulesandCLAUDE.md- so the assistant can be steered into stealing data. - The AI-facing route is an observed delivery attempt. Campaign-linked files and pull requests ask an assistant to follow remote guidance or run a disguised security scan. Hidden Unicode and familiar documentation titles can conceal the instructions. Exposure depends on whether the file reaches a repository, whether the assistant reads and follows it, and whether its execution permissions allow secret access and egress. Socket warns that the technique may not work consistently across tools or models.
- The package path executes at install, import, and build time. On npm, a
postinstallhook runs the 1,149-linetrap-core.jsautomatically. On PyPI, packages execute at import time, pull JavaScript from an attacker GitHub Pages domain, and run it withnode -e. On Crates.io, abuild.rsscript runs during compilation, encrypts local keystores with a hardcoded XOR key, and exfiltrates them to GitHub Gists. - What gets taken, and how the attacker filters it. Targets include SSH keys, AWS credentials, GitHub tokens, browser login databases, environment variables, API keys, and Solana, Sui, and Aptos wallet keystores. The payload validates stolen AWS and GitHub credentials with live API calls so the attacker can separate working secrets from expired ones.
- It digs in and spreads. trap-core.js establishes persistence through
.cursorrules,CLAUDE.md, Git hooks, shell hooks, systemd, cron, and SSH, and attempts lateral movement by reusing stolen SSH keys. A deliberate "disguise layer" maps credential theft onto benign-sounding tasks - security audits, wallet safety checks, cloud configuration validation. - The boundary that breaks is "config is not code." Once an AI assistant treats repository files as trustworthy instructions, an attacker who can land a file in a repo - through a package or a single docs PR - can drive the assistant's actions. The possible exposure extends to assistants that read the poisoned files; cloning alone is not evidence of execution or credential compromise. The package and repository activity was observed in May 2026 and the PRs came from the GitHub account ddjidd564 against browser-use, langchain, langflow, llama_index, MetaGPT, and OpenHands.
Applicable AIDEFEND Defenses (9)
.cursorrules or CLAUDE.md, and which CI caches, containers, or developer machines may have touched those artifacts. This is a supporting inventory control: it turns an IOC list into trackable cleanup work rather than detecting or blocking the attack by itself.What Defenders Should Do Now
- Hunt for TrapDoor indicators across repos, lockfiles, CI caches, and developer machines: the GitHub account and domain
ddjidd564andddjidd564.github.io, the campaign markerP-2024-001, the payloadtrap-core.js(48,485 bytes), and the Rust XOR keycargo-build-helper-2026. - Find and review any
.cursorrules,CLAUDE.md, orAGENTS.mdadded or modified recently, especially through external pull requests; check them for zero-width Unicode and for instructions to run "security scans," "wallet safety checks," or uploads. - Configure AI coding assistants to treat repository files as data, not instructions, and to require explicit approval before reading secret paths, running shell commands, or making network calls.
- Run package installs and builds in ephemeral sandboxes with npm lifecycle scripts disabled where possible, import/build code isolated, no SSH keys or production secrets present, and egress limited to approved registries.
- Block or review agent- or PR-introduced dependencies until the exact package, version, maintainer history, and install scripts have been checked; treat any of the TrapDoor packages listed in the Socket report as malicious.
- Separate file exposure from actual assistant/package execution. If malicious execution or secret access is confirmed or cannot be ruled out, revoke or rotate affected SSH, AWS and GitHub credentials at their issuers; treat a compromised wallet private key as a separate wallet-migration case, and hunt for new SSH authorized keys, cron or systemd persistence, and outbound traffic to GitHub Pages or Gists.
1 additional consideration
AI-assistant instruction files as an unreviewed change surface
Conclusion
TrapDoor combines functioning supply-chain malware with attempts to exploit AI-facing instruction files. Relevant defenses include configuration review, calibrated content signals, independently enforced tool permissions, isolated dependency execution, restricted egress and incident-scoped cleanup. The AI-assisted route remains dependent on ingestion, model behavior and permissions; finding a file or cloning a repository alone does not prove successful execution.
Last updated: