Skip to content
RCE Write-up Advanced

A Hidden Form Field That Deserialized the Entire Server: ASP.NET

The ASP.NET Web Forms application left ViewState unencrypted and signed it with a publicly known default machine key. An attacker could therefore craft and sign a malicious serialized object graph, which the server would deserialize and execute, achieving remote code execution without authentication.

T4nv1 Follow

Published on medium.com

ASP.NET’s ViewState mechanism is one of those pieces of framework machinery most developers interact with constantly without ever really understanding what it’s doing underneath. It exists to preserve a web form’s state across postbacks, packed into a hidden field and sent back and forth with every request.

T4nv1, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The application had ViewState encryption disabled and signed ViewState payloads with a publicly known default machine key instead of a unique, properly generated secret.

Impact

Full remote code execution on the application server, achievable by any party able to submit a postback request, requiring no authentication and no prior access.

What the attacker needed

Ability to submit a postback request; no authentication required

The fix

The platform rotated to a unique, properly generated machine key and enabled full ViewState encryption and validation as an emergency fix.

How it was found

  1. Decode a ViewState value from an ordinary page load and observe readable .NET type names, indicating encryption is off.
  2. Modify a string field in the decoded ViewState, re-encode it, and submit it as a postback to test whether signature validation is enforced.
  3. Generate correctly signed ViewState payloads offline using candidate default machine keys and test which one the server accepts.
  4. Construct a malicious serialized .NET object graph using a known gadget chain, sign it with the recovered key, and submit it as the ViewState value.
  5. Confirm command execution via an out-of-band network callback triggered during deserialization.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

ASP.NET Web Forms pages store form state in a hidden field called ViewState, which is a serialized .NET object. If the server uses a default, publicly known key to sign that data, an attacker can replace it with a malicious object that runs code when the server reads it back. This is called insecure deserialization and can lead to full server takeover.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by T4nv1

View all

113 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.