Malicious Code Injection in @nagular/router Package
Summary
MAL-2026-17500: Malicious code in @nagular/router (npm). Affects @nagular/router versions 2.2.1. No fix is published. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The @nagular/router package is a JavaScript library designed for routing in web applications, similar to the well-known @angular/router. It is intended to facilitate navigation and manage application states. However, this package has been found to contain malicious code that can compromise user systems during installation.
Vulnerability Detail
The vulnerability originates from a preinstall lifecycle hook defined in the package.json file of @nagular/router. This hook executes a command that fetches a JavaScript payload from an unrelated third-party repository and pipes it directly into Node.js during the installation process. This action occurs automatically with full user privileges, allowing the execution of potentially harmful code without user consent. The package also impersonates the legitimate maintainer of the pillarjs/router package, further misleading users.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall @nagular/router
If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
As a temporary workaround, avoid using the @nagular/router package and consider using the legitimate @angular/router package instead. You can install it using the following command: npm install @angular/router.
Conclusion
The @nagular/router package contains a serious vulnerability due to malicious code execution during installation. Users are advised to uninstall this package and consider using legitimate alternatives. Utilizing tools like Vulert can help in monitoring and managing vulnerabilities effectively.
See every vulnerability recorded for @nagular/router →
FAQ
The malicious code is a JavaScript payload that is fetched from an external source and executed during the installation process, potentially compromising the user's system.
You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected without requiring signup.
If you have installed @nagular/router, you should uninstall it immediately using the command: npm uninstall @nagular/router.
Yes, the legitimate @angular/router package is a safe alternative that provides similar routing functionalities.
Vulert uses the package-lock.json file to monitor and alert in real-time for open-source vulnerabilities, providing insights into potential risks in your software.