/

CVE-2026-46606

Severity:

HIGH RISK

(7.8)

Command Injection (CWE-78) in Glances KVM Monitor

CVE-2026-46606

Deferred

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

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

A command injection vulnerability in Glances' KVM/QEMU monitoring engine allows unsanitized VM domain names to be embedded into shell-like command strings processed by secure_popen().

If an attacker can create or rename virtual machines on the host, they can craft domain names that cause arbitrary command execution as the OS user running Glances, often root on hypervisor systems.

Affected context

This vulnerability appears in Glances deployments that enable the KVM/QEMU monitoring engine using virsh on hypervisor or virtualization hosts.

It assumes Glances is running with sufficient privileges to invoke virsh and that VM domain names are taken directly from virsh list --all output without validation.

Risk is higher in environments where non-admin users or orchestration tools can create or rename VMs, or where Glances runs as root on production hypervisors.

Exploit preconditions

  • Attack surface: Glances host running the KVM/QEMU monitoring plugin that calls virsh.
  • Required access: Ability to create or rename KVM/QEMU virtual machines (or otherwise influence domain names reported by virsh).
  • Trigger point: Periodic execution of monitoring commands that interpolate domain names into f-strings passed to secure_popen().
  • Why exploitation is possible: Domain names are treated as trusted input and inserted into command templates that interpret &&, |, >, and similar characters as shell operators, enabling execution of attacker-controlled commands.

Why this happens

The underlying flaw is the construction of shell-like command strings using unvalidated external input—VM domain names—followed by execution through an API (secure_popen()) that deliberately parses operator characters.

This behavior matches CWE-78: Improper Neutralization of Special Elements used in an OS Command, where user-controlled data is allowed to inject control characters into a command line.

At a pattern level, the plugin mixes data (domain names) and control (operators and command templates) without escaping, treating strings from virsh output as safe, and thereby turning configuration or resource names into a command channel.

Potential impact

  • Attackers may execute arbitrary OS commands with the privileges of the Glances process, commonly root on hypervisor hosts.
  • Malicious commands could modify or destroy virtual machines and associated disk images.
  • Host-level compromise can enable credential theft, data exfiltration, or lateral movement to other infrastructure nodes.
  • Monitoring integrity can be disrupted, hiding malicious activity or poisoning operational visibility.

General mitigation guidance

Effective mitigation focuses on separating user-controlled data from command execution paths.

Common defensive patterns include:

  • Avoid building shell command strings with interpolated identifiers; use structured process execution APIs that take argument lists instead.
  • Normalize and validate VM domain names, rejecting or escaping characters that have special meaning in shells or command parsers.
  • Treat hypervisor-derived identifiers as untrusted, even when they originate from administrative tools, and enforce an allowlist of safe character sets.
  • Run monitoring tools like Glances with least-privilege accounts rather than root, and constrain their accessible command surface where feasible.
  • Introduce secure-by-default wrappers around command execution utilities that prohibit interpretation of shell operators in inputs.

How teams detect issues like this

Detection typically involves:

  • Static analysis rules that flag f-strings or string concatenation used to build commands from external data, especially when combined with custom popen wrappers.
  • Code review practices that require explicit validation or escaping of resource names before they reach command execution APIs.
  • Configuration and security policy checks ensuring monitoring agents do not run as root and do not accept untrusted identifiers in command templates.
  • Optional use of automated scanning tools that look for CWE-78 patterns, such as interpolated variables passed to shell-like invocation functions.

Sources

SourceLink
github.comgithub.com/nicolargo/glances/releases/tag/v4.5.5
github.comgithub.com/nicolargo/glances/security/advisories/GHSA-v5r2-qh84-fjx5

Frequently asked

questions

It is indirectly remote: exploitation depends on the ability to create or rename KVM/QEMU VMs. If that capability is exposed via remote APIs, cloud management interfaces, or orchestration systems, an attacker may exploit the issue without shell access to the host.

The attacker needs any access path that lets them influence VM domain names recognized by virsh, such as virtualization management permissions, automation scripts, or compromised orchestration accounts. Direct login to the hypervisor is not strictly required if VM creation or renaming can be done remotely.

The safest pattern is to stop interpreting special characters in user-controlled strings by using argument-based process execution APIs instead of shell-like command builders, and strictly validating or escaping all identifiers before they reach command execution routines.

Design monitoring plugins so that they never treat identifiers or configuration values as part of a command line, enforce a clear trust boundary for all external data, adopt centralized input validation utilities, and include security-focused code review and automated checks for command construction patterns.

Find out what's already
exploitable in your codebase.