Summary
A command injection vulnerability in the networkInterfaces() function of the systeminformation Node.js library allows shell metacharacters embedded in NetworkManager connection profile names to be executed as part of system commands on Linux.
If an attacker can influence or create a NetworkManager connection profile with a crafted name, they may execute arbitrary commands with the privileges of the Node.js process that uses systeminformation.
Affected context
This vulnerability appears in Node.js applications that use affected versions of the systeminformation library (4.17.0 to 5.31.5) on Linux and call networkInterfaces().
The issue arises specifically when NetworkManager is in use and there exists at least one active connection whose profile name contains shell metacharacters (for example, characters that the shell interprets for command chaining or substitution).
The attack surface is limited to environments where an adversary can influence or create NetworkManager connection profiles, such as multi-tenant systems, misconfigured desktops or servers, or systems where network configuration is exposed to less-trusted users or automated provisioning.
Exploit preconditions
- Attack surface: Node.js processes running on Linux that import and invoke
systeminformation.networkInterfaces(). - Required access: Ability to create, modify, or control NetworkManager connection profiles (including their names) on the target system—this may be via local user access, misconfigured management tooling, or compromised provisioning scripts.
- Trigger point: Any code path that calls
networkInterfaces()on an affectedsysteminformationversion while the crafted NetworkManager connection is active and visible tonmcli. - Why exploitation is possible: The library sanitizes the network interface name but fails to apply equivalent sanitization to the NetworkManager connection profile name parsed from
nmclioutput. This unsanitizedconnectionNameis interpolated directly into shell command strings passed toexecSync(), allowing embedded shell metacharacters to break out of the intended command and inject arbitrary commands.
Why this happens
The underlying bug class is OS command injection (CWE-78) caused by constructing shell commands via string interpolation with partially trusted data.
The systeminformation library obtains connection profile names from nmcli output and uses them in multiple execSync() calls. While interface names are sanitized, the connection profile name is not normalized or escaped to remove or neutralize shell metacharacters.
This design couples data parsing with command construction, trusting that values returned by system utilities are safe. Because NetworkManager connection names can be user-controlled or influenced by external configuration tools, treating them as inherently safe violates the assumption that only benign values reach the shell, leading to injection when those values are interpreted by /bin/sh.
Potential impact
- Execution of arbitrary OS commands with the privileges of the Node.js application using
systeminformation. - Reading or modifying application data, configuration files, or environment variables accessible to the Node.js process.
- Establishing reverse shells or persistence mechanisms on the host under the application's user context.
- Pivoting to other services or internal resources reachable from the compromised host.
- Escalation of impact if the Node.js application runs with elevated privileges or is part of a privileged management stack.
General mitigation guidance
Effective mitigation focuses on eliminating string-constructed shell commands and reducing trust in values read from system utilities or configuration.
Pattern-based mitigations include:
- Replacing shell command construction with parameterized, non-shell APIs (for example, using direct system calls or Node.js libraries that do not invoke a shell).
- Applying strict normalization and escaping to any data that must be passed to a shell, including connection names, interface labels, and other identifiers parsed from external tools.
- Treating outputs from utilities like
nmclias untrusted input, subject to the same validation rules as user-supplied data. - Running Node.js applications with least-privilege users and limiting their ability to modify system-critical files or execute privileged operations.
- Isolating components that need to run shell commands into dedicated, constrained processes or containers, minimizing the blast radius of command injection defects.
How teams detect issues like this
Detection typically combines code-centric review with behavioral monitoring:
- Static analysis: Configure linters or security-focused static analyzers to flag use of
exec,execSync, or similar APIs when arguments are built from external input, especially values derived from system utilities or configuration files. - Code review signals: During manual review, pay special attention to any shell command that interpolates data from OS tools (
nmcli,ip, etc.). Look for missing escaping, quoting, or validation steps and for assumptions that "system output is trusted." - Policy enforcement: Establish coding guidelines that discourage or ban direct shell invocation from application code, or require justification and security review for such calls.
- Runtime monitoring: Use host-based intrusion detection or logging to monitor unexpected command executions by Node.js processes, such as unusual
nmcliinvocations or unexpected shell utilities running under the application user.

