GHSA-QHJ7-V7H7-Q4C7

Vulnerability from github – Published: 2026-03-30 17:01 – Updated: 2026-04-06 17:18
VLAI?
Summary
Glances Vulnerable to Command Injection via Dynamic Configuration Values
Details

Summary

Glances supports 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.

Details

  1. Glances loads configuration files from user, system, or custom paths during initialization.
  2. When retrieving a configuration value, Config.get_value() scans for substrings enclosed in backticks.

File: glances/config.py

match = self.re_pattern.findall(ret)
for m in match:
    ret = ret.replace(m, system_exec(m[1:-1]))
  1. The extracted string is passed directly to system_exec().

File: glances/globals.py

res = subprocess.run(command.split(' '), stdout=subprocess.PIPE).stdout.decode('utf-8')
  1. The command is executed and its output replaces the original configuration value.

This execution occurs automatically whenever the configuration value is read.

Affected Files

glances/config.py — dynamic configuration parsing

glances/globals.py — command execution helper

Proof of Concept (PoC)

Scenario: Arbitrary command execution via configuration value

Step 1 — Create malicious configuration file

/tmp/glances.conf

add below txt on the file

[outputs]
url_prefix = 'id'

Step 2 — Launch Glances with custom configuration

glances -C /tmp/glances.conf

Step 3 — Observe behavior

When Glances reads the configuration:

  • The command inside backticks is executed
  • Output replaces the configuration value
  • Execution occurs without user interaction

Reproduce using Python code

import subprocess
import re

def system_exec(command):
    return subprocess.run(command.split(' '), stdout=subprocess.PIPE).stdout.decode().strip()

value = "`id`"
pattern = re.compile(r'(`.+?`)')

for m in pattern.findall(value):
    print(system_exec(m[1:-1]))

Output:

uid=1000(user) gid=1000(user) groups=1000(user)

Impact

Arbitrary Command Execution

Any command enclosed in backticks inside a configuration value will execute with the privileges of the Glances process.

Potential Privilege Escalation

If Glances runs as a privileged service (e.g., root), commands execute with those privileges.

Possible scenarios include:

  • Misconfigured file permissions allowing unauthorized config modification
  • Shared systems where configuration directories are writable by multiple users
  • Container environments with mounted configuration volumes
  • Automated configuration management systems that ingest untrusted data
Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "Glances"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "last_affected": "4.5.2"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-33641"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-78"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-03-30T17:01:27Z",
    "nvd_published_at": "2026-04-02T15:16:40Z",
    "severity": "HIGH"
  },
  "details": "## Summary\nGlances supports 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.\n\nIf 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.\n\n## Details\n\n1. Glances loads configuration files from user, system, or custom paths during initialization.\n2. When retrieving a configuration value, Config.get_value() scans for substrings enclosed in backticks.\n\n   **File: glances/config.py**\n  \n```\nmatch = self.re_pattern.findall(ret)\nfor m in match:\n    ret = ret.replace(m, system_exec(m[1:-1]))\n```\n\n\n3. The extracted string is passed directly to system_exec().\n\n   **File: glances/globals.py**\n   \n   \n```sh\nres = subprocess.run(command.split(\u0027 \u0027), stdout=subprocess.PIPE).stdout.decode(\u0027utf-8\u0027)\n```\n\n4. The command is executed and its output replaces the original configuration value.\n\nThis execution occurs automatically whenever the configuration value is read.\n\n### Affected Files\n\n   glances/config.py \u2014 dynamic configuration parsing\n\n   glances/globals.py \u2014 command execution helper\n\n## Proof of Concept (PoC)\n\nScenario: Arbitrary command execution via configuration value\n\n**Step 1 \u2014 Create malicious configuration file**\n\n```sh\n/tmp/glances.conf\n```\n\nadd below txt on the file\n\n```\n[outputs]\nurl_prefix = \u0027id\u0027\n```\n\n**Step 2 \u2014 Launch Glances with custom configuration**\n\n```sh\nglances -C /tmp/glances.conf\n```\n\n**Step 3 \u2014 Observe behavior**\n\nWhen Glances reads the configuration:\n\n  - The command inside backticks is executed\n  - Output replaces the configuration value\n  - Execution occurs without user interaction\n  \n  \n  Reproduce using  Python code\n  \n  \n```\nimport subprocess\nimport re\n\ndef system_exec(command):\n    return subprocess.run(command.split(\u0027 \u0027), stdout=subprocess.PIPE).stdout.decode().strip()\n\nvalue = \"`id`\"\npattern = re.compile(r\u0027(`.+?`)\u0027)\n\nfor m in pattern.findall(value):\n    print(system_exec(m[1:-1]))\n```\n\n**Output:**\n\n\n`uid=1000(user) gid=1000(user) groups=1000(user)`\n\n## Impact\n\n### Arbitrary Command Execution\n\nAny command enclosed in backticks inside a configuration value will execute with the privileges of the Glances process.\n\n### Potential Privilege Escalation\n\nIf Glances runs as a privileged service (e.g., root), commands execute with those privileges.\n\nPossible scenarios include:\n\n-   Misconfigured file permissions allowing unauthorized config modification\n-   Shared systems where configuration directories are writable by multiple users\n-   Container environments with mounted configuration volumes\n-   Automated configuration management systems that ingest untrusted data",
  "id": "GHSA-qhj7-v7h7-q4c7",
  "modified": "2026-04-06T17:18:29Z",
  "published": "2026-03-30T17:01:27Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/nicolargo/glances/security/advisories/GHSA-qhj7-v7h7-q4c7"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-33641"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nicolargo/glances/commit/358d76a225fc21a9f95d2c4d7e46fafe64a644c6"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/nicolargo/glances"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nicolargo/glances/releases/tag/v4.5.3"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Glances Vulnerable to Command Injection via Dynamic Configuration Values"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…