/

CVE-2026-33641

Severity:

HIGH RISK

(7.8)

Command Injection in Glances Monitoring Tool

CVE-2026-33641

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution and Potential Privilege Escalation

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 supports dynamic configuration values where substrings wrapped in backticks are executed as system commands during configuration parsing.

If an attacker can modify or influence Glances configuration files, arbitrary commands may run automatically with the privileges of the Glances process on startup or configuration reload, potentially leading to privilege escalation in elevated deployments.

Affected context

This vulnerability appears in Glances deployments that:

  • Use configuration files processed by Config.get_value() and
  • Allow dynamic configuration values containing backtick-enclosed substrings

The risk is higher when:

  • Configuration files are writable by non-admin users, external processes, or automated pipelines, or
  • Glances runs as a system service or with elevated privileges (e.g., root, service account with broad permissions)

In such contexts, any configuration parsing event (initial startup or reload) can transparently trigger command execution embedded in configuration values.

Exploit preconditions

  • Attack surface: Local environment or any environment that can influence Glances configuration files (filesystem, configuration management systems, or templating pipelines).
  • Required access: Ability to create, modify, or inject content into Glances configuration files or configuration sources consumed by Config.get_value().
  • Trigger point: Startup or configuration reload, when Glances reads and parses configuration values and evaluates backtick-enclosed substrings as system commands.
  • Why exploitation is possible: The configuration parser treats portions of configuration values wrapped in backticks as executable shell commands, with no validation, allowlist, or sandboxing. This turns configuration data into executable instructions, enabling command injection whenever an attacker controls or can influence those values.

Why this happens

The core issue is the conflation of configuration data with executable commands in the configuration parsing logic.

In Config.get_value(), substrings enclosed in backticks are executed as system commands, and their output is used as configuration values without any validation or constraint. This effectively embeds an interpreter into the configuration layer.

This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where user-controlled or externally influenced input is passed to the operating system command processor without proper sanitization, isolation, or policy checks.

Abstractly, the pattern is: "treat configuration as code" by interpreting special syntax (backticks) as shell commands, granting attackers a primitive for arbitrary command execution whenever they can control or partially control configuration content.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the Glances process
  • Privilege escalation when Glances runs as a system or root-level service
  • Local or lateral system compromise, including installation of backdoors or persistence mechanisms
  • Reading, modifying, or exfiltrating sensitive data accessible to the Glances service account
  • Tampering with monitoring output, logs, or metrics to hide malicious activity
  • Pivoting to other services or hosts reachable from the compromised environment

General mitigation guidance

Effective mitigation focuses on eliminating implicit command execution from configuration paths and tightening trust boundaries around configuration sources.

Recommended defensive patterns include:

  • Remove command evaluation from configuration parsing: Avoid executing configuration content as shell commands. Treat configuration strictly as data, not as code. If dynamic values are needed, use explicit, narrowly scoped mechanisms that do not invoke a shell.
  • Introduce strict configuration schemas: Define clear types and allowed value ranges for configuration fields, and validate inputs against these schemas before use. This discourages special syntaxes that map directly to command execution.
  • Use safe expansion primitives instead of shell execution: When dynamic behavior is necessary, prefer environment variable expansion or predefined tokens, resolved via safe, non-shell logic rather than system-level command interpreters.
  • Constrain the runtime environment: Run Glances with least-privilege accounts, limit filesystem write access to configuration directories, and segregate configuration ownership so untrusted users cannot modify configuration files.
  • Harden deployment and configuration management: Use configuration management tools (e.g., IaC, templates) that keep configuration immutable at runtime where possible, and enforce code-review-based changes to configuration in version control.

How teams detect issues like this

Detection can be approached through both code-centric and operations-centric practices:

  • Static analysis and code review:
  • Flag use of APIs that execute shell commands (e.g., os.system, subprocess, shell-backed helpers) in configuration parsing or startup paths.
  • Identify patterns where backtick-enclosed substrings, template expressions, or other special markers in configuration values are directly executed.
  • Review configuration-related functions (such as Config.get_value()) for any transformation that invokes system commands based on configuration content.
  • Policy and CI enforcement:
  • Enforce coding standards that prohibit command execution from configuration or log processing logic.
  • Use automated code scanning tools to detect OS command injection patterns and newly introduced dynamic evaluation mechanisms.
  • Runtime monitoring:
  • Monitor Glances processes for unusual child processes or shell invocations during startup or configuration reload.
  • Use host-based intrusion detection to alert on suspicious command patterns originating from the Glances service account.

Sources

SourceLink
github.comgithub.com/nicolargo/glances/commit/358d76a225fc21a9f95d2c4d7e46fafe64a644c6
github.comgithub.com/nicolargo/glances/releases/tag/v4.5.3
github.comgithub.com/nicolargo/glances/security/advisories/GHSA-qhj7-v7h7-q4c7

Frequently asked

questions

Exploitation depends on how configuration files are managed. If configuration is only locally editable by administrators, the risk is primarily local. However, if configuration is sourced from remote services, templates, or APIs that attackers can influence, an effective remote vector may exist.

The attacker needs the ability to create, modify, or influence Glances configuration files or any upstream configuration inputs processed by Config.get_value(). This might include local filesystem write access, control over configuration templates, or access to configuration management pipelines.

The safest pattern is to remove or disable command execution in the configuration layer entirely. Configuration values should be treated as plain data, with no automatic evaluation of backtick-enclosed or other special syntaxes as system commands, and any required dynamic behavior should use safe, non-shell mechanisms.

Avoid designs that treat configuration or logs as executable code, and adopt a strict separation between data and command execution. Combine this with least-privilege service accounts, immutable or tightly controlled configuration, security-focused code reviews for initialization and configuration paths, and automated checks for command injection patterns.

Find out what's already
exploitable in your codebase.