TL;DR: TrapDoor is a multi-registry supply chain malware campaign spanning npm, PyPI, and Crates.io that targets developer workstations, CI runners, and AI coding environments for wallets, SSH keys, cloud credentials, and tokens, according to Corgea. The attack shows that package trust now extends beyond install scripts into import-time, build-time, and AI-agent surfaces, which makes secret governance and lifecycle controls the decisive defence.
At a glance
What this is: TrapDoor is a supply chain malware campaign that spread across npm, PyPI, and Crates.io and used registry-specific execution paths to steal secrets from developer and AI tooling environments.
Why it matters: It matters because developers and CI systems often hold the same credentials that attackers need for cloud access, source control, package publishing, and downstream compromise.
By the numbers:
- TrapDoor affected 34 distinct package names across npm, PyPI, and Crates.io.
- The campaign included 21 npm packages, 7 PyPI packages, and 6 Crates.io packages.
- The earliest observed package was uploaded on 22 May 2026 at 20:20:18 UTC.
- Socket published TrapDoor on 24 May 2026 after connecting isolated malicious packages into one campaign.
Context
TrapDoor is a supply chain malware campaign that exploits the trust developers place in package registries, build systems, and AI-assisted coding workflows. The core problem is not just malicious code in a package, but malicious execution at the points where developers assume installation, import, or build steps are routine and benign.
For IAM and NHI teams, the important boundary is that developer workstations and CI runners often hold machine credentials, tokens, and keys that behave like high-value non-human identities in practice. When malware reaches those environments, secret governance, rotation, and offboarding controls become part of supply chain defence, not just access management hygiene.
The article describes a pattern that is broader than one registry or one language stack. That makes the starting position typical for modern software teams, where package trust is assumed until runtime behaviour proves otherwise.
Key questions
Q: What fails first when supply chain malware reaches developer packages?
A: The first failure is trust in package execution boundaries. When install-time scripts, imports, or build hooks can run code, the control point shifts from code review to runtime behaviour, and secrets stored on the host become reachable before anyone certifies the dependency as safe.
Q: Why do developer credentials create supply-chain risk beyond repository access?
A: Because those credentials often control release, signing, and marketplace distribution, not just source-code access. If an attacker steals them, they can republish trusted artifacts, inherit legitimate distribution paths, and reach downstream users without breaking perimeter defenses. The risk comes from identity reuse across the software lifecycle, not from source control alone.
Q: What signs suggest a package has been used for secret theft?
A: Look for unexpected postinstall, import-triggered, or build-time network calls, new persistence files such as shell profiles or Git hooks, and outbound requests to attacker-controlled infrastructure. Also watch for secret validation activity against GitHub, cloud APIs, or registry services from developer endpoints.
Q: How should organisations respond when AI coding tools are used as an execution surface?
A: Treat AI developer tooling like any other privileged runtime boundary. Review hooks, plugins, and local configuration for unauthorised script execution, and make sure those tools cannot reach sensitive secrets by default. If the tool can start code automatically, it needs the same trust review as build automation.
Technical breakdown
Install-time, import-time, and build-time execution paths
TrapDoor matters because each registry lets attackers trigger code at a different lifecycle point. npm lifecycle scripts run during install, PyPI packages can execute when imported, and Rust crates can run build.rs during compilation. That means the malicious payload does not need a user to call a function or open a file later. It executes when developers and CI pipelines believe they are simply resolving dependencies. This is a control failure in dependency trust, not just a malware delivery problem, because the execution point varies by ecosystem and bypasses uniform review assumptions.
Practical implication: Treat package installation, import, and build as execution events that require policy and inspection, not passive dependency handling.
Why AI coding tools widen the attack surface
TrapDoor shows that the package ecosystem now intersects with agentic workflows. Files such as .cursorrules and CLAUDE.md can shape how coding assistants behave, so attackers can plant instructions that future human or AI sessions may trust. That is different from ordinary script injection because the payload is not only code execution, it is also behaviour shaping inside the development environment. In practical terms, AI coding systems become another non-human actor that can be steered by repository content, local configuration, and hidden guidance files.
Practical implication: Govern AI tool instructions and repository metadata as trusted inputs, and review them with the same caution as executable code.
Credential validation turns stolen secrets into usable access
The campaign does more than scrape files. Public reporting describes validation of AWS and GitHub credentials, which lets the attacker quickly separate expired material from live access. That shortens the time between theft and follow-on abuse such as source tampering, package publication, cloud access, or lateral movement. From an identity perspective, this is a machine-credential abuse pattern: secrets are harvested from developer contexts, checked against live services, and then reused where they still work. The governance gap is that many organisations protect issuance and rotation, but not the downstream validation of stolen credentials.
Practical implication: Monitor for secret validation activity as an indicator that stolen tokens are already being operationalised.
Threat narrative
Attacker objective: Steal and operationalise developer and CI credentials so the attacker can extend access into source control, cloud environments, package registries, and wallet infrastructure.
- Entry occurs through seemingly legitimate packages published across npm, PyPI, and Crates.io with names that resemble developer utilities or security helpers.
- Credential harvesting begins when install-time, import-time, or build-time code scans local files, browser stores, configuration files, and AI tool context for secrets.
- Escalation follows when stolen AWS, GitHub, SSH, and registry credentials are validated, reused, or planted into persistence paths such as shell profiles, Git hooks, cron, and startup files.
- Impact is credential theft, package publication abuse, source and cloud access, and the compromise of developer and CI environments that contain high-value non-human identities.
Breaches seen in the wild
- TrapDoor supply chain campaign 2026: TrapDoor's 34+ malicious npm, PyPI and Crates.io packages stole developer credentials and hid instructions for AI coding assistants. No victims known.
- PyPI secrets exposure 2023: Researchers found 3,938 unique secrets in published PyPI packages, 768 still valid; a new release or yank does not remove them.
Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.
NHI Mgmt Group analysis
TrapDoor is a secret-governance problem disguised as a package-malware problem: the malware succeeds because development environments routinely concentrate reusable credentials, not because one registry is uniquely weak. Install-time, import-time, and build-time execution all create different chances to reach those secrets before defenders notice. That means secret lifecycle controls belong in software supply chain policy, not just in IAM standards. Practitioners should treat developer machines and CI runners as credential-bearing assets with explicit governance.
AI coding assistants create a new trust boundary that most supply chain controls do not yet model: files like .cursorrules and CLAUDE.md can change how an AI system behaves inside the repo, which makes repository content part of the attack surface. This is not only code injection, but instruction injection into a non-human actor that may help locate secrets or normalize malicious behaviour. The named concept here is AI instruction persistence, where a planted local file survives across sessions and influences future developer or agent activity. Practitioners should review these files as part of software supply chain hygiene.
Credential validation is the moment stolen secrets become operational risk: once malware tests AWS or GitHub tokens against live services, expired secrets no longer matter and active ones become immediately exploitable. That closes the gap between detection and abuse, especially where registry publish rights or cloud credentials sit on developer endpoints. This aligns directly with OWASP-NHI NHI-02 Secret Leakage, NHI-05 Overprivileged NHI, and NHI-10 Human Use of NHI. Practitioners should assume that any exposed developer credential may already have been checked and prioritise revocation over investigation.
The campaign exposes a persistence gap in identity governance: teams often focus on whether a secret is issued correctly, but TrapDoor shows that secrets on endpoints, in profiles, and in local tooling can outlive the workflow that created them. The governance assumption that one credential equals one bounded use case does not hold when attacker tooling can harvest, validate, and reuse secrets across environments. This is a direct challenge to lifecycle offboarding for machine identities. Practitioners should expand offboarding and rotation checks to the developer estate, not just production systems.
What this signals
AI instruction persistence: developers now inherit a trust problem that extends beyond code to the instructions their tools consume. When files such as .cursorrules and CLAUDE.md can influence future sessions, security teams need to manage them as part of the software supply chain rather than as harmless repository metadata.
TrapDoor also shows why secret response has to move from reactive cleanup to hostile-environment assumptions. Once a package can validate GitHub or cloud credentials, the attacker is no longer collecting dead tokens. They are selecting live identities that can be reused immediately, which is why revocation and host rebuilds must outrun forensic debate.
For practitioners
- Hunt for the named malicious packages Search package manifests, lockfiles, caches, build logs, and proxy logs for the 34 package names associated with TrapDoor, then quarantine any environment that resolved them.
- Rotate every credential reachable from affected hosts Assume compromise on any machine that installed or imported the packages and rotate SSH keys, GitHub tokens, npm tokens, PyPI tokens, cloud keys, and wallet seed material.
- Inspect developer persistence locations Review .cursorrules, CLAUDE.md, Git hooks, shell profiles, cron entries, and user-level systemd units for attacker-added instructions or re-entry paths.
- Block attacker infrastructure and retain telemetry Block ddjidd564.github.io and related GitHub Pages paths, then preserve DNS and proxy logs for incident scoping and hunting across developer and CI networks.
- Treat AI tool instruction files as governed inputs Add review controls for repository instruction files that coding assistants read, because those files can be used to steer future human or AI sessions toward secret discovery.
Key takeaways
- TrapDoor demonstrates that package malware can target developer and CI identities through install, import, and build paths, not just through obvious malicious scripts.
- The campaign’s scale across 34 package names and three registries shows that software supply chain defence now depends on secret governance, endpoint trust, and AI tool hygiene together.
- The decisive control is fast containment of exposed hosts and rapid revocation of any credentials reachable from them, because validated tokens turn theft into active compromise.
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 CIS Controls v8 sets the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | TrapDoor steals secrets from developer and CI environments across registries. |
| NHI-05 — Overprivileged NHI | The campaign abuses developer tokens and registry access that often exceed task scope. | |
| NHI-10 — Human Use of NHI | Attackers exploit human-managed developer credentials present on endpoints and in tooling. | |
| Recommendation — Scan developer estates for exposed NHI secrets and revoke any credentials found on affected hosts. Reduce standing privilege on developer and registry credentials so stolen tokens cannot be reused broadly. Separate human and machine credential handling so developer endpoints do not become shared trust stores. | ||
| MITRE ATT&CK | TA0006; TA0008 — Credential Access; Lateral Movement | The malware harvests credentials and then reuses them for broader access and movement. |
| Recommendation — Map package-malware telemetry to TA0006 and TA0008 to prioritise credential theft and reuse paths. | ||
| CIS Controls v8 | CIS-5 — Account Management | The response depends on revoking and governing developer and service accounts touched by the campaign. |
| Recommendation — Use account management controls to disable exposed developer accounts and rotate related credentials quickly. | ||
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.
- Secrets Leakage: Secrets leakage is the exposure of credentials such as API keys, tokens, or certificates in places where they can be discovered and reused. The risk is not just disclosure, but unauthorized authentication that turns a coding or pipeline mistake into active access.
- Build-Time Code Execution: Build-time code execution occurs when a package install or build process runs commands before the software is fully installed. This is risky because dependency fetches, lifecycle scripts, and helper tools can execute with developer or root privileges. It turns ordinary package management into a potential host compromise path.
- AI Instruction Persistence: A condition where local prompt files, repository instructions, or tool-specific guidance survive across sessions and continue influencing human or AI behaviour. In security terms, it creates a durable attack surface because malicious instructions can steer future workflow decisions long after initial compromise.
Deepen your knowledge
The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, machine identity security, and secrets management. It helps security and identity practitioners build controls that fit developer, CI, and agent-driven environments.
Published by the NHIMG editorial team on August 20, 2026.
Updated on October 12, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org