WPPConnect on npm shipped an infostealer: rotate secrets on any host that ran it

WPPConnect on npm shipped an infostealer: rotate secrets on any host that ran it

At 23:31 UTC on 15 November, version 2.4.1 of the npm package @wppconnect-team/wppconnect was published. It contains a file called dist/utils/diagnostics.js, which dist/controllers/browser.js requires, so the code runs as soon as your app imports the library. At 03:09 UTC on 16 November, @wppconnect/server 2.10.82 followed with its own dist/util/diagnostics.js. That one is loaded from dist/server.js and runs when the server starts. When the report to the OpenSSF malicious-packages database was filed, 2.4.1 was still npm's latest tag, so a plain npm install would have pulled it.

The module is simple and nasty. It collects every environment variable, any .env, .env.local and .env.production files, config.js, config.json and ormconfig.json, and the WhatsApp session token files under tokens/ and wppconnect_tokens/. It looks up the host's public IP through api.ipify.org and sends everything as a document to a hardcoded Telegram bot. Before it does anything it waits a random 30 to 240 seconds. It uploads at most once per 24 hours per host, tracked with a .wpp-diag marker file in the OS temp directory, and it stays quiet on CI runners and on sandbox or test hosts.

The part that bothers me most

The changelog. WPPConnect's own v2.4.1 release notes list "add environment diagnostics utility for support reports" and "load environment diagnostics on browser module init". That is the malicious module, described in ordinary maintenance language. We tell clients to read release notes before upgrading. Anyone who did that here would have nodded and moved on.

Then there's the evasion. Skipping CI and sandboxes means the payload stays dormant in exactly the places where most teams run their automated checks. The random delay gets past any dynamic-analysis tool that watches a process for a few seconds and calls it clean. Whoever built this knew how packages get vetted, and designed around it.

The target list is also well picked. ormconfig.json usually holds database credentials. .env.production holds everything else. The WhatsApp session tokens worry me more, though. Depending on how your integration stores the session, those files can be enough for someone else to act as your business number without touching your phone. For a support bot or a notification service, that means customers receiving messages from a number they trust, sent by someone you don't know.

Who is exposed

You're exposed if you import @wppconnect-team/wppconnect, run @wppconnect/server, or deploy anything whose version range could have resolved to 2.4.1 or 2.10.82 after late 15 November. Developer laptops count. Since the module deliberately avoids CI, your local machines and production servers are the likely places it fired.

One security vendor, Flatt Security, also reports that several tags of the wppconnect/wppconnect-server Docker image are infected and fire the payload on container start, and that a GitHub nightly release asset carried the same code. We haven't seen a second source confirm those, but if you run that container, I'd assume you're affected until you've proven otherwise.

What to do today

  1. Find the versions. Run npm ls @wppconnect-team/wppconnect @wppconnect/server in every project that uses them, and grep your lockfiles for 2.4.1 and 2.10.82 next to those package names. Check deployed images too, not just the repo.
  2. Look for the marker. A .wpp-diag file in the temp directory (usually /tmp on Linux) is a strong sign the upload ran. A missing file proves nothing, because a restarted container or a cleaned temp folder wipes it.
  3. Rotate everything that was in environment variables or in those config files on any affected host: database passwords, cloud keys, API tokens, SMTP credentials, payment keys. Don't wait to confirm exfiltration first. The rotation costs you an afternoon. Skipping it could cost a lot more.
  4. Kill the WhatsApp sessions. Delete the token directories, log out the linked device from the phone, and pair again from a clean install.
  5. Check egress logs for connections to api.telegram.org and api.ipify.org from servers that have no business calling them.
  6. Pin to a version you've checked. Flatt Security names 2.4.0 and 2.10.81 as the last safe releases. That's a single source, so diff the published package contents yourself before you trust it.

What we'd change after the cleanup

During our pentesting engagements, the first thing we look for after landing on a box is this exact list: the environment, .env files, ORM configs. Attackers go there because that's where everyone keeps secrets. This payload just automates the step a human tester would do by hand. It's also the first thing we check in a cloud security review, and it's rarely in good shape.

From our PHP and Docker work on cloud apps, the boring fix that would have blunted this is egress filtering. A container running a WhatsApp integration needs to reach WhatsApp and your own backend. It doesn't need Telegram or an IP lookup service. Default-deny outbound traffic on production workloads turns a lot of supply-chain payloads into failed HTTP requests and a log line you can alert on. Short-lived credentials help too. A database password that expires in an hour is a much smaller problem when it leaks.

The mobile side is where I think teams underestimate this. In our native iOS and Android projects, especially in healthcare and e-commerce, the messaging integration almost never lives in the app. It sits on a small Node service somebody set up once, holding the session for the business number. The app gets reviews, audits and pentests. That little service gets npm install and a cron job. If your product sends appointment reminders or order updates over WhatsApp, go find that box today.

One more habit worth adopting: don't take a brand-new release of a dependency the minute it appears. A delay of a few days before new versions reach production means somebody else usually finds the poisoned release first. It won't stop a patient attacker, but it would have kept 2.4.1 off most servers.

If rotating secrets across a pile of Node services, with no clear picture of which host ran which version, sounds familiar, let's talk.

expert-analysisinfostealernpmsupply-chain-attacktech-news