xaitax / CVE-2024-6387_Check

CVE-2024-6387_Check is a lightweight, efficient tool designed to identify servers running vulnerable versions of OpenSSH
GNU General Public License v3.0
460 stars 88 forks source link
cve-2024-6387 exploit pentesting python3 redteam

CVE-2024-6387_Check

image

📜 Description

CVE-2024-6387_Check is a lightweight, efficient tool designed to identify servers running vulnerable versions of OpenSSH, specifically targeting the recently discovered regreSSHion vulnerability (CVE-2024-6387). This script facilitates rapid scanning of multiple IP addresses, domain names, and CIDR network ranges to detect potential vulnerabilities and ensure your infrastructure is secure.

🌟 Features

🚀 Usage

python CVE-2024-6387_Check.py <targets> [--ports PORTS] [--timeout TIMEOUT] [--list FILE] [--grace-time-check [SECONDS]] [--dns-resolve] [--use-help-request]

Command Line Arguments

Examples

Single IP

python CVE-2024-6387_Check.py 192.168.1.1

IPs from a file

python CVE-2024-6387_Check.py -l ip_list.txt

Multiple IPs and Domains

python CVE-2024-6387_Check.py 192.168.1.1 example.com 192.168.1.2

CIDR Range

python CVE-2024-6387_Check.py 192.168.1.0/24

With Multiple Ports

python CVE-2024-6387_Check.py 192.168.1.1 example.com --ports 22,2222

Checking LoginGraceTime Mitigation

python CVE-2024-6387_Check.py 192.168.1.1 --grace-time-check

Checking LoginGraceTime Mitigation with Custom Time

python CVE-2024-6387_Check.py 192.168.1.1 --grace-time-check 150

Enabling HELP request

python CVE-2024-6387_Check.py 192.168.1.1 --use-help-request

Enabling DNS/Hostname Resolution

python CVE-2024-6387_Check.py 192.168.1.1 --dns-resolve

✨ Features Explained

Grace Time Detection

The tool supports checking for LoginGraceTime mitigation. When the --grace-time-check option is used, the script will wait for the specified duration after retrieving the SSH banner to see if the connection remains open, which indicates that the LoginGraceTime setting might be set to 0 as a mitigation measure.

IPv6 Support

The tool fully supports IPv6 addresses. You can scan both IPv4 and IPv6 addresses directly or through hostname resolution.

Patched Versions Detection

The tool recognizes certain patched versions of OpenSSH and excludes them from the vulnerability report, ensuring more accurate results.

DNS/Hostname Resolution

When the --dns-resolve option is used, the script resolves and displays hostnames for IP addresses in the output. This feature helps identify the scanned hosts more clearly.

HELP Request Handling

The tool includes an option to handle restrictive SSH services that do not immediately return a banner. When the --use-help-request option is used, the script will send a "HELP" request if the initial SSH banner retrieval fails, increasing "mitigation" detections.

Output

The script will provide a summary of the scanned targets:

🛡️ Servers not vulnerable: 2

   [+] Server at somedomain.cloudapp.azure.com (running SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.11)
   [+] Server at regresshion_test.cc (running SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.3)

🚨 Servers likely vulnerable: 1

   [+] Server at 4.231.170.122 (abc.com) (running SSH-2.0-OpenSSH_9.2p1 Debian-2+deb12u2)
   [+] Server at 4.231.170.121 (running SSH-2.0-OpenSSH_9.2p1 Debian-2+deb12u2) vulnerable and LoginGraceTime remediation not done (Session was closed by server at 120.1 seconds)

⚠️ Servers with unknown SSH version: 1

   [+] Server at 103.97.85.85 (xxx.com) (banner: SSH-2.0-ROSSSH)

🔒 Servers with port 22 closed: 254

📊 Total scanned targets: 257

📆 Changelog

[08. July 2024] - Version 0.8

[06. July 2024] - Version 0.7

[05. July 2024] - Version 0.6

📚 References

Qualys Blog on regreSSHion Vulnerability