/

CVE-2026-53925

Severity:

HIGH RISK

(7.8)

Command Injection (CWE-22) in Glances AMP secure_popen

CVE-2026-53925

Deferred

Vulnerability type

Category:

Command Injection

CWE:

CWE-22

Impact:

Arbitrary command execution and file write via AMP commands

Severity:

HIGH RISK

(7.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

Glances AMP modules pass configuration-defined command strings into a helper that interprets shell operators like redirection, pipes, and command chaining without validation.

If an attacker can modify glances.conf, they can cause Glances to write arbitrary data to files, invoke additional commands, or pipe output to arbitrary programs during monitoring.

Affected context

This vulnerability appears in Glances deployments that use Application Monitoring Process (AMP) modules whose command or service_cmd values are loaded from glances.conf.

In affected versions, those configuration values are handed to secure_popen() in glances/secure.py, which interprets shell-like operators (>, |, &&) embedded in the string.

Installations where configuration files are editable by non-privileged users, external automation, or misconfigured services are more exposed, especially when Glances runs with elevated permissions or broad filesystem access.

Exploit preconditions

  • Attack surface: Glances runtime, specifically AMP modules invoked via secure_popen().
  • Required access: Ability to modify glances.conf or any configuration source that influences AMP command/service_cmd values.
  • Trigger point: Execution of an AMP command or service_cmd that includes redirection (>), piping (|), or chaining (&&) operators.
  • Why exploitation is possible: secure_popen() interprets and applies shell operators from the configuration string without validating paths, commands, or destinations, effectively treating configuration as trusted shell syntax.

Why this happens

The root cause is the insecure handling of command strings originating from configuration in the secure_popen() function.

Instead of treating configuration values as data with strict constraints, the implementation parses and applies shell-style operators such as file redirection, pipes, and command chaining directly.

This maps to CWE-22 in the sense that untrusted input is used to construct filesystem paths and influence where data is written, combined with a broader command-injection pattern where configuration content controls process invocation behavior.

The abstract pattern is: "application logic uses unvalidated configuration text to build commands and file operations that the OS interprets," allowing attackers who control configuration to extend or redirect those operations.

Potential impact

  • An attacker can cause Glances to write arbitrary content to arbitrary filesystem paths using output redirection.
  • Monitoring commands can be chained with additional arbitrary commands, expanding the actions taken during AMP execution.
  • Command output can be piped into other programs to perform unintended data processing or leakage.
  • Glances may be abused to modify configuration files, logs, or application data, depending on its runtime privileges.
  • In environments where Glances runs with elevated permissions, exploitation can lead to broader system compromise.

General mitigation guidance

Mitigation typically involves constraining how commands are formed and executed from configuration-driven values.

Defensive patterns include:

  • Treat configuration as data, not shell syntax: avoid parsing or interpreting operators like >, |, and && in helper functions.
  • Use fixed command templates where only well-defined, validated parameters (e.g., arguments or flags) are substituted into a safe execution API.
  • Validate filesystem paths against allowlists or scoped directories before permitting any file write or redirection originating from configuration.
  • Run Glances with least privilege, limiting its ability to write to sensitive system locations or execute external programs.
  • Separate monitoring command configuration from execution logic using structured formats (e.g., lists of arguments) rather than free-form command strings.

How teams detect issues like this

Detection can focus on both code and configuration behavior:

  • Static analysis and code review can flag functions that parse or interpret shell operators from strings loaded from configuration, environment variables, or user input.
  • Look for helper routines that reconstruct command lines, concatenate operators, or pass unsanitized strings to subprocess execution APIs.
  • Enforce internal policies that prohibit free-form shell command configuration for monitoring or automation services; prefer structured commands with validated arguments.
  • Periodically scan glances.conf and related configuration files for suspicious operators (>, |, &&) and unexpected destinations or commands.
  • Automated security reviews or CI checks can be configured to detect patterns where configuration-derived values are used to influence filesystem write locations or chained commands.

Sources

SourceLink
github.comgithub.com/nicolargo/glances/security/advisories/GHSA-3vwc-qwhc-3mj7

Frequently asked

questions

Exploitation is limited to environments where an attacker can modify glances.conf or equivalent configuration sources. In those scenarios, every AMP execution that relies on the altered command can be leveraged to perform unintended file writes or command invocations.

The attacker needs write access to the Glances configuration file or the mechanism that populates AMP command and service_cmd values. This may come from filesystem misconfigurations, abused deployment tooling, or compromised accounts that can edit configuration.

The safest approach is to stop interpreting shell operators from configuration text and instead execute commands via structured APIs where only vetted arguments are allowed. Restrict file paths and commands to a known-safe set and ensure configuration cannot introduce new operators or arbitrary destinations.

Design monitoring and automation tools so that configuration describes options and parameters, not raw shell command lines. Apply strict validation to any configuration that influences command execution or file paths, use least-privilege execution contexts, and incorporate automated checks to flag any code paths that treat configuration as executable shell syntax.

Find out what's already
exploitable in your codebase.