{"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-07-08T23:46:55.228731869Z","published":"2026-06-26T21:41:48Z","database_specific":{"malicious-packages-origins":[{"versions":["1.1.2"],"source":"amazon-inspector","sha256":"4643c1f27e4916ea6090f1e6196c980fa1d65b96899a80b1f57633eaf16a61a9","import_time":"2026-06-26T22:30:41.502825002Z","id":"IN-MAL-2026-007673","modified_time":"2026-06-26T21:41:55Z","ranges":[{"type":"SEMVER","events":[{"introduced":"0"}]}]},{"import_time":"2026-06-26T22:30:41.383738672Z","id":"IN-MAL-2026-007672","modified_time":"2026-06-26T21:41:48Z","ranges":[{"events":[{"introduced":"0"}],"type":"SEMVER"}],"versions":["1.1.3"],"source":"amazon-inspector","sha256":"ff88024c29a68b4dc5e73795a21a813393c8a6a56cfbef9c8a0950a63ec84256"},{"sha256":"b283e5aa252a764aa045b86b27f57b54f1c175cbd37e933bb0f60decbf8cb0ca","import_time":"2026-07-08T23:27:56.909353846Z","id":"IN-MAL-2026-008976","modified_time":"2026-07-08T23:00:42Z","versions":["1.1.0"],"source":"amazon-inspector"}]},"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"},{"type":"PACKAGE","url":"https://www.npmjs.com/package/@osmura/treeify/v/1.1.0"}],"affected":[{"package":{"name":"@osmura/treeify","ecosystem":"npm","purl":"pkg:npm/%40osmura/treeify"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"}]}],"versions":["1.1.2","1.1.3","1.1.0"],"database_specific":{"indicators":{"evidence_files":[{"tlsh":"4e932b867eea70af525251f3122f7196d56d9c99b24c8408f411ccecbf6423ce2b66bc","path":"treeify.js","sha256":"612b89ae1789817f9d1cca75f7c054010c1a1628afe538b31f1dced58c11a4b4"},{"path":"package.json","sha256":"bf5119c67c496a4174811894b622d38278bfd7c2ac268fb2f323639f7d1e2211","tlsh":"3201c020d9649d230adc79a06d5d0043a1204c4b58ecfd0577e7412c9b1c17738fd2ad"}],"package_integrity":[{"filename":"treeify-1.1.2.tgz","hashes":{"sha1":"3714725cbf68087940ee1830ddddf4d087795f8d","sha512_sri":"sha512-ljXKb95iSbTufE2YFpI4tPWpXg18K1s08/P0fY2OdKa/23pnXxgCy/ZCc6EHJSAdEYwCYDXhdZ3pY4Prk6+i5w=="}}]},"cwes":[{"description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code","cweId":"CWE-506"},{"cweId":"CWE-506","description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code"},{"description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code","cweId":"CWE-506"}],"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/@osmura/treeify/MAL-2026-6542.json"}}],"schema_version":"1.7.5","credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"}]}