feat: added support for dotnet deserialization gadget generation #282
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.
Deserialization Gadget Generators
This PR provides unified functions for generating Java and .NET deserialization exploit payloads.
Uses: https://www.vulncheck.com/blog/making-dotnet-gadgets
Based on code in https://github.com/vulncheck-oss/go-exploit/tree/main/dotnet
.NET Deserialization
Function Signature
Parameters
Supported Gadgets
Command-Based Gadgets
These gadgets execute system commands:
windows-identity- WindowsIdentity gadgetclaims-principal- ClaimsPrincipal gadgetdataset- DataSet gadgetdataset-type-spoof- DataSet with type spoofingobject-data-provider- ObjectDataProvider gadgettext-formatting-runproperties- TextFormattingRunProperties gadgettype-confuse-delegate- TypeConfuseDelegate gadgetcmd format: Command to execute (e.g.,
"calc","whoami","cmd /c dir")URL-Based Gadgets
These gadgets make HTTP requests to fetch remote payloads:
object-ref- Remote object referenceveeam-crypto-keyinfo- Veeam CryptoKeyInfo gadgetcmd format: URL (e.g.,
"http://attacker.com/payload")XML-Based Gadgets
dataset-xmldiffgram- DataSet XML DiffGramcmd format: XML payload data
DLL-Based Gadgets
axhost-state-dll- AxHostState DLL loadingdll-reflection- DLL reflection loadingcmd format: Raw DLL bytes or base64-encoded DLL
ViewState Gadget
viewstate- ASP.NET ViewStatecmd format:
"payloadData:machineKey:generator"(colon-separated)Prebuilt Gadgets
Any other gadget name will attempt to load from the dotnet package's embedded gadgets using
ReadGadget.Supported Formatters
binaryorbinaryformatter- BinaryFormatter (default)soaporsoapformatter- SOAPFormattersoapwithexceptionsorsoap-exceptions- SOAPFormatter with exceptionslosorlosformatter- LOSFormatterSupported Encodings
raw- Raw binary stringhex- Hexadecimal encodinggzip- Gzip compressedgzip-base64- Gzip + URL-safe base64base64-raw- Standard base64+with%2B)Examples