
SSH 서비스를 스캔하여 인증 우회, 타이밍 누출, 취약한 키, 세션 후 노출을 탐지하는 연구 도구로, JSON 출력과 분석 기능을 제공합니다.
SSHamble은 SSH 구현체를 위한 연구 도구로, 다음을 포함합니다:
이 프로젝트는 진행 중인 작업이며 빠르게 변경될 가능성이 있습니다.
research[α𝓽]runZero.com을 통해 저희 팀에 연락하실 수 있습니다.
바이너리는 릴리스 페이지에서 이용할 수 있습니다.
(참고: MacOS에서는 sudo xattr -rd com.apple.quarantine ./sshamble을 사용하여 이 바이너리에 대해 Gatekeeper를 비활성화해야 할 가능성이 높습니다. 이는 자산 소유자의 보안 정책을 위반하라는 권유가 아닙니다.)
소스에서 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 서버를 대상으로 실행됩니다. 하나의 연결에서 반드시 거부되어야 하는 256바이트 무작위 제어 비밀번호를 전송한 다음, 257바이트, 필요하면 1024바이트 무작위 비밀번호를 전송하며, 더 긴 비밀번호가 수락될 때만 취약점을 보고합니다. PAM이 비활성화된 상태에서 musl libc로 빌드된 OpenSSH sshd는 shadow 필드가 *인 계정(!로 잠긴 계정과는 다름)에 대해 257~1024바이트의 모든 비밀번호를 수락합니다. 자세한 내용은 sshhole.com을 참조하세요. 영향을 받는 서버에서는 각 연결의 첫 번째 시도가 항상 실패하므로, 캐시된 세션 자격 증명이 비밀번호를 한 번 다시 전송합니다.
로컬 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를 참조하세요.