viem-ethereum@2.47.9
Malicious code in viem-ethereum (npm)
Analysis
viem-ethereum is a combosquat (trojanized clone) of the legitimate viem Ethereum library. When imported, the privateKeyToAccount() function silently exfiltrates the user's Ethereum private key via the MailerSend email API. The exfiltration payload is injected as eval(decodeURIComponent(atob(...))) in accounts/privateKeyToAccount.ts and its compiled outputs (_cjs/ and _esm/). The stolen private key is emailed to [account] and [account] with subject line "Private Key", sent from [account] using a hardcoded MailerSend API key. The package adds mailersend as a declared dependency to support the exfiltration channel. Any developer who installs this package and calls privateKeyToAccount() (a core wallet-creation function) will have their private key compromised.
- analyzed by
- Leitwacht
- first seen
- Jun 15, 2026, 05:29 PM
- analyzed
- Jun 15, 2026, 05:31 PM
Related advisories
- vfat-tools@2.0.0
- flow-lending-sdk@9.9.9
- totally-safe-util@1.0.1
- tiny-string-parser@0.1.2
- third-sender@1.0.0
- signature-transaction@1.1.0
- sickle-wrapper@0.2.0
- rtms-manager@1.2.0
Independently detected by the Leitwacht supply-chain probe. IOCs are defanged. Published CC0. Think this is a mistake? See the dispute policy.