175 Malicious NPM Packages Target Developers in Widespread Phishing Attack

Researchers Uncover 175 Malicious npm Packages with 26,000 Downloads in Credential Phishing Campaign

HIGH
October 11, 2025
5m read
Supply Chain AttackMalwarePhishing

Related Entities

Products & Tech

npm

Full Report

Executive Summary

Security researchers have uncovered a large-scale credential phishing campaign targeting developers through the npm open-source package repository. The campaign involved 175 malicious packages, which were downloaded a total of 26,000 times. These packages were designed to steal developer credentials and API keys upon installation, posing a severe supply chain attack risk. The attackers used techniques like typosquatting to trick developers into installing the malicious code. The primary targets were organizations in the technology and energy sectors. This incident underscores the vulnerability of the open-source ecosystem and the need for robust security measures in the software development lifecycle (SDLC).


Threat Overview

The attack leveraged the inherent trust developers place in open-source repositories. Threat actors published 175 packages to npm with names closely resembling popular, legitimate packages (a technique known as typosquatting). These packages contained malicious scripts, often within post-install hooks, that would execute automatically after a developer installed them using npm install. The scripts were designed to phish for sensitive information, such as developer login credentials for services like GitHub or AWS, private API keys, and other secrets stored in the development environment. Once stolen, these credentials could be used for further malicious activities, including injecting malicious code into private repositories, accessing sensitive corporate data, or moving laterally within the victim's network.


Technical Analysis

The core of this attack is the abuse of package manager automation and social engineering. The malicious code was typically obfuscated and embedded within installation scripts.

MITRE ATT&CK Techniques


Impact Assessment

The impact of this campaign extends far beyond the initial 26,000 downloads. A single compromised developer account can serve as a gateway into an entire organization's software supply chain. Attackers could use stolen credentials to:

  • Commit malicious code to private source code repositories.
  • Publish new malicious versions of legitimate internal or public packages.
  • Access and exfiltrate sensitive intellectual property and customer data.
  • Pivot from the development environment into production systems.

This creates a cascading risk that can lead to widespread breaches, affecting both the compromised organization and its customers.


Detection & Response

Detecting malicious packages requires a proactive approach to dependency management.

  1. Dependency Auditing: Regularly run npm audit and use third-party Software Composition Analysis (SCA) tools to scan for known vulnerabilities and malicious packages in project dependencies. This can be supported by D3-FA: File Analysis to inspect package contents.
  2. Runtime Monitoring: Implement endpoint detection and response (EDR) on developer workstations to monitor for suspicious process behavior, such as an npm install process making unexpected network connections or accessing sensitive files (.env, .aws/credentials).
  3. Network Traffic Analysis: Monitor egress traffic from development environments for connections to known malicious domains or unusual data uploads, which could indicate credential exfiltration. This aligns with D3-NTA: Network Traffic Analysis.

If a malicious package is discovered, the immediate response is to remove it from all projects, rotate all potentially compromised credentials, and perform a forensic analysis of the affected systems.


Mitigation

Preventing these attacks requires a shift towards a more security-conscious development culture.

  1. Scoped Registries: Configure npm to use a private or scoped registry that proxies and vets packages from the public repository. This allows security teams to maintain an allowlist of approved packages.
  2. Code Signing and Integrity Checks: Enforce policies that require package signature verification to ensure the integrity and authenticity of dependencies. Use lockfiles (package-lock.json) to pin dependency versions and prevent unexpected updates.
  3. Developer Training: Educate developers on the risks of typosquatting and the importance of verifying package names before installation. Promote a culture of skepticism towards unfamiliar packages.
  4. Secrets Management: Prohibit the storing of secrets in source code or local configuration files. Use a dedicated secrets management solution like HashiCorp Vault or AWS Secrets Manager.

Timeline of Events

1
October 11, 2025
This article was published

MITRE ATT&CK Mitigations

Use security policies to prevent the execution of untrusted code, such as scripts from unverified npm packages.

Mapped D3FEND Techniques:

Enforce policies that require dependencies to be cryptographically signed by a trusted source before they can be installed.

Mapped D3FEND Techniques:

Audit

M1047enterprise

Use Software Composition Analysis (SCA) tools to continuously audit project dependencies for malicious packages and vulnerabilities.

Mapped D3FEND Techniques:

D3FEND Defensive Countermeasures

To combat threats like the malicious npm packages, organizations should implement dynamic analysis by sandboxing the installation and execution of new or untrusted dependencies. Before a new package is approved for use in development, it should be installed in an isolated environment where its behavior can be monitored. Security teams should look for suspicious activities such as file system enumeration outside the project directory, attempts to access sensitive files (e.g., ~/.ssh/, ~/.aws/credentials), or unexpected outbound network connections. Automated sandboxing tools can flag packages that exhibit these malicious behaviors, preventing them from ever reaching developer workstations or CI/CD pipelines. This proactive 'detonation' of packages provides a high-fidelity detection method that goes beyond static analysis of package metadata.

Implement strict outbound traffic filtering on developer workstations and CI/CD runners to block the exfiltration of stolen credentials. The malicious npm packages needed to send stolen API keys and logins to an attacker-controlled server. By default, network policies should deny all outbound traffic from development environments, except to explicitly allowlisted endpoints such as internal artifact repositories, source control, and known-good public services. Any attempt by a process like node or npm to connect to an unapproved external IP address should be blocked and trigger a high-priority security alert. This containment strategy acts as a critical last line of defense, rendering the credential theft useless even if a developer accidentally installs a malicious package.

Sources & References

Top 5 Cybersecurity News Stories October 10, 2025
DIESEC (diesec.com) October 10, 2025
Snake Keylogger Uses Weaponized Emails and PowerShell to Steal Sensitive Data
GBHackers on Security (gbhackers.com) October 11, 2025

Article Author

Jason Gomes

Jason Gomes

• Cybersecurity Practitioner

Cybersecurity professional with over 10 years of specialized experience in security operations, threat intelligence, incident response, and security automation. Expertise spans SOAR/XSOAR orchestration, threat intelligence platforms, SIEM/UEBA analytics, and building cyber fusion centers. Background includes technical enablement, solution architecture for enterprise and government clients, and implementing security automation workflows across IR, TIP, and SOC use cases.

Threat Intelligence & AnalysisSecurity Orchestration (SOAR/XSOAR)Incident Response & Digital ForensicsSecurity Operations Center (SOC)SIEM & Security AnalyticsCyber Fusion & Threat SharingSecurity Automation & IntegrationManaged Detection & Response (MDR)

Tags

npmopen-sourcedependency confusiontyposquattingcredential theft

📢 Share This Article

Help others stay informed about cybersecurity threats

Continue Reading