The next big DeFi exploit will start before the code is deployed

Make preferred on Google logoGoogle logo

Socket’s May 24 disclosure of TrapDoor found more than 34 malicious packages and over 384 related versions spread across npm, PyPI, and Crates.io, each targeting the developers who build and maintain protocols, and the credentials that govern access to the systems around them.

What TrapDoor built is a route from a single developer’s compromised machine into the repositories, CI/CD pipelines, cloud accounts, and deployment keys that govern how protocols reach mainnet and stay updated once deployed.

Socket’s report confirms credential theft and infrastructure exposure as the campaign’s documented scope, leaving on-chain exploits as the inferred downstream consequence.

How a malicious package can become DeFi exploit riskHow a malicious package can become DeFi exploit risk
A six-stage flowchart shows how a malicious package moves from developer machine compromise through credential theft to put user funds at risk.

The attack surface developers don’t audit

The campaign delivered payloads through ordinary developer workflows, such as npm packages executing malicious code through postinstall hooks, PyPI packages triggering payloads on import while fetching remote JavaScript, and Rust crates running build.rs scripts during compilation.

Normal developer behavior is the attack surface, as none of these execution paths requires anything beyond a package install, an import, or a build command.


In the environment around a live protocol, any one of those credential classes can represent a path to user funds that no smart contract audit ever examines.

Socket explicitly framed stolen SSH keys as enabling lateral movement, and cloud and GitHub credentials as exposing repositories, CI/CD systems, private packages, and deployment environments.

That chain, comprising malicious package, developer compromise, credential theft, repo and cloud access, and malicious update, describes how a DeFi exploit can arise without a single line of vulnerable Solidity.

The AI instruction injection

Socket found the TrapDoor campaign attempted to plant hidden instructions inside files such as .cursorrules and CLAUDE.md, which are configuration files that AI coding assistants like Cursor and Claude Code read to understand how to behave within a project.

The injected instructions employed hidden Unicode techniques to steer AI-assisted workflows toward secret discovery and exfiltration.

Socket also found pull requests submitted to AI and developer tooling projects that tried to introduce instruction files under benign-sounding labels.

The target was the AI assistant that reads the repo, generates code, and operates with whatever context the project files supply.

If attackers silently manipulate that context through hidden Unicode instructions, the AI-assisted workflow becomes an exfiltration mechanism.

A broader pattern

SafeDep documented a May 11 campaign that compromised more than 170 npm packages and two PyPI packages, hitting 404 malicious versions tied to TanStack, Mistral SDK, UiPath, OpenSearch, and Guardrails AI.

StepSecurity described five major supply-chain attacks in 48 hours across VS Code extensions, GitHub Actions, npm, and PyPI, including a poisoned VS Code extension with 2.2 million installs and trojanized Microsoft PyPI packages.

Sonatype reported more than 454,600 new malicious packages in 2025, bringing the cumulative count to above 1.233 million, with malicious packages now serving as entry points for broader intrusions.

Campaign / source Timing Ecosystem affected Scale cited Why it matters for this story
TrapDoor / Socket May 2026 npm, PyPI, Crates.io 34+ malicious packages; 384+ versions/artifacts Shows crypto developers being targeted before code reaches mainnet
SafeDep campaign May 11, 2026 npm, PyPI 170+ npm packages; 2 PyPI packages; 404 malicious versions Shows malicious packages spreading through mainstream developer dependencies
StepSecurity 48-hour wave May 2026 VS Code, GitHub Actions, npm, PyPI 5 major attacks; one VS Code extension had 2.2M installs Shows attackers moving across multiple layers of developer tooling
Sonatype 2025 data 2025 Major open-source ecosystems 454,600+ new malicious packages; 1.233M+ cumulative Shows malicious packages becoming an industrialized intrusion channel

The control-plane attack pattern has already resulted in measurable DeFi losses using structurally identical methods.

Resolv’s March incident was a $23 million exploit where the deployed code worked exactly as designed, but off-chain infrastructure and trusted keys failed.

In April 2026, Drift lost $285 million when attackers combined long-running social engineering with valid admin signatures.

KelpDAO lost approximately $292 million the same month when attackers compromised off-chain RPC and DVN infrastructure.

CryptoSlate Daily Brief

Daily signals, zero noise.

Market-moving headlines and context delivered every morning in one tight read.