Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This updates the existing
tools/payloads/ysoserial/dot_net.rb
tool to add options for encoding the resulting payload as a viewstate. There are currently three viewstate related options, of which only--viewstate-validation-key
is required. The other options have reasonable defaults. To keep this code DRY, much of it was moved out of the mixin and into a Rex library that the CLI tool can access. Unit tests were added for this code.There only appears to be a small handful of modules using the ViewState mixin. The easiest way I found to test it was to use the
exploit/windows/http/plesk_mylittleadmin_viewstate
module and invoke the method using Pry and the module's own default values.By comparing the MD5 hash before and after the changes, and seeing that they are the same, we can determine that the functionality was maintained after the code was refactored into the Rex library.
Testing
plesk_mylittleadmin_viewstate
module and take note of the MD5 hash using the Pry command from abovetools/payloads/ysoserial/dot_net.rb
options to encode viewstatesDemo
Closes #18894