/

CVE-2026-50289

Severity:

HIGH RISK

(8.8)

OS Command Injection (CWE-78) in systeminformation

CVE-2026-50289

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A command injection flaw in the systeminformation Node.js library allows attacker-controlled paths from Debian/Ubuntu network interface configuration to be interpolated into shell commands without quoting.

When a crafted source directive in /etc/network/interfaces is processed, an attacker can execute arbitrary OS commands in any Node.js process that calls networkInterfaces() or higher-level data collection APIs.

A command injection flaw in the systeminformation Node.js library allows attacker-controlled paths from Debian/Ubuntu network interface configuration to be interpolated into shell commands without quoting.

When a crafted source directive in /etc/network/interfaces is processed, an attacker can execute arbitrary OS commands in any Node.js process that calls networkInterfaces() or higher-level data collection APIs.

Affected context

This vulnerability arises in Node.js applications that use the systeminformation library on Linux systems, particularly Debian or Ubuntu derivatives that rely on the interfaces(5) configuration file.

The issue surfaces when /etc/network/interfaces contains a source directive whose path is influenced by an attacker, and the application invokes networkInterfaces(), getStaticData(), getAllData(), or other APIs that indirectly call checkLinuxDCHPInterfaces().

It typically becomes relevant in environments where network-related configuration files can be modified by lower-privileged users, scripts, or deployment tooling without strict validation or integrity controls.

This vulnerability arises in Node.js applications that use the systeminformation library on Linux systems, particularly Debian or Ubuntu derivatives that rely on the interfaces(5) configuration file.

The issue surfaces when /etc/network/interfaces contains a source directive whose path is influenced by an attacker, and the application invokes networkInterfaces(), getStaticData(), getAllData(), or other APIs that indirectly call checkLinuxDCHPInterfaces().

It typically becomes relevant in environments where network-related configuration files can be modified by lower-privileged users, scripts, or deployment tooling without strict validation or integrity controls.

Exploit preconditions

  • Attack surface: Local OS-level configuration via /etc/network/interfaces and derived source files.
  • Required access: Ability to create or modify a source path entry within the network interfaces configuration, or to influence included files referenced there.
  • Trigger point: Any invocation of systeminformation.networkInterfaces(), or composite API calls such as getStaticData() and getAllData() that internally call checkLinuxDCHPInterfaces().
  • Why exploitation is possible: The implementation reads the source <path> token from configuration, then constructs a shell command cat ${file} 2> /dev/null | grep 'iface\|source' using execSync() with the path interpolated unquoted, allowing shell metacharacters in the path to be interpreted as commands.
  • Attack surface: Local OS-level configuration via /etc/network/interfaces and derived source files.
  • Required access: Ability to create or modify a source path entry within the network interfaces configuration, or to influence included files referenced there.
  • Trigger point: Any invocation of systeminformation.networkInterfaces(), or composite API calls such as getStaticData() and getAllData() that internally call checkLinuxDCHPInterfaces().
  • Why exploitation is possible: The implementation reads the source <path> token from configuration, then constructs a shell command cat ${file} 2> /dev/null | grep 'iface\|source' using execSync() with the path interpolated unquoted, allowing shell metacharacters in the path to be interpreted as commands.

Why this happens

The core bug is an OS command injection pattern where untrusted text is directly embedded into a shell command without proper quoting or escaping.

In lib/network.js, checkLinuxDCHPInterfaces() treats configuration-sourced paths as trusted and concatenates them into a command string executed via execSync(), relying on the shell for expansion.

This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where user-controllable values containing shell metacharacters can alter the intended command or inject additional commands.

The core bug is an OS command injection pattern where untrusted text is directly embedded into a shell command without proper quoting or escaping.

In lib/network.js, checkLinuxDCHPInterfaces() treats configuration-sourced paths as trusted and concatenates them into a command string executed via execSync(), relying on the shell for expansion.

This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where user-controllable values containing shell metacharacters can alter the intended command or inject additional commands.

Potential impact

  • Execution of arbitrary OS commands under the privileges of the affected Node.js process.
  • Local privilege escalation if the application runs with elevated or system-level permissions.
  • Exfiltration or tampering of application data and environment secrets.
  • Disruption of services through process termination, resource exhaustion, or system misconfiguration.
  • Establishment of persistence mechanisms or lateral movement within the host or surrounding infrastructure.
  • Execution of arbitrary OS commands under the privileges of the affected Node.js process.
  • Local privilege escalation if the application runs with elevated or system-level permissions.
  • Exfiltration or tampering of application data and environment secrets.
  • Disruption of services through process termination, resource exhaustion, or system misconfiguration.
  • Establishment of persistence mechanisms or lateral movement within the host or surrounding infrastructure.

General mitigation guidance

Effective mitigation centers on removing direct shell interpolation and tightening trust boundaries around configuration-derived inputs.

