Trusted Code Turned Into a Trap — Dozens of npm Packages Used to Steal Login Credentials
Security researchers uncovered 27 malicious npm packages that functioned as phishing infrastructure to harvest user credentials.

Security researchers have identified 27 malicious npm packages that attackers used as part of a coordinated phishing operation designed to steal login credentials. Unlike typical malware, these packages did not rely on direct exploitation. Instead, they acted as phishing infrastructure embedded inside trusted developer ecosystems.
The malicious packages posed as legitimate utilities and helper libraries. Once installed, they redirected users to attacker-controlled phishing pages or silently captured credentials entered during authentication workflows. As a result, developers and users unknowingly exposed usernames and passwords while interacting with what appeared to be standard software components.
How the npm Packages Enabled Credential Theft
The attackers published the packages to the npm registry using convincing names and descriptions. In some cases, they mimicked popular libraries to increase adoption. After installation, the packages injected phishing logic into authentication flows or linked users to fake login portals that closely resembled real services.
Instead of stealing data directly from systems, the attackers relied on social engineering combined with trusted code execution. Consequently, traditional security tools often failed to detect the activity, since the packages behaved like normal dependencies during installation.
Researchers observed that the stolen credentials targeted a range of services, including developer platforms, cloud dashboards, and online accounts. Once attackers obtained access, they could launch follow-on attacks such as account takeovers, cloud abuse, or source code theft.
Why This Attack Technique Is Effective
npm remains one of the most widely used package ecosystems in the world. Developers routinely install dependencies without deep inspection, especially for small utility packages. Therefore, attackers exploit this trust to scale phishing campaigns quickly.
This incident highlights a growing trend. Attackers increasingly shift from exploiting software vulnerabilities to abusing the software supply chain itself. By turning trusted packages into attack infrastructure, they bypass many traditional security assumptions.
Security experts recommend auditing dependencies regularly, limiting third-party packages, and monitoring for unusual network activity triggered by installed libraries. Developers should also verify package maintainers and avoid installing dependencies from unknown or recently created sources.
Overall, the discovery reinforces a critical lesson. In modern development environments, security risks do not only come from vulnerabilities in code — they also come from who controls the code you trust.