When Dependencies Turn Rogue: How Bad Actors Are Hijacking Crypto Wallets via Open-Source Modules
- Muzkkir Husseni
- 4 days ago
- 4 min read
In mid-2025, cybersecurity experts sounded the alarm: specially crafted malicious modules in open source platforms (Rust, JavaScript, Python) are utilized to steal private keys from Solana, Ethereum, and other crypto wallets. These are not brute-force attacks nor phishing activities they are supply chain attacks disguised in code trusted by most developers without scrutiny.
This piece delves into how they operate, recent real-world incidents, why they're so lethal, and how crypto users and developers may counter them.

The Increasing Dangers Associated with this Attack Vector
1. Developers trust dependencies
Contemporary software development depends greatly on open-source libraries. If one's program has numerous such dependents, trust is an issue of scalability: "Whom am I to trust as an author? Whose version is original?" Cybercriminals take advantage of trust.
2. Typosquatting, Impersonation, and Account Takeovers
Rather than developing all-new packages, attackers use variants of familiar names (typosquatting) or assume maintainer accounts and insert malicious ones. That makes it harder to detect as newcomers look "legitimate."
3. Runtime vs build-time stealth
Well-crafted malicious packages won't reveal anything unusual to static analysis or first-time build. Instead, the malicious logic executes at runtime if certain conditions (e.g. if certain files are present, environment variables are set). This outwits many usual scanners.
4. Significant Benefits, Minimal Expenditure
Stealing private keys provides attackers with full wallet and money control. This is relatively low investment with possible huge return compared to many other attacks.
Current Events and Study Findings
Following are details about major attacks or evaluation aiding our knowledge regarding current trends and practices.
The Rust Ecosystem — Malware Packages in Crates.io
Phylum Research discovered a supply chain attack aimed at the Rust programming language program in which attackers published typosquatting crates (e.g., postgress) that seemed innocent initially but later embedded callback or communication capabilities to steal host data.
More recently, Socket documented two Rust crates impersonating a logging library fast_log to scan project code and steal embedded Solana/Ethereum keys. (Socket)
These cases suggest that the Rust ecosystem has itself become susceptible to supply chain threats.
JavaScript / npm / PyPI Solana and Ethereum Centric
In January 2025, several malicious npm packages that pretended to be Solana tools, for example, solana-transaction-toolkit and solana-stable-web-huks, had been discovered. They stole private keys and sent them via Gmail SMTP and managed to drain funds by as high as 98% in many cases.
Another case: versions of @solana/web3.js (popular Solana JavaScript SDK) were compromised (versions 1.95.6 and 1.95.7) to include key-stealing code pointing at suspicious RPC domains. Developers were urged to downgrade or upgrade, and to rotate secrets. (ReversingLabs) A covert Node.js project designated as solana-pumpfun-bot was employed to deceive users into executing code that incorporated concealed harmful npm dependencies, consequently compromising wallet keys. (Medium)
How to Analyze: A Package with Hidden Malignant Behavior
Rust code analysis by SlowMist revealed a malicious module embedded within a seemingly legitimate open source project (a trading bot). The malicious logic:
Loaded a .env variable called PRIVATE_KEY
Verified key length (character count >85) to prevent false positives
Analyzed and established communication with a predetermined attacker API endpoint (e.g. http://103.35.189.28:5000/api/wallets). The key was serialized and passed via the HTTP POST method. Simultaneously, the code incorporated innocuous features, such as price retrieval, to obscure its malevolent purposes (Medium).
As this logic was running under initialization, it would automatically call on start and catch users who had not explicitly "called" wallet code.

Anatomy of an Attack: The Underlying Processes Involved
Here's a basic outline of how a malicious dependency can exfiltrate crypto keys:
Publication / Insertion
Attacker deploys a module whose name is quite similar to one trusted library
Or else, an attacker gains access to an existing library by compromising an account. The initial versions might be harmless in terms of surviving early scrutiny.
Payload Activation In a subsequent iteration, harmful code is incorporated (for instance, during runtime initialization or within a supporting function).
Perhaps it will test environment variables, directory structure, or key format to ensure it isn't activated by harmless settings.
Key Extraction / Scanning The module looks for private keys in code files, environment variables, or config files.
The attacker is able to embed logic to translate Base58, process key formats acceptable by Solana, Ethereum, etc.
Exfiltration
They transit through HTTP, SMTP, or other protocols to the attacker's system.
Once having possession of the keys, the attacker spends money or transmits transactions through mixer services
Cleanup or Persistence
The module has the ability to suppress other attacks or self-uninstall
Attacker may create backdoors or conceal evidence to ensure future access.
Why Old-Time Defenses Fail
Static code analyzers / audits often overlook runtime logic implemented later
Version pinning helps out, but if the version that's been pinned itself corrupted or later becomes malicious, you're stuck Code reviews often overlook obscure and complex logic, particularly in non-core modules. -
Firewalls/endpoint filters may allow SMTP or HTTP traffic to "trusted" servers (e.g. Gmail) Ci/cd pipelines and automatic update systems can include malicious updates prior to them coming to attention by humans. Thus, a more multi-dimensional and proactive response is called for.



Comments