
SSHサービスをスキャンして認証バイパス、タイミングリーク、弱い鍵、セッション後の露出を調査するリサーチツール。JSON出力と分析機能を備える。
SSHambleは、SSH実装向けのリサーチツールであり、以下を含みます:
このプロジェクトは開発中のため、頻繁に変更される可能性があります。
私たちのチームには research[α𝓽]runZero.com で連絡できます。
バイナリはリリースページから入手できます。
(注:MacOSでは、このバイナリに対してGatekeeperを無効化する必要がある場合があります。sudo xattr -rd com.apple.quarantine ./sshamble を実行してください。これは、資産所有者のセキュリティポリシーに違反することを勧めるものではありません。)
SSHambleをソースからビルドするには、最近のバージョンのGo(1.27.1以上)がインストールされていることを確認してください。
Goを使用して、GOPATH内のbinディレクトリにバイナリをインストールできます。
macOSを使用している場合、ビルド前にCGOを無効化しない限り、実行時にエラーが発生する可能性があります:
$ export CGO_ENABLED=0
$ go install github.com/runZeroInc/sshamble@latest
ローカルでソースからビルドするには:
$ git clone https://github.com/runZeroInc/sshamble
$ cd sshamble
$ go build -o sshamble
$ ./sshamble -h
badkeys サポートを有効にするには、まず sshamble badkeys-update を実行してからスキャンしてください。
$ git clone https://github.com/runZeroInc/sshamble
$ cd sshamble
$ go generate ./...
$ go build -o sshamble
$ ./sshamble badkeys-update
$ ./sshamble -h
▀██▄ ▀███████████████████████████████████████████████████████████████████████████████████████████
▀██▄
▀██▄ ▄████████ ▄████████ ██ ██ ▄███████▄ ▄████████▄ ████████▄ ██ ▄███████
▀██▄ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███ ▀███████▄ ▀███████▄ █████████ █████████ ██ ██ ██ █████████ ██ ████████
▄██▀ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
▄██▀ ████████▀ ████████▀ ██ ██ ██ ██ ██ ██ ██ ████████▀ ▀██████ ▀███████
▄██▀
▄██▀ ▄███████████████████████████████████████████████████████████████████████████████████████████
An exploration tool for (in)secure shell services.
Start a network scan using:
$ ./sshamble scan -o results.jsonl 192.168.0.0/24
Analyze the results using:
$ ./sshamble analyze -o results-directory results.jsonl
Usage:
sshamble [command]
Available Commands:
analyze Analyzes a scan JSON output file and buckets results
badkeys-update Updates the badkeys.info blocklist cache.
help Help about any command
scan Enumerates a set of targets for SSH capabilities and exposures
Flags:
-h, --help help for sshamble
Use "sshamble [command] --help" for more information about a command.
$ ./sshamble scan -h
Enumerates a set of targets for SSH capabilities and exposures
Usage:
sshamble scan [-p 22] [-u root,admin] [-o scan.jsonl] [-l scan.log] [--log-level trace] 192.168.0.0/24 ... [flags]
Flags:
--categories string The list of categories to include. (default "bypass,gssapi,hostkey,keyboard,password,pubkey,userenum,vuln")
--checks string The list of checks to run. Non-default ("userenum-none-timing,userenum-password-timing,userenum-pubkey-timing,vuln-exec-skip-auth,vuln-exec-skip-userauth") (default "badkeys-blocklist,gssapi-any,keyboard-any,keyboard-empty,keyboard-null,keyboard-user,password-any,password-change-empty,password-change-null,password-empty,password-null,password-user,pubkey-any,pubkey-bulkhalf,pubkey-hunt,pubkey-user,skip-auth,skip-auth-method-empty,skip-auth-method-null,skip-auth-none,skip-auth-pubkeyany,skip-auth-success,skip-ssh-userauth,vuln-coreos-pam-permit,vuln-generic-env,vuln-gogs-env,vuln-mikrotik-fd2-inject,vuln-mikrotik-preauth-rekey,vuln-mikrotik-pubkey-bypass,vuln-ruckus-password-escape,vuln-softserve-env,vuln-sshhole,vuln-tcp-forward")
--client-version string The client version string to send (default "OpenSSH_9.8p1")
--config string config file (default is $HOME/.sshamble.json)
-h, --help help for scan
-i, --input-targets string The optional file to read targets from
-I, --interact string Open an interactive shell for the 'first', 'all', or 'none' sessions (default "none")
--interact-auto string A comma-separated set of commands to run in the interactive session (default "pty,shell")
-l, --log string The file to write logs to (default is stderr) (default "-")
-L, --log-level string The log level to write (trace,debug,info,warn,error) (default "info")
-m, --max-connections uint The maximum number of concurrent connections (default 5000)
--one-session-only Only open one session per target
-o, --output string The destination file for JSON output (default "stdout")
--password string An optional password to try for authentication
--password-file string An optional file with clear-text passwords to try for authentication
-p, --ports string The list of ports to check when not specified with the target (comma-separated) (default "22")
--pprof string Start a Go pprof debug listener on the provided port
--private-key string The optional file containing a private key for authentication
--private-key-passphrase string The optional passphrase for a private key file
--pubkey-bulk-limit uint The number of pubkey half-auths to test for max attempts (default 10)
--pubkey-hunt-conn-limit uint The number of public keys to test in each connection (default 250000)
--pubkey-hunt-file string The optional file containing public keys to hunt
--retries uint The retry count for subsequent failed connections after an initial success (default 2)
--session-poke string A byte sequence sent to sessions to elicit further responses (hex or ascii) (default "\\x0a\\x0d\\r\\n")
--skip-versions string A regular expression of SSH versions to skip (ex: '(?i)openssh|dropbear)'
--timeout uint The number of seconds to wait for a target to respond (default 5)
--userenum-max-per-session-count uint The maximum number of authentication atempts per session (default 1023)
--userenum-test-count uint The number of tests to apply during username enumeration (default 2500)
-u, --users string The list of usernames to test on each target (comma-separated) (default "root")
vuln-sshhole チェックはデフォルトで、パスワード認証を提供する 10.6p2 より古い OpenSSH サーバーに対して実行されます。1 回の接続で、拒否される必要がある 256 バイトのランダムな制御パスワードを送信し、続いて 257 バイト、必要に応じて 1024 バイトのランダムなパスワードを送信し、より長いパスワードが受け入れられた場合にのみ検出結果を報告します。PAM を無効にして musl libc に対してビルドされた OpenSSH sshd は、shadow フィールドが * であるアカウント(! でロックされたアカウントとは異なる)に対して、257 から 1024 バイトの任意のパスワードを受け入れます。詳細は sshhole.com を参照してください。影響を受けるサーバーでは、各接続での最初の試行は常に失敗するため、キャッシュされたセッション資格情報がパスワードを 1 回再送信します。
ローカルの Docker フィクスチャに対してテストするには(脆弱なテストターゲットについては docs/targets を参照してください):
$ docs/targets/sshhole/run.sh up
$ ./sshamble scan -u root -p 2201 127.0.0.1
$ docs/targets/sshhole/run.sh down
vuln-coreos-pam-permit チェックは、デフォルトで SSH-2.0-OpenSSH_7.2 を通知するサーバーに対して実行されます。これは CoreOS Linux Alpha 1045.0.0 および 1047.0.0 における OpenSSH 7.2p2 ビルドのバナーです (CVE-2016-4455)。これらのリリースでは PAM 認証スタックが pam_permit で終了していたため、任意のパスワードで任意のアカウントのセッションが開けました。このチェックは、スキャン対象のユーザー、続いて CoreOS の core および operator アカウントに対して、keyboard-interactive 認証および password 認証でランダムなパスワードを試行し、セッションが開いてコマンドが実行された場合にのみ検出結果を報告します。テストターゲットについては docs/targets/coreos-pam-permit を参照してください。