# WPPConnect Compromised: Malicious Releases Steal Secrets and WhatsApp Sessions Through the Project's Own Pipeline

Malicious npm/Docker releases of WPPConnect shipped a diagnostics module that exfiltrated env vars, .env files and WhatsApp session tokens to a Telegram bot.

- Payout: Real-world hack
- Severity: critical
- Program: WPPConnect
- Analysis by: StepSecurity
- Disclosed: 2026-11-16
- Write-up quality: 8/10
- Original: https://www.stepsecurity.io/blog/wppconnect-compromised-malicious-releases-steal-secrets-and-whatsapp-sessions
- Library page: https://bugbountylibrary.com/r/blog%3Astepsecurity-io-blog-wppconnect-compromised-malicious-releases-steal-secrets-and-whatsapp-sessions
- Tags: area:oss domain:oss impact:ato impact:data-leak kind:incident platform:threat-intel sev:critical tech:docker tech:github-actions tech:nodejs technique:source-review vuln:secrets-leak

**Target:** npm packages @wppconnect-team/wppconnect and @wppconnect/server, GitHub nightly release, Docker images
**Root cause:** Unreviewed unsigned commits pushed to default branches by the joaosouz4dev account added src/utils/diagnostics.ts, which was imported at load time and published via the project's trusted-publishing workflow with valid SLSA provenance but no human review.
**Steps:**
1. Push unsigned commits adding `src/utils/diagnostics.ts` and importing it from `src/controllers/browser.ts` (library) or `src/server.ts` (server).
2. Dispatch release workflow (release-it) or let release.yml trigger on push; trusted publisher publishes to npm with id-token: write.
3. On import/startup, module collects hostname, user, OS, Node version, cwd, memory, public IP via `https://api.ipify.org?format=json`.
4. Collects env vars 3-499 chars (excluding npm_*), first 12,000 chars of `.env`, `.env.local`, `.env.production`, `config.js`, `config.json`, `ormconfig.json`, and up to five `.json` session files from `./tokens/` (server variant also `./wppconnect_tokens/`).
5. Writes marker `.wpp-support-diag` or `.wpp-diag` to tmpdir to limit to one upload per 24h.
6. POSTs report as `<hostname>_<YYYYMMDD-HHMMSS>.txt` via Telegram `sendDocument` to bot 9034051102, chat 7343578055; server variant base64-encodes endpoint and skips CI/sandbox hosts.
7. After public issues opened, force-push rewrote default branches so v2.4.1 tag points to look-alike commit 63956bf without payload.
**How found:** Researchers checked npm registry, GitHub API and Actions logs, Sigstore transparency log and Docker Hub, and read the payload source as text; noticed valid provenance pointed at an unreviewed commit and that the tag was rewritten ~30s after public issues.
**Exploitation:** Attacker with access to joaosouz4dev account pushed payload commits, triggered the project's own trusted-publishing pipeline to ship 2.4.1 and 2.10.82 (plus 2.4.3/2.10.83 and Docker images), then exfiltrated secrets to a Telegram bot on first import/container start; history rewritten to hide the code.
**Escalation:** Server package depends on library at ^2.3.6, so fresh server installs transitively pulled the malicious library; Docker floating tags latest/2/2.10 pointed at infected 2.10.83 image until repointed.
**Insight:** Valid SLSA provenance and trusted-publisher identity only prove build origin, not source review — diff the provenance commit against the tagged source and inspect tarballs for load-time side effects (imports in entry files) rather than install scripts.

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

**Malicious diagnostics module with Telegram exfiltration config**

```
const SUPPORT = {
 url: ['https://api.telegram.org/bot', '<BOT_TOKEN_REDACTED>', '/sendDocument'].join(''),
 chat: 7343578055,
 cooldown: 24 * 3600 * 1000,
 maxFile: 12000,
};
```

**Commands to detect installed malicious versions**

```
npm ls @wppconnect-team/wppconnect @wppconnect/server

jq -r '.packages | to_entries[]
 | select(.key | test("node_modules/@wppconnect(-team)?/(wppconnect|server)$"))
 | "\(.key) \(.value.version)"' package-lock.json

docker image inspect <image> --format '{{index .RepoDigests 0}}'
```

**Commands to search for payload traces**

```
T=$(node -p "require('os').tmpdir()")
ls -la "$T/.wpp-support-diag" "$T/.wpp-diag" 2>/dev/null

grep -rIl -e "WPP SUPPORT DIAG" -e "WPP ENV" -e "wpp-support-diag" -e ".wpp-diag" \
 node_modules/@wppconnect-team node_modules/@wppconnect 2>/dev/null
```

