PhantomSub Campaign:Malicious npm Packages Silently Hijack WhatsApp Accounts

Security researchers at OX Security, SafeDep, and Xygeni have uncovered a widespread supply-chain campaign dubbed PhantomSub. Attackers published at least 101 malicious software packages to the official npm registry—downloaded nearly 500,000 times. These packages trick developers into connecting their personal or business WhatsApp accounts (usually to build automated chatbots) and then secretly force those accounts to join WhatsApp channels, enter group chats, and broadcast unauthorized marketing links without the owner's knowledge or consent.

Clear Explanation: How the Attack Works

Developers often build WhatsApp automation tools or chatbots using an open-source library named Baileys. Attackers created deceptive copies (typosquatting and forks) of this original library, such as @nexustechpro/baileys or ourin-baileys.

When a developer installs one of these malicious packages and scans the QR code to authenticate their WhatsApp session, the package acts normally on the surface. However, hidden inside the code is a background trigger. Once authentication succeeds, the compromised package uses the developer’s active WhatsApp session to execute silent API requests, joining attacker-controlled WhatsApp groups, subscribing to promotional channels, and injecting spam advertisements into outgoing media messages.

Attackers used three distinct techniques to deliver these instructions:

  • Variant 1 (19 packages): Downloads the list of targeted WhatsApp Channel IDs dynamically from a remote GitHub repository at runtime.

  • Variant 2 (60 packages): Directly embeds the targeted WhatsApp Channel IDs in plain text inside the package code.

  • Variant 3 (14 packages): Encodes and obfuscates the targeted Channel IDs inside the source code to bypass basic security scanners.

Real-World Analogy

Imagine taking your car to a mechanic to install an automated parking sensor. While installing the sensor, the mechanic quietly makes a copy of your car key. Late at night, while you are sleeping, they take your car, drive around town distributing promotional flyers for local businesses, park it back in your garage, and put the key back.

You think nothing happened, but your car (your WhatsApp account) was used without your knowledge to boost someone else’s reputation.


Frameworks, Tools, and Tactics

Threat Tactics (ATT&CK for Enterprise):

Supply Chain Compromise (T1195.002): Manipulating open-source npm registries to distribute malicious dependencies.

Obfuscated Files or Information (T1027): Hiding targeted channel IDs inside encoded JavaScript code to evade static analysis.

Malicious Targets:

Mainly Indonesian-language bot-market channels selling mobile game top-ups (e.g., Mobile Legends: Bang Bang), bot scripts, and social media boosting services.

Detection & Remediation Tools:

npm audit: Verifies dependency trees against known vulnerability databases.

Socket.dev / SafeDep: Behavioral analysis tools designed to detect supply chain anomalies in JavaScript packages.

Legal Note and Safety Tip

Safety Warning: Never install untrusted third-party modifications (mods) of authentication frameworks or libraries on production systems or personal devices linked to your primary phone number. Using unauthorized open-source wrappers can lead to supply-chain infection, account bans by WhatsApp for automated spam, and leakage of private session keys.

Detection and Prevention Checklist

  • Audit package.json and package-lock.json for unauthorized or typosquatted Baileys forks (e.g., ourin-baileys, @dappaoffc/baileys-mod).
  • Inspect active WhatsApp account settings under Linked Devices and Channels/Groups to remove unauthorized subscriptions.
  • Pin dependencies to official, cryptographically verified upstream packages rather than random third-party forks.
  • Implement automated dependency scanning in CI/CD pipelines to catch newly published malicious packages.

Trusted Sources & References:

  • OX Security Technical Write-up
  • SafeDep Threat Research Blog
  • Xygeni Security Research Analysis
#Cybersecurity #SupplyChainAttack #InfoSec #npm #MalwareAnalysis #ThreatIntel #KabinKhadkaResearch


Comments

Popular posts from this blog

The 2026 DataHub Nepal Infrastructure Breach & Financial Sector Fallback

Welcome to My Cybersecurity Research Blog