Introduction

The Injective SDK on npm was recently infected with a cryptocurrency wallet stealer, compromising the security of developers using the @injectivelabs/sdk-ts npm package. This malicious package, version 1. 21, was detected by application security companies such as Socket, Ox Security, and StepSecurity. The attack was detected via the legitimate project contributor's GitHub account, which was compromised and used to publish the malicious package.

Injective SDK on npm infected with cryptocurrency wallet stealer

Injective SDK Overview

The Injective SDK is a TypeScript/JavaScript software development kit (SDK) for building applications on the Injective blockchain. This Layer-1 blockchain is focused on decentralized finance (DeFi), tokenized assets, and decentralized exchanges. The SDK has 50,000 weekly downloads on npm and is used by developers building cryptocurrency wallets, trading bots, decentralized exchanges, DeFi applications, and payment tools.

Attack Details

The attackers compromised a legitimate project contributor's GitHub account and made the first suspicious commits on June 8, publishing the malicious version of the package shortly afterward. The attacker also published version 1. 21 for another 17 packages associated with the project, pinning all of them to the compromised SDK version. The legitimate account owner detected the compromise within minutes and reverted the changes, publishing a clean release, version 1.

Impact and Mitigation

The malicious package was downloaded 310 times before it was deprecated and the malicious GitHub release artifacts are still available. The malware activates when developers use SDK functions that generate or import wallet keys, capturing the full mnemonic seed phrase and private key and encoding the data in base64. The attackers may then use the mnemonic or private key to port the victim's wallets to their own devices and access, use, or transfer their digital assets. Developers who suspect compromise should transfer their cryptocurrency to new wallets and rotate all secrets in their environment.

Additional Information

The package has 87 direct dependencies on npm and very likely multiple additional transitive dependencies. The malware did not immediately transmit stolen secrets, but instead queued multiple keys and mnemonics for two seconds, bundled them in the HTTP request header, and sent them. Developers should also be aware that the malicious package was associated with 17 other packages, each with their own set of dependencies and potential security risks. The attackers may also have used other means to spread the malware, such as hijacking the cPGuard autoupdate to deploy a backdoor and steal data.

Conclusion

The Injective SDK on npm being compromised by a cryptocurrency wallet stealer highlights the importance of maintaining a robust security posture for software development kits and their associated packages. Developers should be vigilant and regularly monitor their dependencies and packages for any suspicious activity, and take appropriate measures to mitigate any potential security risks.

Comments