{"id":"MAL-2026-6542","summary":"Malicious code in @osmura/treeify (npm)","details":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (4643c1f27e4916ea6090f1e6196c980fa1d65b96899a80b1f57633eaf16a61a9)\nThe package republishes the upstream `treeify` library (Luke Plaster, repo notatestuser/treeify) verbatim under the unrelated `@osmura` scope, preserving the original package.json author/repository/keywords/README as cover. Appended to `treeify.js` (starting around line 115) is ~93KB of obfuscator.io-style code (RC4+base64 string-array, `while(!![])` control-flow flattening) that runs whenever a consumer does `require('@osmura/treeify')`. The injected code re-spawns Node detached with a marker environment variable, issues an HTTPS request to a hostname encoded inside the obfuscated string array, AES-256-GCM-decrypts the response using a key XOR-derived from four embedded base64 buffers, writes the plaintext payload into `os.tmpdir()/\u003cname\u003e-\u003cpid\u003e/`, and spawns it via `child_process.spawn(..., {stdio:..., windowsHide: true, detached: true})` — see treeify.js:116 `var aM = at[ba(0x19,...)](aK, aL, {'stdio':..., 'windowsHide':!![], 'detached':!![]})` and the corresponding `https.request({method: 'GET', hostname: aG[...], timeout: 60000},...)` call. Two independent injected IIFEs implement the same dropper with separate encoded URL pools, providing fallback C2. Any installer that requires this package fetches and executes attacker-controlled code on their machine at import time.\n","modified":"2026-06-26T22:46:40.425781594Z","published":"2026-06-26T21:41:48Z","database_specific":{"malicious-packages-origins":[{"source":"amazon-inspector","versions":["1.1.2"],"ranges":[{"type":"SEMVER","events":[{"introduced":"0"}]}],"import_time":"2026-06-26T22:30:41.502825002Z","id":"IN-MAL-2026-007673","sha256":"4643c1f27e4916ea6090f1e6196c980fa1d65b96899a80b1f57633eaf16a61a9","modified_time":"2026-06-26T21:41:55Z"},{"source":"amazon-inspector","versions":["1.1.3"],"ranges":[{"type":"SEMVER","events":[{"introduced":"0"}]}],"import_time":"2026-06-26T22:30:41.383738672Z","id":"IN-MAL-2026-007672","sha256":"ff88024c29a68b4dc5e73795a21a813393c8a6a56cfbef9c8a0950a63ec84256","modified_time":"2026-06-26T21:41:48Z"}]},"references":[{"type":"PACKAGE","url":"https://www.npmjs.com/package/@osmura/treeify/v/1.1.2"},{"type":"PACKAGE","url":"https://www.npmjs.com/package/@osmura/treeify/v/1.1.3"}],"affected":[{"package":{"name":"@osmura/treeify","ecosystem":"npm","purl":"pkg:npm/%40osmura%2Ftreeify"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"}]}],"versions":["1.1.2","1.1.3"],"database_specific":{"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/@osmura/treeify/MAL-2026-6542.json","cwes":[{"name":"Embedded Malicious Code","cweId":"CWE-506","description":"The product contains code that appears to be malicious in nature."},{"name":"Embedded Malicious Code","cweId":"CWE-506","description":"The product contains code that appears to be malicious in nature."}],"indicators":{"evidence_files":[{"tlsh":"4e932b867eea70af525251f3122f7196d56d9c99b24c8408f411ccecbf6423ce2b66bc","path":"treeify.js","sha256":"612b89ae1789817f9d1cca75f7c054010c1a1628afe538b31f1dced58c11a4b4"},{"tlsh":"3201c020d9649d230adc79a06d5d0043a1204c4b58ecfd0577e7412c9b1c17738fd2ad","path":"package.json","sha256":"bf5119c67c496a4174811894b622d38278bfd7c2ac268fb2f323639f7d1e2211"}],"package_integrity":[{"hashes":{"sha1":"3714725cbf68087940ee1830ddddf4d087795f8d","sha512_sri":"sha512-ljXKb95iSbTufE2YFpI4tPWpXg18K1s08/P0fY2OdKa/23pnXxgCy/ZCc6EHJSAdEYwCYDXhdZ3pY4Prk6+i5w=="},"filename":"treeify-1.1.2.tgz"}]}}}],"schema_version":"1.7.5","credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"}]}