
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Security News
Sarah Gooding
December 3, 2024
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library, which receives more than ~350,000 weekly downloads on npm. These compromised versions contain injected malicious code that is designed to steal private keys from unsuspecting developers and users, potentially enabling attackers to drain cryptocurrency wallets.
You can use Socket's free tools to check if your code is affected:
socket scan create .
). This is an easy way to see if you’re affected in a local repository.This is a developing story and we will update as we get more information.
npm has moved swiftly to remove the affected versions.
12/4/2024 - 6:50PM EST: In a post on Bluesky, Datadog cloud security researcher Christophe Tafani-Dereeper highlighted that the backdoor in v1.95.7 includes an "addToQueue" function designed to exfiltrate private keys using seemingly-legitimate CloudFlare headers.
"This function is strategically injected into various legitimate code paths that access the private key," Tafani-Dereeper explained.
He also noted that the associated domain (sol-rpc[.]xyz) was registered on November 22 via NameSilo and is currently hosted behind CloudFlare, although the C2 is currently down.
At 6:12PM on December 3, Anza, a Solana focused research and development firm, disclosed that a publish-access account was compromised, allowing the threat actor to steal private key material and drain funds from dapps, like bots, that handle private keys directly.
Anza clarified that the attack should not affect non-custodial wallets, because they don't expose private keys during transactions.
This is not an issue with the Solana protocol itself, but with a specific JavaScript client library and only appears to affect projects that directly handle private keys and that updated within the window of 3:20pm UTC and 8:25pm UTC on Tuesday, December 2, 2024.
Anza recommends developers who suspect they were compromised to rotate any suspect authority keys, including multisigs, program authorities, and server keypairs.
Mert Mumtaz, CEO of Helius Labs, a Solana development tools company, estimated the damage from this attack to be roughly $130K. Decrypt projected the breach led to $160K in stolen assets, including SOL tokens and other crypto assets, based on Solscan data for the hardcoded wallet.
Mumtaz reports that most major wallets and apps were not affected or not using the compromised versions, including Phantom, Backpack, Coinbase, Exodus, and Kamino. Apps that were not blindly upgrading to the latest versions from npm during the few hours when the compromised versions were live, are likely not affected by the incident. These packages were promptly removed from npm to mitigate the damage to developers and apps relying on Solana's web3.js library.
Subscribe to our newsletter
Get notified when we publish new security blog posts!
Try it now
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.