{"id":"MAL-2026-12540","summary":"Malicious code in chai-as-inspired (npm)","details":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (bc4795830ed2849aaf2a6eaa488fbecc42a31c2d6d212fe34e635c16217e46ed)\nchai-as-inspired is a typosquat resembling chai/pino packages. Its middleware entrypoint (index.js) spawns a detached `node lib/caller.js` child on invocation. caller.js hides its network destination behind a fake `process.env` object whose values are base64 blobs; decoding yields the URL https://api.jsonstorage.net/v1/json/2ef8c758-a96f-459e-b036-b3b90379a165/f89e8264-86c2-4684-94da-c3f82d59370f and an `x-secret-key` header. The response's `cookie` field is passed to `new Function.constructor('require', s)(require)`, executing attacker-controlled JavaScript in a retry loop with the installer's `require` and full Node privileges. The remote content is hosted on a mutable, anonymous JSON-storage bucket and can be changed at any time by the operator. The base64 disguise of the endpoint and header keys, combined with the fetch-and-eval mechanism, establishes hostile intent.\n","modified":"2026-09-01T11:31:00.898688985Z","published":"2026-08-05T13:33:19Z","database_specific":{"malicious-packages-origins":[{"versions":["2.2.4"],"id":"IN-MAL-2026-014977","import_time":"2026-08-05T14:19:48.641055279Z","modified_time":"2026-08-05T13:33:19Z","sha256":"bc4795830ed2849aaf2a6eaa488fbecc42a31c2d6d212fe34e635c16217e46ed","source":"amazon-inspector"},{"versions":["2.2.4"],"id":"RLMA-2026-06117","import_time":"2026-09-01T11:17:27.745635943Z","modified_time":"2026-08-24T16:43:26Z","sha256":"704d1638e1c13d80e480c6d20b2ff29e94b67e9a1305a87b749e721db0dab74a","source":"reversing-labs"}]},"references":[{"type":"PACKAGE","url":"https://www.npmjs.com/package/chai-as-inspired/v/2.2.4"}],"affected":[{"package":{"name":"chai-as-inspired","ecosystem":"npm","purl":"pkg:npm/chai-as-inspired"},"versions":["2.2.4"],"database_specific":{"cwes":[{"description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code","cweId":"CWE-506"}],"indicators":{"package_integrity":[{"hashes":{"sha512_sri":"sha512-YGDDLhVy5rc1IQpW74EZy85bza4B6XznnZUYeZr8V8g3zqy5+B8LVMcztczl4PTInJNIS/sJ/eYtVj0Y3Bw0KQ==","sha1":"11ea6078ee1e5eb5a87a694f248ad856e9732f0f"},"filename":"chai-as-inspired-2.2.4.tgz"}],"evidence_files":[{"tlsh":"6e01efd934fd501c021111ea171fa032a010e4373882d6c8374cc7428fa66bd2e93aef","path":"lib/caller.js","sha256":"ffa61701ff61ebc0c6d64cf09f5bc37a74a91b03b716129b90271d758dc164b7"}]},"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/chai-as-inspired/MAL-2026-12540.json"}}],"schema_version":"1.9.0","credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"},{"name":"ReversingLabs","contact":["https://www.reversinglabs.com"],"type":"FINDER"}]}