Osegi
Security·2 min read

Malicious bee-js 13.3.0 on npm tried to steal crypto wallet keys

Version 13.3.0 of the Swarm library @ethersphere/bee-js shipped through the project's own release pipeline and tried to steal wallet keys the moment it was installed.

Laptop screen showing JavaScript code with a red warning icon and a crypto wallet key being pulled away.
Image: Хабр

If you installed @ethersphere/bee-js 13.3.0 from npm, the damage may have been done before your app ever ran. Security firm CodeScoring has flagged that version of the JavaScript library for the Swarm distributed storage network as malicious. Since 9 November, it has treated the release as malware that tried to steal crypto wallet keys.

What makes it nasty is how it got out. The bad version went through the project's normal publishing process. Someone committed code directly to the official repository under the release account bee-worker, then created a release, which fired the project's existing GitHub Actions workflow. According to Socket, the build data on npm pointed to the official repository and the standard release process. The malware was already in the source by then.

The attackers set it up so a script runs automatically on install. In the code comments, the call to their server was described as sending analytics. In reality the script downloaded JavaScript from that server and ran it at once, with the rights of whoever installed the package.

What did the bee-js malware do?

The payload looked inside Swarm Desktop data for an encrypted wallet key and a config file. If the config held the key's password, stealing the two files was enough to take over the wallet. It also tried to make itself persistent, so it would survive after installation finished.

On Linux and macOS it went further and installed a backdoor for running remote commands. The backdoor read its command server address from an Ethereum smart contract, so the operator could change the address with one transaction, with no new build needed.

How to check if you are affected

The bad version could also arrive indirectly. Dependency ranges in several Swarm tools allowed 13.3.0, so a search for a direct dependency in the manifest is not enough. Check the version actually resolved in your lock file.

Teams should look through lock files, package caches and CI install logs for 13.3.0. If it was installed with scripts allowed, or if Swarm Desktop 0.56.2 was run, the machine or CI runner needs investigating. On a CI runner, that means package publishing tokens and source access too.

Apps worth a look

SUMO: the number puzzle

Tap the right tiles, add them up, hit the target. Easy to learn, hard to master. Free, for all ages.

Tags:npmswarmbee-jssupply chain attackcrypto walletgithub actions

More from this day

See all →

More in: Security

See all →