
Scanner para identificação de servidores com softwares SSH possivelmente vulnerável às CVEs CVE-2024-6387 e CVE-2023-48795.
Scanner for identifying servers with SSH software possibly vulnerable to CVEs CVE-2024-6387 and CVE-2023-48795.
| CVE | Name | Condition | Severity |
|---|---|---|---|
| CVE-2024-6387 | regreSSHion | OpenSSH < 9.8p1 | CRITICAL |
| CVE-2023-48795 | Terrapin | OpenSSH < 9.6 | HIGH |
Race condition in the SIGALRM signal handler of the OpenSSH server allows unauthenticated RCE as root on Linux systems with glibc. Affects all OpenSSH versions prior to 9.8p1.
Prefix truncation attack on the SSH handshake (binary protocol) that allows a MITM adversary to remove security extension messages negotiated at the start of the session. Affects OpenSSH < 9.6.
The script directly connects to the SSH port of the targets and reads the identification banner (e.g., SSH-2.0-OpenSSH_9.7), without sending any credentials. With the version in hand, it compares against the fixed versions of each CVE and classifies the host.
Target → TCP connection port 22 → Read SSH banner → Software identification
→ Parse OpenSSH version → Compare with fixed versions → Classification + Log + CSV
The script also identifies the SSH vendor/software from the banner, recognizing:
pip install requests packaging urllib3 dnspython
dnspythonis optional but highly recommended — parallel reverse resolution is significantly faster with it. Withoutdnspython, the script usessocketas a fallback.
# IP individual
python ssh_scanner.py --ip 192.168.1.10
# Faixa CIDR
python ssh_scanner.py --cidr 10.0.0.0/24
# Múltiplos CIDRs
python ssh_scanner.py --cidr 10.0.0.0/24 192.168.1.0/24
# ASN (prefixos resolvidos via RIPE Stat, fallback para bgp.tools)
python ssh_scanner.py --asn AS12345
# Combinação de entradas
python ssh_scanner.py --asn AS12345 --cidr 10.0.0.0/8 --ip 1.2.3.4
# A partir de um arquivo (um IP, CIDR ou ASN por linha)
python ssh_scanner.py --file alvos.txt
# Portas adicionais (além da 22)
python ssh_scanner.py --cidr 10.0.0.0/24 --ports 22 2222 22222
DNS resolution is performed in batch before the SSH scan, with a dedicated thread queue, preventing DNS latency from impacting scan speed.
All results are written to ./logs/:
| File | Content |
|---|
formato_estruturado.csv)Columns present:
Example lines:
IP | PORTA | TIMESTAMP_UTC | DOMINIO | FABRICANTE | SW_NAME | SW_VERSAO | CVEs | BANNER
192.168.1.10 | 22 | 2026-05-20T00:39:33Z | host.exemplo.com | OpenSSH | OpenSSH | 9.7 | cve-2024-6387;cve-2023-48795 | SSH-2.0-OpenSSH_9.7
192.168.1.20 | 22 | 2026-05-20T12:46:03Z | host2.exemplo.com | OpenSSH | OpenSSH | 9.4 | cve-2023-48795;cve-2024-6387 | SSH-2.0-OpenSSH_9.4
192.168.1.30 | 22 | 2026-05-20T12:47:11Z | router.exemplo.com | Mikrotik | ROSSSH | N/D | | SSH-2.0-ROSSSH
At the end of the scan, if there are vulnerable hosts, the script automatically displays a preview of the first 20 lines of the structured CSV in the terminal.
Update OpenSSH to version 9.8p1 or higher (covers both CVEs):
# Ubuntu / Debian — via repositório do sistema
sudo apt update && sudo apt install --only-upgrade openssh-server
ssh -V
# CentOS / RHEL / Rocky
sudo dnf update openssh-server
ssh -V
# Compilação a partir do fonte (versão mais recente)
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.9p1.tar.gz
tar xzf openssh-9.9p1.tar.gz
cd openssh-9.9p1 && ./configure && make && sudo make install
After updating, restart the service:
sudo systemctl restart sshd
This script is intended for use on your own infrastructure or under explicit authorization. Unauthorized scanning may violate various laws, so use with caution.
Any actions and consequences resulting from misuse of this tool are your own responsibility.
If you have suggestions for improvement or find bugs, open an issue or submit a Pull Request. All contributions are welcome! 🚀
| Banner | Identified vendor |
|---|
SSH-2.0-OpenSSH_9.7 | OpenSSH |
SSH-2.0-ROSSSH | Mikrotik |
SSH-2.0-Cisco-1.25 | Cisco |
SSH-2.0-dropbear_2022.83 | Dropbear |
SSH-2.0-libssh-0.9.6 | libssh |
SSH-2.0-AsyncSSH_2.13.2 | AsyncSSH |
SSH-2.0-paramiko_2.9.5 | Paramiko |
SSH-2.0-Bitvise-... | Bitvise |
SSH-2.0-WolfSSH_1.4.14 | wolfSSH |
| Other unmapped | Name extracted from banner |
| Parameter | Default | Description |
|---|
--ports | 22 | SSH port(s) to scan |
--workers | 60 | Concurrent threads for SSH scan |
--timeout | 3.0 | SSH connection timeout in seconds |
--dns-workers | 200 | Concurrent threads for reverse DNS resolution |
--dns-timeout | 1.5 | DNS query timeout in seconds |
--no-confirm | — | Skip confirmation before starting (useful in automation) |
ssh_scan_<timestamp>.log | Full scan log (all discovered SSH hosts) |
ssh_scan_<timestamp>_vulneraveis.txt | Only hosts classified as VULNERÁVEL |
ssh_scan_<timestamp>_resultados.csv | All SSH hosts with full status |
ssh_scan_<timestamp>_formato_estruturado.csv | Structured CSV with IP, port, timestamp, domain, vendor and CVEs |
| Column | Description |
|---|
IP | Host IP address |
PORTA | SSH port where the banner was captured |
TIMESTAMP_UTC | ISO 8601 UTC timestamp of the scan moment |
DOMINIO | Hostname via reverse DNS (PTR) or SEM-PTR |
FABRICANTE | Vendor identified from the banner |
SW_NAME | SSH software name extracted from the banner |
SW_VERSAO | SSH software version |
CVEs | Affected CVEs separated by ; (lowercase) |
BANNER | Full captured SSH banner |
| Status | Meaning |
|---|
VULNERÁVEL | OpenSSH version confirmed below the fixed version |
SEGURO | OpenSSH version confirmed at or above the fixed version |
VERSÃO-OCULTA | SSH detected but version not disclosed — not confirmed safe |
SSH-NÃO-OPENSSH | SSH server found but not OpenSSH (Dropbear, Cisco, etc.) |
NÃO-SSH | Port responded but banner does not match SSH protocol |