Glances Command Injection Vulnerability via User-Controlled Mustache Template Variables

Vulnerability

A command injection vulnerability has been identified in Glances, an open-source cross-platform system monitoring tool. This issue arises in the action command templates, which can include Mustache variables populated with real-time data. Prior to version 4.5.2, the 'secure_popen()' function, responsible for executing these commands, improperly handled user-controlled data such as process names and container names. When such data included metacharacters like pipes or redirects, it could be exploited to inject arbitrary commands. This vulnerability affects Glances versions through 4.5.2-dev01.

Impact

Exploitation of this vulnerability allows for arbitrary command execution as the user running the Glances process, which is often root. This could lead to privilege escalation if a low-privileged user manages to inject commands that are executed with elevated rights. Additionally, the vulnerability could be used to write arbitrary data to files, taking advantage of the command injection capabilities.

Reproduction

To reproduce this vulnerability, first configure an action in the Glances 'processlist' or 'containers' section that includes user-controlled Mustache variables. Then, create a process or Docker container with a name that includes injection metacharacters, such as a pipe or double ampersand. When the action is triggered, the injected command will be executed, demonstrating the command injection flaw.

Remediation

Users can upgrade to Glances version 4.5.2, which addresses this vulnerability by sanitizing Mustache-rendered values before they are processed by 'secure_popen()'.

Added: Mar 18, 2026, 7:32 AM
Updated: Mar 18, 2026, 7:32 AM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
10.0
exploitability
4.2
remediation
0.0
relevance
4.1
threat
6.4
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.