MAL-2026-20554: Malicious code in native-stream-parser (npm)
--- -= Per source details. Do not edit below this line.=-
Source: amazon-inspector (d4fb217d81e79be4844f58b4467338645a739063a28f3b80009d5aad00cc3b58) On any require('native-stream-parser'), index.js platform-dispatches to one of three bundled N-API addons (native.napi.node, nativemac.node, nativewin.node). Each addon reads the shipped ~1.3MB opaque high-entropy.napicache file, decrypts it, writes it to a hidden temp path (/tmp/.<pid> on Unix, %TEMP%\<name>.nc<pid>.js on Windows), and launches it as a detached child process (fork+setsid+execlp on Unix; CreateProcessA with 'node "%s"' on Windows). The payload bytes are opaque and not derivable from any declared source, so the author controls arbitrary code executing on the installer's host at import time. Prior to execution, the addons probe for analysis environments: Linux reads /proc/1/cgroup, /proc/self/status (TracerPid), and /proc/self/maps; Windows calls IsDebuggerPresent, CheckRemoteDebuggerPresent, and enumerates processes via Toolhelp32 looking for wireshark/httpdebug; both check CI env vars including GITHUBACTIONS, GITLABCI, CIRCLECI, JENKINSURL, BUILDKITE, CODEBUILDBUILDID, TRAVIS, SANDBOX, APPVEYOR, SEMAPHORE, and TEAMCITYVERSION to gate execution. The JS 'parse' export is a one-line buf.toString() cover function unrelated to the native work; the package ships no README, no repository, no files/scripts manifest entries, and uses a generic name under a disposable-looking author. The combination of an encrypted bundled payload executed at import, debugger/CI/container evasion co-located with the decrypt-and-exec primitive, and a thin cover API matches a hostile dropper rather than the advertised stream-parsing utility.
Affected Software
Event History
Frequently Asked Questions
What action triggers the payload?
Simply importing the package with require('native-stream-parser') triggers platform dispatch to a bundled N-API addon. The addon decrypts the shipped cache file, writes a JavaScript payload to a hidden temporary path, and starts it as a detached child process.
Which systems are exposed?
The package includes separate bundled addons for Unix-like systems, macOS, and Windows. Unix payloads are written under /tmp using a hidden PID-based name, while Windows payloads are written under %TEMP% with a name ending in .nc<pid>.js.
Can CI or analysis environments be treated as safe?
No. The addons check multiple CI-related environment variables and probe for debugging or analysis indicators, including tracer and process information on Linux and debugger/process checks on Windows. These checks indicate environment-aware behavior, but the data does not state that execution is reliably prevented in those environments.
What evidence can indicate that the package executed?
Look for hidden PID-based files in /tmp on Unix or files named with an .nc<pid>.js suffix in %TEMP% on Windows. Process telemetry may also show a detached child process launched by the package, including node executing the temporary JavaScript file on Windows.