{"id":"MAL-2026-5900","summary":"Malicious code in chai-as-decrypted (npm)","details":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (3ed93b06c95c42e3183b89e5fb1d9dea3f711bb20d766861c8d16b8d17f17cc9)\nPackage name `chai-as-decrypted` mimics the popular `chai-as-promised`, and the README impersonates `pino` (uses pino's npm badges and links to github.com/pinojs/pino). On `npm install`, the `postinstall` hook runs `npm run smoke:pino` → `node./index.js`, whose top-level `runBackgroundTask()` spawns a detached `node lib/initializeCaller.js`. That file shadows the global `process` with a local object whose `env.DEV_API_KEY` is a base64 string; it `atob`-decodes the value to https://www.ipregionchecker.org/api/ip-check-encrypted/3aeb34a37, POSTs to it via axios, and executes the HTTP response body with `new Function.constructor(\"require\", response)(require)` — arbitrary remote JavaScript run with full `require` access on the installer's machine, retried 5 times. The base64 hiding of the endpoint and headers behind a fake `process.env` has no legitimate purpose and is solely to evade static scanners. This is a deliberate install-time remote code execution attack against developers who mistype `chai-as-promised`.\n","modified":"2026-06-16T18:16:52.838196273Z","published":"2026-06-16T16:18:25Z","database_specific":{"malicious-packages-origins":[{"sha256":"3ed93b06c95c42e3183b89e5fb1d9dea3f711bb20d766861c8d16b8d17f17cc9","versions":["4.2.8"],"source":"amazon-inspector","id":"IN-MAL-2026-006785","modified_time":"2026-06-16T16:18:25Z","import_time":"2026-06-16T18:10:20.278156633Z"}]},"references":[{"type":"PACKAGE","url":"https://www.npmjs.com/package/chai-as-decrypted/v/4.2.8"}],"affected":[{"package":{"name":"chai-as-decrypted","ecosystem":"npm","purl":"pkg:npm/chai-as-decrypted"},"versions":["4.2.8"],"database_specific":{"cwes":[{"description":"The product contains code that appears to be malicious in nature.","cweId":"CWE-506","name":"Embedded Malicious Code"}],"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/chai-as-decrypted/MAL-2026-5900.json","indicators":{"package_integrity":[{"filename":"chai-as-decrypted-4.2.8.tgz","hashes":{"sha1":"06ac394a2a86b83fa30350c17879a1c85fd27d3e","sha512_sri":"sha512-ypl31L0qfwb9j7U8dPIvLFDeMgiX9mQVvZfkKP/xhGtSG+yGHRr9cgNkCf3/ut/5uVgPOuisWZvtpl0h75YsNA=="}}],"evidence_files":[{"sha256":"76ca537732f161ae4d3a78b876390ddbab16e001c392a74009b31fb91ce4f89b","tlsh":"4d119c4d71f82008042151e5b62f14126025e4673d8ad5e4bacc834b1fa667fbd53adf","path":"lib/initializeCaller.js"},{"tlsh":"5301cb20debc4e2305ed15860c2a06037a615d175928fc2833e7922c0f9d5fb40ff21e","sha256":"566b1f7f56ac9149ff4381812ea8ee13e8b1a4c6512027996bddc19149f17b44","path":"package.json"}]}}}],"schema_version":"1.7.5","credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"}]}