GHSA-hvx9-hwr7-wjj9: Systeminformation vulnerable to Linux command injection in networkInterfaces() via unsanitized NetworkManager connection profile name
SummaryOn Linux, `systeminformation` is vulnerable to command injection in `networkInterfaces()` when an **active NetworkManager connection profile name** contains shell metacharacters.This is not caused by a caller passing attacker-controlled arguments into `networkInterfaces()`. The vulnerable value is obtained internally from real `nmcli device status` output. The library sanitizes the network interface name before using it in shell commands, but it does **not** apply equivalent sanitization to the parsed NetworkManager connection profile name. That unsanitized `connectionName` is then interpolated into three shell command strings executed through `execSync()`.This issue was validated locally against **real NetworkManager** and **real `nmcli`**. Calling only:was enough to trigger execution. The injected command ran with the privileges of the calling Node.js process.Affected Component & Versions**Affected component:**[`lib/network.js`](https://github.com/sebhildebrandt/systeminformation/blob/ed1cac537c59763301d802ad1b55b4b8581e7553/lib/network.js)`networkInterfaces()`Linux NetworkManager / `nmcli` handlingImpact & Threat Model**Confirmed impact:**An attacker who can create or rename an **active NetworkManager connection profile** can execute arbitrary shell commands when a Node.js process using `systeminformation` calls `networkInterfaces()`.**Confirmed realistic affected deployments include:**local inventory agentsmonitoring agentsdiagnostics toolsadmin dashboard backends collecting host informationprivileged local desktop or device-management agentsIf such a process runs with elevated privileges, the injected command executes with those same elevated privileges.**Confirmed facts:**The payload was stored as a real NetworkManager connection profile name.Real `nmcli device status` returned the name unchanged.`networkInterfaces()` parsed that value and reused it in shell commands.The injected command ran as the calling Node.js process.Environment key categories were reachable from the injected process context.**Not claimed:**No remote exploitation claim is made.No `AV:N` or `AV:A` claim is made.No SSID-to-connection-name attack path is claimed.File-delivery-only `.nmconnection` import was not confirmed as a remote or unauthenticated path.Root Cause AnalysisThe root cause is inconsistent trust handling between the Linux interface name and the NetworkManager connection profile name.The interface name is sanitized before it is embedded into shell commands:However, the NetworkManager connection name is parsed from command output and later reused without equivalent sanitization:That is unsafe because NetworkManager profile names can contain shell metacharacters. Quoting the value inside `"${connectionName}"` does not make it safe. A connection name containing `"`, `$()`, `;`, backticks, or similar shell syntax can break out of the intended argument context or trigger command substitution.The vulnerable code executes through `execSync()`, which invokes a shell for command strings. As a result, interpolating `connectionName` into the command string creates a command-injection sink.Exact Code Flow & File Paths**Source:** [`lib/network.js:538-544`](https://github.com/sebhildebrandt/systeminformation/blob/ed1cac537c59763301d802ad1b55b4b8581e7553/lib/network.js#L538-L544)The parsed value is then returned as `connectionName`.**Trigger:** [`lib/network.js:987-991`](https://github.com/sebhildebrandt/systeminformation/blob/ed1cac537c59763301d802ad1b55b4b8581e7553/lib/network.js#L987-L991)**Sink 1:** [`lib/network.js:620`](https://github.com/sebhildebrandt/systeminformation/blob/ed1cac537c59763301d802ad1b55b4b8581e7553/lib/network.js#L620-L620)**Sink 2:** [`lib/network.js:660`](https://github.com/sebhildebrandt/systeminformation/blob/ed1cac537c59763301d802ad1b55b4b8581e7553/lib/network.js#L660-L660)**Sink 3:** [`lib/network.js:676`](https://github.com/sebhildebrandt/systeminformation/blob/ed1cac537c59763301d802ad1b55b4b8581e7553/lib/network.js#L676-L676)There are **three distinct exploitable `connectionName` sinks**.Proof of Concept (PoC) & Reproduction StepsThe following PoC is harmless and local-only. It uses a dummy NetworkManager connection and writes proof files under /tmp.Run from the project root:Confirm proof files do not already exist:Create a malicious NetworkManager dummy profile:Assign a documentation-only address so Node’s os.networkInterfaces() sees the dummy interface:Activate the profile:Confirm real nmcli exposes the malicious connection name unchanged:Expected relevant output includes the active connection name:Trigger the vulnerable library path with no attacker-controlled function argument:Confirm command execution:Inspect environment key categories without printing secret values:validated evidence:Local Validation Summary & Aggregate ReachabilityValidation was performed against **real NetworkManager** and **real `nmcli`**. The primary proof did not rely on a PATH stub.**Observed behavior:**The malicious profile was accepted by NetworkManager.The active connection name appeared unchanged in `nmcli device status`.Calling only `require('./lib').networkInterfaces()` triggered execution.The proof artifacts were created only after the library call.The `id` output matched the calling Node.js process identity.The `pwd` output matched the Node.js process working directory.The environment proof demonstrated access to process-environment categories without printing secret values.**Aggregate API reachability:**[`lib/index.js:94`](https://github.com/sebhildebrandt/systeminformation/blob/ed1cac537c59763301d802ad1b55b4b8581e7553/lib/index.js#L94-L94): `getStaticData()` reaches `network.networkInterfaces()` as part of static data collection.[`lib/index.js:307`](https://github.com/sebhildebrandt/systeminformation/blob/ed1cac537c59763301d802ad1b55b4b8581e7553/lib/index.js#L307-L307): `getAllData()` reaches `getStaticData()` first.During local validation, an aggregate runtime attempt later hit an unrelated `osinfo.js` error in that environment. Because of that, aggregate source reachability is confirmed, but aggregate call completion was **not** used as the primary exploit proof.Why This Is Not Intended Behavior`networkInterfaces()` is documented and expected to return network interface metadata such as interface name, IP addresses, DHCP state, DNS suffix, and IEEE 802.1X status.The library already shows an intent to protect shell command construction by sanitizing interface names before shell use. The missing sanitization for `connectionName` is inconsistent with that defensive pattern.Executing shell commands embedded in a NetworkManager profile name is not a documented feature, not required to return network metadata, and not an expected design tradeoff. This is a command injection vulnerability caused by unsafe shell-string construction.Recommended FixAvoid shell interpolation entirely for NetworkManager calls.Replace shell command strings with `execFileSync()` or `spawnSync()` using argument arrays. For example:**Recommended code-level changes:**Replace `nmcli device status 2>/dev/null | grep ${interfaceName}` with argument-array execution and filter rows in JavaScript.Replace every `nmcli connection show "${connectionName}" | grep ...` shell string with argument-array execution.Parse `ipv4.method`, `ipv4.dns-search`, and `802-1x.eap` in JavaScript instead of using shell `grep`.Treat NetworkManager profile names as untrusted input even though they originate from local system state.Do not rely on quoting or escaping as the main mitigation. Argument-array execution is the correct fix.Regression Test IdeasAdd Linux-specific tests for NetworkManager connection names containing shell metacharacters.**Suggested malicious connection names:**`name$(...)``name"; ...; #```name`...````name|...``name;...`**Expected behavior after the fix:**`networkInterfaces()` completes without executing shell syntax from the connection name.No marker files or equivalent side effects are produced.The function either returns metadata for the interface or safely returns unknown/default values for fields that cannot be queried.Tests cover all three current sink helpers:DHCP lookupDNS suffix lookupIEEE 802.1x auth lookupFor unit-level coverage, mock the NetworkManager command wrapper so that `nmcli device status` returns a connection name containing metacharacters, then assert that subsequent calls use argument arrays rather than shell strings.Credit requestIf you publish an advisory or assign a CVE, please credit me as:Ali Firas (thesmartshadow)  - https://www.smartshadow.dev
CVSS v3.1: 7.8