{"id":"MAL-2026-6218","summary":"Malicious code in chai-as-attested (npm)","details":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (88e27467366a90f482eb47476458b1f74d5a41ac63371572e527f2e60e4e0b51)\nPackage impersonates a pino-style logger (exports `module.exports.pino`, ships pino-like `DEFAULT_LEVELS`, keywords `fast/logger/stream/json`) but the exported middleware spawns a detached `node lib/initializeCaller.js` that fetches a JSON document from a hardcoded free file-hosting URL (https://amethyst-lorrin-26.tiiny.site/index.json) and executes the `cookie` field of the response via `new Function.constructor('require', response)(require)`, granting the remote payload full Node `require` access. The endpoint URL and request headers are base64-encoded inside fake `process.env`-named constants and decoded at runtime with `atob` to evade scanners; the fetch is retried 5 times. Any consumer who imports the package and invokes the middleware (or runs the package's smoke script) executes attacker-controlled code on the host. The package name and pino-mimicking API surface are a lure — `chai-as-attested` has no relation to chai-as-promised or to pino.\n","modified":"2026-06-19T15:47:26.751012330Z","published":"2026-06-19T15:00:12Z","database_specific":{"malicious-packages-origins":[{"versions":["6.0.3"],"source":"amazon-inspector","sha256":"88e27467366a90f482eb47476458b1f74d5a41ac63371572e527f2e60e4e0b51","modified_time":"2026-06-19T15:00:12Z","import_time":"2026-06-19T15:41:55.286171535Z","id":"IN-MAL-2026-007072"}]},"references":[{"type":"PACKAGE","url":"https://www.npmjs.com/package/chai-as-attested/v/6.0.3"}],"affected":[{"package":{"name":"chai-as-attested","ecosystem":"npm","purl":"pkg:npm/chai-as-attested"},"versions":["6.0.3"],"database_specific":{"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/chai-as-attested/MAL-2026-6218.json","indicators":{"evidence_files":[{"path":"lib/initializeCaller.js","sha256":"2a41c6b7c5e256d70f884c613c6412ef73d86f8cd8a65afe6afb64fabaf4e022","tlsh":"f111008d61fc200c056512e6b22f18116022e4273d4ad4e47adc83470f9627fbd536df"},{"path":"package.json","sha256":"d31a4dfa7836b9e53773cd31bf1a91be67cac8e3b50a5a7ea2d7b871cfe882e7","tlsh":"22019c60ce788e2300ed25824c2a0643b6619c135928fc1932db512c0f9d5bf11ff21e"}],"package_integrity":[{"hashes":{"sha1":"6062fcd92a50e5e01ea2155aee1f972f75964547","sha512_sri":"sha512-TOpABde1f4vP3sWDQtQggQiLDExJspmu2YxIg/Vm9zAZViy4+EzSO9pM0tVLyvTn4rIs9+GWQskmnO/CjvdMdg=="},"filename":"chai-as-attested-6.0.3.tgz"}]},"cwes":[{"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"}]}