Current Cyber Threats

NPM Package With 56K Downloads Caught Stealing WhatsApp Messages

Summary:
Cybersecurity researchers have identified a malicious npm package named "lotusbail" that masquerades as a legitimate WhatsApp API library. Uploaded in May 2025 by the user "seiren_primrose," the package has been downloaded over 56,000 times and remains available for download on the registry. While it provides the functional capabilities of the legitimate @whiskeysockets/baileys library, it contains a malicious WebSocket wrapper capable of intercepting authentication tokens, session keys, message history, and contact lists. The stolen data is encrypted and exfiltrated to an attacker-controlled URL. Importantly, the malware hijacks the WhatsApp device-linking process using a hard-coded pairing code during the initial authentication flow. This allows the threat actor to link their own device to the victim’s WhatsApp account, providing persistent, stealthy access to conversations and media that survives the uninstallation of the package. To hinder analysis, "lotusbail" also features 27 infinite loop traps that freeze execution if debugging tools are detected.

Security Officer Comments:
This campaign highlights the increasing sophistication of supply chain attacks, where threat actors essentially trojanize malware with legitimate functionality to bypass traditional reputation-based security measures. Static analysis sees the working WhatsApp code and does not detect the malicious wrapper. By providing a working tool, the actor successfully obscured the malicious functionality of the wrapper, allowing the package to accumulate high download volumes and trust metrics. Organizations should view this as a reminder that high download counts and functional validity are not indicators of security.

Suggested Corrections:
Threat actors employ different techniques to execute software supply chain attacks. Three common techniques are:
  • Hijacking updates
  • Undermining code signing
  • Compromising open-source code
Hijacking Updates
“Most modern software receives routine updates to address bugs and security issues. Software vendors typically distribute updates from centralized servers to customers as a routine part of product maintenance. Threat actors can hijack an update by infiltrating the vendor’s network and either inserting malware into the outgoing update or altering the update to grant the threat actor control over the software’s normal functionality. For example, the NotPetya attack occurred in 2017 when Russian hackers targeting Ukraine spread malware through tax accounting software popular in Ukraine. What would later be called the NotPetya malware spread well beyond Ukraine and caused major global disruptions in crucial industries, including international shipping, financial services, and healthcare” (CISA, 2022)

Undermining Codesigning
“Codesigning is used to validate the identity of the code’s author and the integrity of the code. Attackers undermine codesigning by self-signing certificates, breaking signing systems, or exploiting misconfigured account access controls. By undermining codesigning, threat actors are able to successfully hijack software updates by impersonating a trusted vendor and inserting malicious code into an update. For example, APT 41, a China-based threat actor, routinely undermines codesigning while conducting sophisticated software supply chain compromises against the United States and other countries” (CISA, 2022)

Compromising Open-Source Code
“Open-source code compromises occur when threat actors insert malicious code into publicly accessible code libraries, which unsuspecting developers—looking for free blocks of code to perform specific functions—then add into their own third-party code. For example, in 2018, researchers discovered 12 malicious Python libraries uploaded on the official Python Package Index (PyPI). The attacker used typosquatting tactics by creating libraries titled “diango,” “djago,” “dajngo,” etc., to lure developers seeking the popular “django” Python library. The malicious libraries contained the same code and functionality of those they impersonated; but they also contained additional functionality, including the ability to obtain boot persistence and open a reverse shell on remote workstations. Open-source code compromises can also affect privately owned software because developers of proprietary code routinely leverage blocks of open-source code in their products” (CISA, 2022)

“Network defenders are limited in their ability to quickly mitigate consequences after a threat actor has compromised a software supply chain. This is because organizations rarely control their entire software supply chain and lack authority to compel every organization in their supply chain to take prompt mitigation steps. Due to the difficulty of mitigating consequences after a software supply chain attack occurs, network defenders should observe industry best practices before an attack has occurred. Implementing best practices will bolster an organization’s ability to prevent, mitigate, and respond to such attacks” (CISA, 2022)

NIST suggests eight key practices for establishing a NIST C-SCRM (Cyber Supply Chain Risk Management) approach that can be applied to software.
  1. Integrate C-SCRM across the organization.
  2. Establish a formal C-SCRM program.
  3. Know and manage critical components and suppliers.
  4. Understand the organization’s supply chain. software for which a vulnerability is disclosed
  5. Closely collaborate with key suppliers.
  6. Include key suppliers in resilience and improvement activities.
  7. Assess and monitor throughout the supplier relationship.
  8. Plan for the full lifecycle.
These practices can assist in preventing, mitigating, and responding to software vulnerabilities that may be introduced through the cyber supply chain and exploited by malicious actors.

https://www.cisa.gov/sites/default/files/publications/defending_against_software_supply_chain_attacks_508_1.pdf

Link(s):
https://www.koi.ai/blog/npm-package-with-56k-downloads-malware-stealing-whatsapp-messages