ysoserial.net
- Capabilities
- Initial accessDefense evasion
- Platforms
- Windows
ysoserial.net is an open-source .NET deserialization payload generator used for security testing and abused in intrusions against vulnerable applications. It aggregates known gadget chains that cause code execution when malicious serialized objects are processed by unsafe deserialization routines. It is an exploitation utility rather than a standalone malware family.
Its View State plugin supports constructing malicious ASP.NET ViewState payloads. When attackers possess an application's validation key and any required decryption material, they can generate authenticated payloads that pass integrity checks and execute within the application. Gadget chains can support loading .NET assemblies into memory, while ActivitySurrogateDisableTypeCheck payloads disable runtime restrictions affecting the ActivitySurrogateSelector gadget.
Observed abuse includes ViewState exploitation against Windows IIS and Microsoft Exchange environments. Obstinate Mogwai used ysoserial.net-style gadget payloads during an intrusion against a Russian telecommunications organization. Shedding Zmiy incorporated its XamlAssemblyLoadFromFile gadget into a customized loading chain used by BADSTATE. Command execution, file operations, tunneling, and data theft in these intrusions are functions of the resulting payloads and frameworks, not inherent capabilities of the generator.
Associated vulnerabilities
1 CVE Mallory has correlated with this family across public research and vendor advisories. Each card links to the full Mallory page for that vulnerability.
Associated threat actors
3 distinct threat actors Mallory has associated with this family across public reporting. Open in Mallory to see the full evidence chain and overlapping campaigns.
The structure of the observed VIEWSTATE payloads indicated that the attackers generated them using ysoserial.net.
The structure of the observed VIEWSTATE payloads indicated that the attackers generated them using ysoserial.net.
«...Shedding Zmiy используют самописный гаджет, который распаковывает и вызывает гаджет XamlAssemblyLoadFromFile из набора ysoserial.»
Techniques & procedures
22 distinct techniques documented for this family, organized by ATT&CK tactic.
Resource Development
1 technique
Resource Development
The content repeatedly states that threat actors 'obtained,' 'acquired,' or 'used' publicly available, open-source, legitimate, or modified tools such as Mimikatz, Cobalt Strike, PsExec, Empire, Impacket, and many others.
Initial Access
2 techniques
Initial Access
Obstinate Mogwai эксплуатирует уязвимости десериализации VIEWSTATE для повторного возвращения.
It is also possible to send the __VIEWSTATE parameter in the URL via a GET request. The only limiting factor is the URL length that limits the type of gadgets that can be used here.
Execution
6 techniques
Execution
So we generated a payload with ysoserial.net ... -c "whoami > C:\x.txt".
ysoserial.exe -g ObjectDataProvider -f Json.Net -c "powershell -enc ..." ... PowerShell with -EncodedCommand, -enc, -ec, bypass, or unrestricted.
The provided ysoserial payload executes `cmd /c nslookup yuwewp90p365hx64wh7rumz8kzqxem.burpcollaborator.net`.
Instead of calling Process.Start() now we move on eval JScript. With JScript, we can do many things with scripting instead of spawning cmd.exe / powershell.exe.
ysoserial .net TypeConfuseDelegate gadget fires → Process.Start("cmd /c ...") ← LocalSystem identity
With TypeConfusedDelegate we can invoke the method arbitrarily ... How about XamlReader.Parse() ? XamlReader.Parse is a public/static also, so we can easily call it with TypeConfusedDelegate
Persistence
1 technique
Persistence
2: Creating a virtual file (ghost file) by abusing the Virtual Path Provider in .NET... This solution has minimal complexity for the tester as a web shell can be directly embedded within the initial exploit code.
Privilege Escalation
1 technique
Privilege Escalation
A low-privileged local attacker can send YSoSerial.NET-generated BinaryFormatter payloads to the localhost-bound endpoint to achieve code execution as NT AUTHORITY\SYSTEM.
Stealth
5 techniques
Stealth
# TTP # T1211 — Exploitation for Defense Evasion (Defense Evasion)
TypeConfuseDelegate depends on System.Configuration.Install.dll / System.Management.dll ... all available on the target.
As the targeted box might not send any requests externally, automated scanners should use a payload that causes a short delay on the server-side. This can be achieved by executing the following ASP.NET code as an example to create a 10-second delay: System.Threading.Thread.Sleep(10000);
With TypeConfusedDelegate we can invoke the method arbitrarily ... How about XamlReader.Parse() ? XamlReader.Parse is a public/static also, so we can easily call it with TypeConfusedDelegate
gadget ActivitySurrogateSelector can use to load a DLL via Assembly.Load() function. | The patch almost patching for Deserialization Sink inside Exchange, so we can be sure that this time it’s a deserialization vulnerability.
Defense Impairment
1 technique
Defense Impairment
This blog post attempts to give insights into its features, security measures, and especially its weaknesses/vulnerabilities that often result in remote code execution.
Credential Access
2 techniques
Credential Access
"deserialization vulnerabilities can affect a wide variety of languages and libraries..."; "we will limit our scope to attacks that occur over HTTP."; "common languages/object types exploited... serialized Java objects, .NET ViewStates, pickled Python objects, and serialized PHP objects."
Abuse of Deserialization for RCE: With the sysadmin API token, the attacker interacts with application API endpoints, targeting a deserialization function. By injecting a malicious payload into this process, arbitrary code execution is achieved on the server.
Discovery
2 techniques
Discovery
The executed command was "whoami," and the resulting file showed "iis apppool\sitecoresc.dev.local."
As the targeted box might not send any requests externally, automated scanners should use a payload that causes a short delay on the server-side. This can be achieved by executing the following ASP.NET code as an example to create a 10-second delay: System.Threading.Thread.Sleep(10000);
Lateral Movement
1 technique
Lateral Movement
This repository contains a vulnerable C# application (client/server) that uses .NET Remoting over HTTP... It also includes a copy of ysoserial.net... changed to work with .NET Framework 2.0... this project can be used to exploit applications that use .NET Framework v2.0
Impact
2 techniques
Impact
Tại đây, method này gọi tới EntitySerializer.Deserialize(), EntitySerializer.Deserialize() gọi tiếp tới DataContractSerializer.ReadObject() ... hoàn toàn có thể RCE với DataContractSerializer ... kiểu dữ liệu được deserialize quá lỏng lẻo
Sign ysoserial.net payload with an HMAC using RCEvil.NET: RCEvil.NET.exe -u /Default.aspx -v 000102030405060708090a0b0c0d0e0f10111213 -m SHA1 -p /wEyxBEAAQAAAP////8...
Recent activity
9 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.