CVE-2021-21315: System Information Library for Node.JS Command Injection
In this vulnerability, an attacker can send a malicious payload that will exploit the name parameter. After successful exploitation, attackers can execute remote.
CVE-2021-21315 is a command-injection vulnerability in the npm package known as the System Information Library for Node.JS. An attacker who can influence a specific input (the name parameter) may cause the library to run unintended operating-system commands, potentially leading to remote code execution on the host that runs the Node.js application. Because this library is commonly pulled in as a dependency to gather system metrics, the flaw can affect production services that never intended to expose shell access. Teams should treat it as a high-priority review item and confirm exact impact against the vendor advisory.
How it works
The underlying weakness is CWE-78: improper neutralization of special elements used in an OS command (“OS Command Injection”). The library accepts a name parameter and, in vulnerable versions, incorporates that value into a shell command without adequate sanitization or argument separation. An attacker who can supply a malicious payload for that parameter can therefore inject additional commands or arguments. Once the injected command runs with the privileges of the Node.js process, the attacker gains the ability to execute arbitrary code on the underlying system. Public detail on the precise payload format is limited; defenders should rely on the vendor advisory rather than attempting to reverse-engineer exploit strings.
Am I affected? How to find it in your systems
The component is an npm package used by Node.js applications that need system-information data (CPU, memory, disks, network interfaces, and similar). It typically appears as a direct or transitive dependency inside package.json / package-lock.json or yarn.lock files, and may be present in container images, serverless functions, or developer workstations that run Node.js services.
- Inventory every Node.js project and container image; search lock files and node_modules for the System Information Library package name.
- Compare the installed version against the fixed versions listed in the vendor advisory; do not assume a version is safe without that confirmation.
- Review application code paths that call the library’s APIs and pass user-controlled or externally supplied values into the name parameter.
- On hosts that already run the library, examine process-execution and shell-history logs, auditd or EDR telemetry for unexpected child processes spawned by the Node.js runtime, and any anomalous command lines that appear shortly after requests that touch system-information endpoints.
If the package is present but the name parameter is never populated from untrusted input, residual risk is lower; still verify the version and plan an update.
How to remediate
The primary action is to apply the vendor-supplied update. CISA’s required action is simply “Apply updates per vendor instructions.” Replace the vulnerable package with the patched release, rebuild and redeploy affected applications, and regenerate lock files so that transitive dependents also receive the fix. After patching:
- Re-run dependency scanners to confirm the vulnerable version is no longer present.
- Where feasible, stop passing unsanitized external input into any system-information APIs; prefer allow-lists or fixed identifiers.
- Run Node.js processes with least privilege (non-root, restricted file-system and network capabilities) so that any future injection has limited blast radius.
- Enable application and host logging of process creation so that anomalous command execution can be detected quickly.
If you can't patch immediately
Until the update can be deployed, reduce exposure with compensating controls:
- Network segmentation: isolate hosts that run the vulnerable library from untrusted networks and from high-value internal assets.
- Disable or stub out the affected library calls if the functionality is not business-critical; return static or cached data instead.
- Apply virtual patching at a web application firewall or API gateway if the name parameter is reachable via HTTP; block or strictly validate inputs that contain shell metacharacters. Confirm any WAF rule against the vendor advisory so legitimate traffic is not broken.
- Increase monitoring: alert on Node.js processes spawning shells (sh, bash, cmd.exe, powershell) and on unexpected outbound connections originating from those processes.
- Temporarily remove the package from environments that do not require live system metrics.
These steps only buy time; they do not replace the vendor patch.
If your data may have been exposed
Actively exploited command-injection flaws can lead to full host compromise and subsequent data theft or ransomware, although ransomware use specifically tied to this CVE is not documented. If you discover evidence of exploitation, follow your incident-response plan: isolate the host, preserve volatile logs, rotate credentials that may have been accessible to the Node.js process, and assess whether sensitive data left the environment. As a quick additional check, you can run a free exposure scan of your email addresses against known breach data sets to see whether any associated accounts already appear in public dumps.
AICompiled with AI assistance from public sources and published under our editorial standards.