Attackers published a malicious version of Ethersphere's bee-js to npm on Novemb...

@feross@infosec.exchange

Attackers published a malicious version of Ethersphere's bee-js to npm on November 9 without an npm token. They used the project's own release automation.

bee-js has published with trusted publishing since January. The attackers controlled a maintainer's GitHub account and bee-worker, the release bot. bee-worker released a commit that sat on no branch and never went through a pull request. The legitimate workflow built it and published 13.3.0 with valid SLSA provenance. Its postinstall hook fetched and ran the attackers' JavaScript.

A trojanized Swarm Desktop 0.56.2 followed about 30 minutes later, with a valid signature and Apple notarization. Its updater checks for new releases every ten minutes. npm pulled bee-js after 75 minutes. The Desktop release stayed up for about eight and a half hours, and machines that updated stay on it until a newer release ships.

Trusted publishing removed the long-lived token. Provenance signs whatever the workflow builds. So the release bot and the workflow are now the credential. The workflow should refuse any commit that isn't on a protected branch, and publishing should wait for a human reviewer.

An auto-updater is a package manager with no cooldown. Give its release channel the same scrutiny as your dependencies.

If you installed bee-js 13.3.0, pin 13.2.0 and rotate every credential that machine could reach. If you ran Swarm Desktop 0.56.2, assume the node key was stolen and move funds from a clean machine.

socket.dev/blog/bee-js-comprom