explaingit

frohoff/ysoserial

8,887JavaAudience · developerComplexity · 3/5Setup · moderate

TLDR

A Java security research tool that generates crafted payloads to test whether a Java application is vulnerable to remote code execution through unsafe deserialization of untrusted data.

Mindmap

mindmap
  root((ysoserial))
    What it does
      Generate Java payloads
      Test deserialization flaws
    How it works
      Gadget chain assembly
      Library code reuse
    Target Libraries
      Commons Collections
      Spring Framework
      Groovy
    Audience
      Security researchers
      Pen testers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Test during an authorized security assessment whether a Java application processes unsafe serialized data from untrusted sources.

USE CASE 2

Generate a deserialization payload targeting a specific library gadget chain to verify a patch blocks the vulnerability.

USE CASE 3

Demonstrate Java deserialization risks in a training lab to help developers understand and prevent this attack class.

Tech stack

Java

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Java 1.7 or newer and knowledge of which Java libraries the target application uses in order to select the correct gadget chain.

In plain English

ysoserial is a security research tool for Java that demonstrates a class of vulnerability called unsafe deserialization. To understand what that means: Java programs can convert in-memory data structures into a stream of bytes (serialization) so they can be sent across a network or saved to disk. Reading those bytes back into objects is deserialization. If an application accepts serialized data from untrusted sources and deserializes it without proper checks, an attacker can send a crafted payload that, when processed, causes the application to run arbitrary commands on the server. ysoserial generates these crafted payloads. It works by finding what the README calls "gadget chains": sequences of existing code in widely used Java libraries that can be composed in a specific way so that the deserialization process itself triggers a command the attacker specifies. The tool ships with dozens of pre-built chains targeting different sets of popular Java libraries, including Apache Commons Collections, Spring, Groovy, and others. A user picks a chain that matches the libraries present in the target application, specifies a command to run, and the tool produces the payload. The README states clearly that ysoserial was created for academic research and for helping developers build better defenses. It is not intended for unauthorized use. The project originated from a 2015 security conference talk about the risks of deserializing Java objects from untrusted data. In practice, security testers use it during authorized assessments to check whether a Java application is vulnerable to this type of attack. Running it requires Java 1.7 or newer, and the tool is distributed as a single downloadable JAR file.

Copy-paste prompts

Prompt 1
I'm doing an authorized pentest of a Java app. Show me how to use ysoserial to generate a CommonsCollections payload and test if the endpoint processes it unsafely.
Prompt 2
Using ysoserial, how do I list the available gadget chains and pick the right one for a target application that uses Apache Commons Collections?
Prompt 3
I want to defend against Java deserialization attacks. Help me set up a local lab using ysoserial to generate test payloads and verify my input validation blocks them before they reach the deserializer.
Prompt 4
Show me the ysoserial command syntax to produce a Spring-based gadget chain payload that triggers a specific shell command on the target system.
Open on GitHub → Explain another repo

← frohoff on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.