{"id":"MAL-2026-20346","summary":"Malicious code in array-flatten-utils (npm)","details":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (48d3d3c9a8ee948f45acdef2355140fb44bd2fe21ab48d0da8b972d0e93e7dfc)\nThe package presents itself as a trivial array utility (flatten/compact/unique) and mimics the name of the well-known `array-flatten` library, but index.js top-level loads a platform-specific native addon (`native_win.node` / `native_mac.node` / `native.napi.node`) inside a swallowed try/catch at require() time. The native addons read a shipped 6.7MB high-entropy `.napi_cache` blob, decode it, write it to a cache path (`%s.nc%lu.js`), and execute it as JavaScript via `node \"\u003cpath\u003e\"` + CreateProcessA on Windows, and via fork + setsid + execlp with an `__IS_DAEMON` re-exec flag on Linux/macOS to detach the dropped process. The Windows loader additionally calls SetFileAttributesA to hide the dropped `.nc\u003cuid\u003e.js` file in TEMP. Execution is gated to CI/build environments by checking a wide list of CI env vars (GITHUB_ACTIONS, GITLAB_CI, TRAVIS, CIRCLECI, JENKINS_URL, BUILDKITE, CODEBUILD_BUILD_ID, APPVEYOR, SEMAPHORE, TEAMCITY_VERSION, BITBUCKET_BUILD_NUMBER, NETLIFY, VERCEL, NOW_GITHUB_DEPLOYMENT, CF_BUILD_ID, SCREWDRIVER) and skipped when analysis tools or debuggers are detected (wireshark, procmon, procexp, x64dbg, ollydbg, fiddler, httpdebug, IsDebuggerPresent, CheckRemoteDebuggerPresent, /proc/self/status TracerPid, /proc/1/cgroup containerd). A pure-JS array helper has no legitimate reason to ship three native addons plus a 6.7MB opaque blob; the trivial JS surface is a cover story over an obfuscated staged loader targeting CI environments where credentials and deploy tokens are concentrated.\n","modified":"2026-11-23T08:30:03.875302681Z","published":"2026-11-23T08:08:04Z","database_specific":{"malicious-packages-origins":[{"versions":["1.0.2"],"id":"IN-MAL-2026-023045","import_time":"2026-11-23T08:17:31.350768839Z","modified_time":"2026-11-23T08:08:04Z","sha256":"1223f15f9524856b6d7d92998310a6413cfc005c935ef5fcd1c639af2db44240","source":"amazon-inspector"},{"import_time":"2026-11-23T08:17:31.400355651Z","modified_time":"2026-11-23T08:08:12Z","sha256":"48d3d3c9a8ee948f45acdef2355140fb44bd2fe21ab48d0da8b972d0e93e7dfc","source":"amazon-inspector","versions":["1.0.5"],"id":"IN-MAL-2026-023046"},{"modified_time":"2026-11-23T08:08:39Z","sha256":"6cd3524a12dae90b2d80296cd69b5971e84fc267d12909cbe88229c4ba5898d7","source":"amazon-inspector","versions":["1.0.1"],"id":"IN-MAL-2026-023050","import_time":"2026-11-23T08:17:31.503960824Z"},{"source":"amazon-inspector","versions":["1.0.4"],"id":"IN-MAL-2026-023049","import_time":"2026-11-23T08:17:31.476564471Z","modified_time":"2026-11-23T08:08:33Z","sha256":"cdb346e8abad3e2b94a726c46bf340d1468ae52a77d1ce919388d7691ec0bceb"}]},"references":[{"type":"PACKAGE","url":"https://www.npmjs.com/package/array-flatten-utils/v/1.0.2"},{"type":"PACKAGE","url":"https://www.npmjs.com/package/array-flatten-utils/v/1.0.5"},{"type":"PACKAGE","url":"https://www.npmjs.com/package/array-flatten-utils/v/1.0.1"},{"type":"PACKAGE","url":"https://www.npmjs.com/package/array-flatten-utils/v/1.0.4"}],"affected":[{"package":{"name":"array-flatten-utils","ecosystem":"npm","purl":"pkg:npm/array-flatten-utils"},"versions":["1.0.2","1.0.5","1.0.1","1.0.4"],"database_specific":{"cwes":[{"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.","name":"Embedded Malicious Code"},{"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"}],"indicators":{"evidence_files":[{"path":"index.js","sha256":"80eca5a62e5a0f5e51398e6899471b345316a2132ce95683fda92086e044f06a","tlsh":"d901b1c93bf8714c166425f523edc686e4e1d421814e475dca8ea5b51ad4ca0af2ccff"},{"path":"native_win.node","sha256":"cdefbd4ff465d8a990586513587862d6b66c6cb3fc78d01a7699b5cf3d8e7432","tlsh":"2f945c94b381fdf6dc494b7418d25309a37af081a71eeb3b6624fe3c0a5ab98dc63544"},{"sha256":"44a69a72391fb6c850319c2d2f56f75fcf3efca85256a07fe11e61082364295f","tlsh":"85d0a9648a21ac3300c69e251b28428612900d1b4002be58330b642c6ba97bb60ff20d","path":"package.json"}],"package_integrity":[{"filename":"array-flatten-utils-1.0.2.tgz","hashes":{"sha1":"5d3abf6b436b0d5157d222c27c26ab4e0f06d7cc","sha512_sri":"sha512-FKgfIbAdF4BJ52uwk+bcycp2aWWxdGOD8Ydt5hmQnhBLRKN1RG6O69rfbEMC68X3tLlyY1QXfI0tmHc91yTX3A=="}}]},"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/array-flatten-utils/MAL-2026-20346.json"}}],"schema_version":"1.9.2","credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"}]}