Junglewise Threat Intelligence

CVE-2026-68518: Glances command injection via cross-field shell-operator reconstruction

CVE-2026-68518 · Severity: high · CVSS 7.8 · Published 2026-08-17

Executive brief

Glances is a system monitoring tool that executes administrator-configured shell commands when monitoring thresholds are crossed. The tool processes dynamic data like process names and container names supplied by unprivileged users. An attacker can craft malicious process or container names that, when combined with adjacent template variables in an unescaped Mustache template, reconstruct forbidden shell operators (like `&&`) across variable boundaries, leading to arbitrary command execution with the privileges of the Glances process (often root).

Technical details

The vulnerability is a command injection flaw in the `_sanitize_mustache_dict()` function in `glances/actions.py`. The function strips multi-character shell operators (`&&`, `|`, `>>`, `>`) from individual template values before Mustache rendering. However, it does not remove single `&`, `|`, or `>` characters. When two adjacent unescaped Mustache variables (e.g., `{{{name}}}{{{cmdline}}}`) are rendered, attacker-controlled values can be positioned to reconstruct operators across variable boundaries: a trailing `&` from the first variable plus a leading `&` from the second variable reconstitute a literal `&&` in the final command string. The `secure_popen()` function then interprets this reconstructed operator and executes the injected command via `subprocess.Popen(shell=False)`. The attack requires a local unprivileged user to control two adjacent stat fields (e.g., process/container name and command line) and an administrator to have configured an action template with adjacent unescaped variables. A patched version (4.5.6) is available.

Affected products

  • nicolargo Glances <= 4.5.5

Timeline

  • 2026-08-17: disclosed
  • 2026-08-01: patched: Version 4.5.6 patches the vulnerability

References

Related threats