Monday, May 19, 2025
HomeCyber AttackNew Supply Chain Attack Compromises Popular npm Package with 45,000 Weekly Downloads

New Supply Chain Attack Compromises Popular npm Package with 45,000 Weekly Downloads

Published on

SIEM as a Service

Follow Us on Google News

An advanced supply chain attack has targeted the well-known npm package rand-user-agent, which receives about 45,000 downloads every week, in a worrying development for the JavaScript developer community.

Maintained by WebScrapingAPI, this package is designed to generate randomized, real-world user-agent strings based on their frequency of occurrence.

However, recent analysis has uncovered malicious code embedded in several of its latest releases, transforming a trusted utility into a covert Remote Access Trojan (RAT) capable of compromising systems and exfiltrating sensitive data.

- Advertisement - Google News
npm Package
Hidden code via scroll bar in rand-user-agent

Malicious Code Injected

The attack first came to light when security researchers detected suspicious code in the dist/index.js file of versions 2.0.83, 2.0.84, and 1.0.110 of the package.

Unlike the last publicly documented update to the GitHub repository, which corresponds to version 2.0.82 from seven months ago, these subsequent releases on npm contained hidden, obfuscated scripts not present in the source code.

This discrepancy strongly suggests that the npm registry was directly tampered with, bypassing the project’s official repository.

The malicious code, initially concealed behind horizontal scroll bars and layers of obfuscation, reveals a payload that establishes covert communication channels with command-and-control (C2) servers.

It connects to a socket endpoint at http://85.239.62.36:3306 using socket.io-client for real-time command reception and uploads files to http://85.239.62.36:27017/u/f via HTTP POST requests facilitated by axios.

Both dependencies are dynamically installed if absent, hidden in a .node_modules folder within the user’s home directory to evade detection.

RAT Payload Enables Remote Control

Upon execution, the RAT identifies the compromised system by transmitting a unique client ID (combining hostname and username), OS type, and process ID to the C2 server.

According to the Report, it supports a range of commands, enabling attackers to change directories, execute arbitrary shell commands, and upload individual files or entire directories to a designated endpoint.

A particularly insidious feature targets Windows systems by prepending a crafted path-%LOCALAPPDATA%\Programs\Python\Python3127-to the PATH environment variable.

This subtle hijack could allow malicious binaries to masquerade as legitimate Python tools, exploiting environments where Python is commonly used.

Such capabilities grant attackers deep access to infected systems, posing a severe risk of data theft and unauthorized control.

Developers who have installed the affected versions are urged to immediately audit their systems for indicators of compromise, including unexpected network traffic to the identified C2 endpoints.

Remediation steps include uninstalling the compromised package, purging associated modules, and monitoring for unauthorized changes to environment variables or file uploads.

This incident underscores the persistent threat of supply chain attacks in open-source ecosystems, where trust in widely-used packages can be weaponized with devastating effect.

The broader implications call for enhanced scrutiny of npm releases and robust verification mechanisms to prevent such breaches from recurring.

Indicators of Compromise (IoC)

Indicator TypeValueDescription
Malicious Versions2.0.83, 2.0.84, 1.0.110Affected package versions
Socket Connectionhttp://85.239.62.36:3306C2 server for command control
File Upload Targethttp://85.239.62.36:27017/u/fEndpoint for data exfiltration

Setting Up SOC Team? – Download Free Ultimate SIEM Pricing Guide (PDF) For Your SOC Team -> Free Download

Aman Mishra
Aman Mishra
Aman Mishra is a Security and privacy Reporter covering various data breach, cyber crime, malware, & vulnerability.

Latest articles

New Report Finds 67% of Organizations Experienced Cyber Attacks in the Last Year

A disturbing 67% of businesses in eight worldwide markets—the US, UK, Spain, the Netherlands,...

Auth0-PHP Vulnerability Enables Unauthorized Access for Attackers

Critical security vulnerability has been discovered in the Auth0-PHP SDK that could potentially allow...

Active Exploitation of Ivanti EPMM Zero-Day Vulnerability in the Wild

Security researchers at The Shadowserver Foundation have identified active exploitation attempts targeting a critical...

Hacker Arrested for Taking Over SEC Social Media to Spread False Bitcoin News

Alabama man has been sentenced to 14 months in prison for orchestrating a sophisticated...

Resilience at Scale

Why Application Security is Non-Negotiable

The resilience of your digital infrastructure directly impacts your ability to scale. And yet, application security remains a critical weak link for most organizations.

Application Security is no longer just a defensive play—it’s the cornerstone of cyber resilience and sustainable growth. In this webinar, Karthik Krishnamoorthy (CTO of Indusface) and Phani Deepak Akella (VP of Marketing – Indusface), will share how AI-powered application security can help organizations build resilience by

Discussion points


Protecting at internet scale using AI and behavioral-based DDoS & bot mitigation.
Autonomously discovering external assets and remediating vulnerabilities within 72 hours, enabling secure, confident scaling.
Ensuring 100% application availability through platforms architected for failure resilience.
Eliminating silos with real-time correlation between attack surface and active threats for rapid, accurate mitigation

More like this

New Report Finds 67% of Organizations Experienced Cyber Attacks in the Last Year

A disturbing 67% of businesses in eight worldwide markets—the US, UK, Spain, the Netherlands,...

Auth0-PHP Vulnerability Enables Unauthorized Access for Attackers

Critical security vulnerability has been discovered in the Auth0-PHP SDK that could potentially allow...

Active Exploitation of Ivanti EPMM Zero-Day Vulnerability in the Wild

Security researchers at The Shadowserver Foundation have identified active exploitation attempts targeting a critical...