Malicious Code Vulnerability in @dransay/secrets Package
Summary
MAL-2026-17699: Malicious code in @dransay/secrets (npm). Affects @dransay/secrets versions 99.0.0. 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 @dransay/secrets package is an npm library that is intended for managing secrets in applications. It is designed to provide developers with a simple way to handle sensitive information securely. However, this package has been found to contain malicious code that compromises the security of systems that install it.
Vulnerability Detail
The vulnerability originates from a preinstall script in the @dransay/secrets package that executes a file named beacon.js. This script performs a DNS lookup and an HTTPS GET request to a hardcoded collector host during the npm install process. The requests include sensitive information such as the package name, the source IP of the machine, and the resolver identity, which can lead to unauthorized data exposure and potential exploitation by malicious actors. The package is designed to exploit dependency confusion, targeting internal package names to disclose sensitive information about the build environment.
How To Fix
This package is malicious. Remove it and rotate any credentials it could have accessed.
npm uninstall @dransay/secrets
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, you can prevent the installation of the malicious package by using npm's package-lock.json file to lock the dependencies. Additionally, consider using tools like Vulert to monitor your project for vulnerabilities. You can check if your application is affected by this vulnerability using the Vulert playground at https://vulert.com/scanner without any signup.
Conclusion
The @dransay/secrets package contains a serious vulnerability due to embedded malicious code that can expose sensitive information. It is essential to uninstall this package and monitor your dependencies for vulnerabilities using tools like Vulert to ensure the security of your applications.
See every vulnerability recorded for @dransay/secrets →
FAQ
The @dransay/secrets package is an npm library designed for managing secrets in applications, but it has been found to contain malicious code.
The malicious code executes a script during installation that sends sensitive information to a third-party collector, compromising the security of the system.
You should uninstall the @dransay/secrets package immediately and replace it with a secure alternative.
You can use tools like Vulert, which monitors your project for open-source vulnerabilities in real-time using just the package-lock.json file.
Yes, you can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without any signup.