{"id":"MAL-2026-6995","summary":"Malicious code in chai-redirection (npm)","details":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (38236fbbdbbaa8f8ed9315c3a4ff01fbf049215896036b1cb68611681fe0eb00)\nchai-redirection presents itself as a chai assertion plugin but its main entry (index.js) unconditionally spawns a detached Node child process running lib/caller.js the moment the package is required. caller.js issues an HTTPS GET to https://www.jsonkeeper.com/b/PC5CK (a mutable pastebin-style host) and passes the response body's `cookie` field to `new Function('require', res.data.cookie)(require)`, executing attacker-controlled JavaScript in the installer's Node process with full `require` access. A secondary code path builds a URL from lib/config values, and on a 404 response whose body carries a `token` field, constructs `new Function.constructor('require', res.token)` and invokes it with `require` — a second remote-code-execution channel. The advertised chai plugin API (validJWT, safeString, etc.) is a cover story: the loader runs before any exports are used, so merely requiring this package as a chai plugin triggers remote code execution. The mutable pastebin source means today's payload can be replaced with anything at any time without republishing the package.\n\n## Source: ghsa-malware (996d340e8231861ae21a30061eda3164b993e15bd08346375d8f886824b4fb6f)\nAny 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.\n","aliases":["GHSA-89c7-5mf7-c86r"],"modified":"2026-07-10T03:31:47.352469670Z","published":"2026-07-08T16:35:33Z","database_specific":{"malicious-packages-origins":[{"modified_time":"2026-07-08T16:35:33Z","id":"IN-MAL-2026-008158","import_time":"2026-07-08T17:01:35.194279681Z","source":"amazon-inspector","versions":["0.0.1"],"sha256":"38236fbbdbbaa8f8ed9315c3a4ff01fbf049215896036b1cb68611681fe0eb00"},{"id":"IN-MAL-2026-009140","import_time":"2026-07-09T16:20:44.76908Z","sha256":"5fa3226f03b258b5a320071e9202c193f8031b42b4bbfa247c4ec30fe453bf97","source":"amazon-inspector","versions":["0.0.4"],"modified_time":"2026-07-09T15:34:10Z"},{"versions":["0.0.3"],"modified_time":"2026-07-09T15:32:57Z","id":"IN-MAL-2026-009132","source":"amazon-inspector","import_time":"2026-07-09T16:20:43.864554194Z","sha256":"66a724f4463753c5a086bd3fe0548103ad8ea5e65db1f29a5555627e7ace2f98"},{"sha256":"996d340e8231861ae21a30061eda3164b993e15bd08346375d8f886824b4fb6f","source":"ghsa-malware","modified_time":"2026-07-10T02:57:55Z","ranges":[{"type":"SEMVER","events":[{"introduced":"0"}]}],"import_time":"2026-07-10T03:23:39.548670986Z","id":"GHSA-89c7-5mf7-c86r"}]},"references":[{"type":"PACKAGE","url":"https://www.npmjs.com/package/chai-redirection/v/0.0.1"},{"type":"PACKAGE","url":"https://www.npmjs.com/package/chai-redirection/v/0.0.4"},{"type":"PACKAGE","url":"https://www.npmjs.com/package/chai-redirection/v/0.0.3"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-89c7-5mf7-c86r"}],"affected":[{"package":{"name":"chai-redirection","ecosystem":"npm","purl":"pkg:npm/chai-redirection"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"}]}],"versions":["0.0.1","0.0.4","0.0.3"],"database_specific":{"indicators":{"package_integrity":[{"hashes":{"sha512_sri":"sha512-sDhCWBs5UJCI3N9QY1nKySTfWtiK8oEHyZfgIN5ZJiDkzri98fMv1ll0I18F6iVeYFiutv27LJSkKGRgmP1Afw==","sha1":"4a131fc6d721239878a742df034785187ab9abeb"},"filename":"chai-redirection-0.0.1.tgz"}],"evidence_files":[{"path":"lib/caller.js","tlsh":"de31585b34fe311c0b35a8d98b4b84253567e5232626d0c0f14c87c11fb685e9677bdc","sha256":"22f2afbfcf4ec7813b14e67c51fb9021c3845c39d3cf82150bec651b693ee50b"},{"sha256":"195c47d5205f56ae30ddd48a1ffbefb40c230264ca4127379b8d4fee15e5da88","tlsh":"dfc1cfa839a3e0188523b1f5097fa416d476a027202dd9d8b5ecc2d01fddee89523dfb","path":"index.js"}]},"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/chai-redirection/MAL-2026-6995.json","cwes":[{"description":"The product contains code that appears to be malicious in nature.","cweId":"CWE-506","name":"Embedded Malicious Code"},{"description":"The product contains code that appears to be malicious in nature.","cweId":"CWE-506","name":"Embedded Malicious Code"},{"description":"The product contains code that appears to be malicious in nature.","cweId":"CWE-506","name":"Embedded Malicious Code"},{"description":"The product contains code that appears to be malicious in nature.","cweId":"CWE-506","name":"Embedded Malicious Code"}]}}],"schema_version":"1.7.5","credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"}]}