Secure patterns include:

  • Avoiding shell-based exec for simple file operations: use native filesystem APIs (e.g., fs.readFileSync) instead of execSync("cat ... | grep ...").
  • If shell commands are unavoidable, strictly quoting and escaping all variables and using APIs that bypass the shell (e.g., spawn/execFile with argument arrays).
  • Treating configuration file content, including paths, as untrusted input and applying validation against expected formats, whitelists, or restricted directories.
  • Running Node.js services with least-privilege accounts so that, even if command injection occurs, the blast radius is limited.
  • Separating configuration management responsibilities, ensuring that files like /etc/network/interfaces and included sources cannot be modified by untrusted processes.

Effective mitigation centers on removing direct shell interpolation and tightening trust boundaries around configuration-derived inputs.

Secure patterns include:

  • Avoiding shell-based exec for simple file operations: use native filesystem APIs (e.g., fs.readFileSync) instead of execSync("cat ... | grep ...").
  • If shell commands are unavoidable, strictly quoting and escaping all variables and using APIs that bypass the shell (e.g., spawn/execFile with argument arrays).
  • Treating configuration file content, including paths, as untrusted input and applying validation against expected formats, whitelists, or restricted directories.
  • Running Node.js services with least-privilege accounts so that, even if command injection occurs, the blast radius is limited.
  • Separating configuration management responsibilities, ensuring that files like /etc/network/interfaces and included sources cannot be modified by untrusted processes.

How teams detect issues like this

Detection efforts typically focus on identifying unsafe command construction and validating configuration integrity.

Useful strategies include:

  • Static analysis rules that flag string concatenation into execSync, child_process.exec, or similar APIs, especially where values originate from configuration files or environment input.
  • Code reviews that look for shell commands built with unquoted or unsanitized variables, and encourage use of argument-based process invocation instead of shell pipelines.
  • Policy enforcement in CI/CD pipelines that restrict or ban shell-based execution patterns in libraries handling configuration or system introspection.
  • Host-based monitoring that watches for unexpected command executions triggered by common Node.js service processes, correlating them with calls to systeminformation APIs.
  • Configuration integrity checks or file monitoring on /etc/network/interfaces and referenced source files to detect unauthorized changes that might embed malicious paths.

Detection efforts typically focus on identifying unsafe command construction and validating configuration integrity.

Useful strategies include:

  • Static analysis rules that flag string concatenation into execSync, child_process.exec, or similar APIs, especially where values originate from configuration files or environment input.
  • Code reviews that look for shell commands built with unquoted or unsanitized variables, and encourage use of argument-based process invocation instead of shell pipelines.
  • Policy enforcement in CI/CD pipelines that restrict or ban shell-based execution patterns in libraries handling configuration or system introspection.
  • Host-based monitoring that watches for unexpected command executions triggered by common Node.js service processes, correlating them with calls to systeminformation APIs.
  • Configuration integrity checks or file monitoring on /etc/network/interfaces and referenced source files to detect unauthorized changes that might embed malicious paths.

Sources

SourceLink
github.comgithub.com/sebhildebrandt/systeminformation/commit/bbfddde48672d0ee124fefdb3cb4442fd9dd4f03
github.comgithub.com/sebhildebrandt/systeminformation/releases/tag/v5.31.7
github.comgithub.com/sebhildebrandt/systeminformation/security/advisories/GHSA-5xpp-75jx-m839

Frequently asked

questions

It can be, depending on how /etc/network/interfaces and its source files are managed. If remote users or services can influence those configuration paths (for example, via configuration management tools, provisioning scripts, or exposed interfaces), they may be able to trigger command injection when an application calls systeminformation APIs.

An attacker must be able to modify the network interfaces configuration or files referenced by source directives. In many setups, this might require local user or administrative access, but misconfigured systems or automated pipelines that accept external input could broaden the effective attack surface.

Replace shell-based exec operations with direct file and process APIs that do not invoke a shell, and validate all configuration-derived values before use. Where commands are necessary, construct them using parameterized invocation (e.g., execFile or spawn with arguments) and avoid string concatenation.

Adopt coding standards that prohibit unvalidated input from reaching shell commands, enforce static analysis checks on command execution APIs, and treat external configuration as untrusted by default. Combining secure coding practices with least-privilege runtime configurations and configuration integrity monitoring significantly reduces the risk of command injection.

It can be, depending on how /etc/network/interfaces and its source files are managed. If remote users or services can influence those configuration paths (for example, via configuration management tools, provisioning scripts, or exposed interfaces), they may be able to trigger command injection when an application calls systeminformation APIs.

An attacker must be able to modify the network interfaces configuration or files referenced by source directives. In many setups, this might require local user or administrative access, but misconfigured systems or automated pipelines that accept external input could broaden the effective attack surface.

Replace shell-based exec operations with direct file and process APIs that do not invoke a shell, and validate all configuration-derived values before use. Where commands are necessary, construct them using parameterized invocation (e.g., execFile or spawn with arguments) and avoid string concatenation.

Adopt coding standards that prohibit unvalidated input from reaching shell commands, enforce static analysis checks on command execution APIs, and treat external configuration as untrusted by default. Combining secure coding practices with least-privilege runtime configurations and configuration integrity monitoring significantly reduces the risk of command injection.

Find out what's already
exploitable in your codebase.