.NET Deserialization
Insecure use of .NET formatters (
BinaryFormatter,LosFormatter,ObjectStateFormatter,NetDataContractSerializer,SoapFormatter) and type-binding JSON/XML serializers (Json.NET withTypeNameHandling,JavaScriptSerializer, FastJSON) on attacker data, where the payload names the type to instantiate and setter/callback logic runs during reconstruction.
How it works
- BinaryFormatter is unsafe by design. Microsoft’s own guidance states it “is insecure and can’t be made secure,” and calling
Deserializeon a payload is “the equivalent of interpreting that payload as a standalone executable.” ASerializationBinderis insufficient. From .NET 9 the in-box implementation throws on use. - Type discriminators are the root cause for JSON/XML. Json.NET with
TypeNameHandlingother thanNone,JavaScriptSerializerwith a type resolver, and similar settings let the payload’s$type/__typefield pick a .NET class to construct; setters and type converters then run. The Black Hat “Friday the 13th JSON Attacks” research generalised this: format (binary/XML/JSON) is irrelevant as long as the library invokes methods on user-named types and a gadget space exists. - Magic bytes.
BinaryFormatter/LosFormatterbase64 commonly beginsAAEAAAD/////; ASP.NET ViewState begins/wE.ysoserial.netand Mandiant’sheyserialare the reference payload/detection tooling.
ASP.NET ViewState
_VIEWSTATE is serialized state round-tripped through a hidden field (serialized by LosFormatter, deserialized by ObjectStateFormatter, which uses BinaryFormatter internally plus type converters). Its integrity rests on the server’s machineKey (validation/decryption keys). Exploitability hinges on key secrecy and MAC configuration:
- A leaked or sample
machineKey(inweb.config, deployment guides, or disk via file-read) turns ViewState into an attacker-signable deserialization sink. - Pre-.NET-4.5,
ViewStateEncryptionMode=Alwaysonly checked for the presence of__VIEWSTATEENCRYPTED; .NET ≥4.5 binds target-framework behaviour. Treat a leakedmachineKeyas equivalent to a deserialization RCE. See Insecure Deserialization.
Notable cases
| CVE / ID | Target | Note |
|---|---|---|
| CVE-2025-53690 | Sitecore | ViewState RCE via a sample machineKey published in 2017 deployment guides; in-the-wild, WEEPSTEEL recon (Mandiant) |
| CVE-2025-53770 “ToolShell” | SharePoint on-prem | Unauth; webshell parsing ViewState payloads; mass-exploited, chained with Ivanti EPMM bugs |
| CVE-2025-59287 | WSUS | Unauth SoapUtilities.DeserializeObject in ReportingEvent.Validate, port 8530/8531; in-the-wild, w3wp.exe→whoami.exe |
| CVE-2026-28326 | SolarWinds ARM | Hardcoded static client-auth secret → .NET deserialization over gRPC on TCP 55555; RCE as SYSTEM |
| CVE-2025-34153 | Hyland OnBase | BinaryFormatter over .NET Timer Service TCP 6031 |
| CVE-2025-5086 | DELMIA Apriso | NetDataContractSerializer in a WCF service; in-the-wild (CISA KEV) |
| CVE-2026-131914 | Idunno.AntiCsrf 0.9.1 (ASP.NET WebForms IHttpModule) | CVSS 9.3. The double-submit anti-CSRF module deserializes the form token with an unkeyed ObjectStateFormatter (no MAC or signature) on every POST to a Page: any non-empty CSRF cookie plus a base64 gadget chain in the form field → RCE in w3wp.exe, no auth or valid token. Exploited in the wild (Mandiant); project dead since 2008, no patch. Replace with System.Web.Helpers.AntiForgery, ViewStateUserKey + MAC’d ViewState, or ASP.NET Core IAntiforgery; hunt AntiCsrfModule in Web.config/bin/, and after compromise rotate <machineKey> and other Web.config secrets (THN) |
| CVE-2025-55182 “React2Shell” | React 19 / Next.js RSC | Unsafe deserialization in the RSC “Flight” protocol; CVSS 10.0, default configs |
Also: Telerik UI for ASP.NET AJAX padding-oracle→deserialization (and Telerik Reporting / UI for WPF), RBH Integra32 and Quest Foglight unauth .NET Remoting, Visual Studio PDB handling (CVE-2026-114151), SharePoint DataSet/DataTable (CVE-2020-1147), and the .NET/C# type-binding JSON cases from Black Hat.
Prevention
- Stop using
BinaryFormatter,LosFormatter,ObjectStateFormatter,NetDataContractSerializer,SoapFormatteron untrusted data; preferXmlSerializer/DataContractSerializer/System.Text.Jsonwith concrete expected types. - Json.NET: keep
TypeNameHandling = None; if type info is required, use a strictSerializationBinderallowlist. - ViewState: keep
machineKeysecret and unique per deployment (never a sample key), enable MAC, and rotate keys after any suspected disclosure. Restrict management ports (gRPC 55555, Timer 6031, Remoting 2001) to their own components.
Related
Sources
- Hackers Exploit Critical ASP.NET Anti-CSRF Library Flaw Allowing Unauthenticated RCE · original
- .NET Deserialization Cheat Sheet · original
- BinaryFormatter Deserialization Security Guide for .NET · original
- PayloadsAllTheThings: Insecure Deserialization DotNET · original
- ysoserial.net: Deserialization Payload Generator for .NET · original
- .NET JSON.NET Deserialization RCE · original
- Deep Dive into .NET ViewState Deserialization · original
- ViewState Deserialization Zero-Day in Sitecore (CVE-2025-53690) · original
- SharePoint Zero-Day CVE-2025-53770 Actively Exploited · original
- WSUS Deserialization Exploit in the Wild (CVE-2025-59287) · original
- Master Key Included: SolarWinds ARM CVE-2026-28326 · original
- CVE-2025-34153: Hyland OnBase RCE via Deserialization · original
- From Padding Oracle to Shell: Telerik UI for ASP.NET AJAX · original