# GHSA-3C7V-C247-P7M9: Malicious code in array-flatten-utils (npm)

- Database: GitHub
- Malicious package: yes
- Published: 2026-11-23
- Modified: 2026-11-23

## Affected versions

- array-flatten-utils (npm): 1.0.2
- array-flatten-utils (npm): 1.0.5
- array-flatten-utils (npm): 1.0.1
- array-flatten-utils (npm): 1.0.4

## Description

## Source: amazon-inspector (48d3d3c9a8ee948f45acdef2355140fb44bd2fe21ab48d0da8b972d0e93e7dfc)
The 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 "<path>"` + 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<uid>.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.

---

Credit: [OpenSSF](https://github.com/ossf/malicious-packages) ([source](https://github.com/ossf/malicious-packages/blob/295d164deb82a5028f980f5b49bb4c518111003f/osv/malicious/npm/array-flatten-utils/MAL-2026-20346.json))

## References

- https://github.com/ossf/malicious-packages/blob/295d164deb82a5028f980f5b49bb4c518111003f/osv/malicious/npm/array-flatten-utils/MAL-2026-20346.json
- https://www.npmjs.com/package/array-flatten-utils/v/1.0.1
- https://www.npmjs.com/package/array-flatten-utils/v/1.0.2
- https://www.npmjs.com/package/array-flatten-utils/v/1.0.4
- https://www.npmjs.com/package/array-flatten-utils/v/1.0.5
- https://github.com/advisories/GHSA-3c7v-c247-p7m9

Page: https://cve.now/GHSA-3C7V-C247-P7M9

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
