{"id":"MAL-2026-13356","summary":"Malicious code in chai-foundry (npm)","details":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (94e40493af5310c6ee769911bff65e55538911ae3f286fba2a3474f9f8a38940)\nchai-foundry@7.0.2 is a trojan package presenting itself as a chai plugin (README shows `chai.use(chaiLeaf)`) while its badges, documentation, and internal version metadata (`lib/meta.js` exports version `9.6.0`) are copied from the pino logger. The package's main entry `index.js` immediately loads `./lib/config`, a 3.5MB file that is heavily obfuscated with obfuscator.io-class transforms: a rotated string array of 20,855 entries, two runtime decoder functions, tens of thousands of decoder-wrapper indirections, and control-flow flattening (104,934 deobfuscation changes reported by webcrack). The file begins with a top-level IIFE, so its opaque body runs automatically the moment any consumer calls `require('chai-foundry')`. All destinations and string constants are reconstructed at runtime, so the payload's network endpoints and behaviors are hidden from static inspection. The combination of identity impersonation, mismatched metadata, and a multi-megabyte control-flow-flattened import-time loader in a package advertised as a small chai plugin is the canonical shape of a hostile npm dropper/stealer.\n","modified":"2026-08-05T17:20:11.135790043Z","published":"2026-08-05T16:37:52Z","database_specific":{"malicious-packages-origins":[{"modified_time":"2026-08-05T16:37:52Z","sha256":"47d799affc9421116994671c24da24cabadfb12a42d5b12ac54b2fce2aa1afe2","source":"amazon-inspector","versions":["7.0.3"],"id":"IN-MAL-2026-015827","import_time":"2026-08-05T17:04:49.368060143Z"},{"id":"IN-MAL-2026-015828","import_time":"2026-08-05T17:04:49.46756877Z","modified_time":"2026-08-05T16:38:06Z","sha256":"94e40493af5310c6ee769911bff65e55538911ae3f286fba2a3474f9f8a38940","source":"amazon-inspector","versions":["7.0.2"]}]},"references":[{"type":"PACKAGE","url":"https://www.npmjs.com/package/chai-foundry/v/7.0.3"},{"type":"PACKAGE","url":"https://www.npmjs.com/package/chai-foundry/v/7.0.2"}],"affected":[{"package":{"name":"chai-foundry","ecosystem":"npm","purl":"pkg:npm/chai-foundry"},"versions":["7.0.3","7.0.2"],"database_specific":{"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/chai-foundry/MAL-2026-13356.json","cwes":[{"description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code","cweId":"CWE-506"},{"name":"Embedded Malicious Code","cweId":"CWE-506","description":"The product contains code that appears to be malicious in nature."}],"indicators":{"evidence_files":[{"sha256":"4e6c4e61a7019ab0affe9c2d20e36701b330ec357be205930355bac1464f9316","tlsh":"0421149124d560ce9938dac0f6306115acdbc677260752b3bdfc97c927860080161fba","path":"index.js"},{"path":"lib/config.js","sha256":"8397643af68793d57aec3637e79324e9183d6f1168009cd0676432515e88c515","tlsh":"261652d88984d123d3de9b13fe14a9a8f1fa79a6d4cce40b86987d4d29fc847d4a0cd4"},{"path":"package.json","sha256":"8f82750cc52cd72a3f3f941a3474b192a18cac0c56acdfbe35bfd6d8cf602d10","tlsh":"c0019e24de789e2304fd25524c2a06037a614c175528fc2932db612c4f5d5ff41ff21d"}],"package_integrity":[{"hashes":{"sha1":"16fad30993d42f54098d3873a08527f0e3057aaa","sha512_sri":"sha512-98Lhn+hs8c34dV82aVYJYuuJJ6PcoUQpi3lJr9Zp156eSXA5YEHpt6lt+tRzhQemoxCbNvn49bWPVixqpXATmA=="},"filename":"chai-foundry-7.0.3.tgz"}]}}}],"schema_version":"1.8.0","credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"}]}