• Vulnerable U
  • Posts
  • Solana's Web3.js Library Compromised in Supply Chain Attack

Solana's Web3.js Library Compromised in Supply Chain Attack

Two unauthorized library versions - 1.95.6 and 1.95.7 - have since been unpublished, and Solana app developers should upgrade to version 1.95.8

A supply chain attack was detected Tuesday stemming from two versions of the Solana Web3.js npm library. Solana Web3.js is a JavaScript library commonly used for Solana decentralized apps (or dapps). According to Socket, the library 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,” according to a post by Socket

Key Details:

  • According to the library’s maintainers, on Dec. 3 a publish-access account was compromised for Solana Web3.js

  • “This allowed an attacker to publish unauthorized and malicious packages that were modified, allowing them to steal private key material and drain funds from dapps, like bots, that handle private keys directly,” according to release notes 

  • The two unauthorized versions - 1.95.6 and 1.95.7 - have since been unpublished, and Solana app developers should upgrade to version 1.95.8

Who is Impacted: According to the maintainers: “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.”

According to version 1.95.8 release notes, the issue should not affect non-custodial wallets - crypto wallets where the holder has full control of private keys and ownership of assets rather than relying on third parties - as they generally do not expose private keys during transactions.

Meanwhile, Binance on Tuesday said that no major wallets have reported being impacted by this issue, but “actual attacks have occurred.” 

“It is speculated that third-party tools related to private keys, including bots, might have been compromised due to their timely updates of dependency packages,” according to Binance.

Next Steps: Developers should check their projects for any usage of the impacted library and specifically check for versions 1.95.6 or 1.95.7, and then update to version 1.95.8. The release notes stated that if developers suspect they have been compromised, they should rotate authority keys, including multisigs, program authorities or server keypairs.

According to an advisory by GitHub, “any computer that has this package installed or running should be considered fully compromised.”

“All secrets and keys stored on that computer should be rotated immediately from a different computer,” according to the GitHub advisory post. “The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.”