JDD: In-depth Mining of Java Deserialization Gadget Chains
Description
This presentation introduces JDD, a research tool designed to discover Java deserialization gadget chains using bottom-up search and dataflow-aided payload construction. The researchers demonstrate how JDD identified 127 zero-day gadget chains and 6 high-impact CVEs across popular Java frameworks like Apache Dubbo and Sofa-RPC.
Mastering the Maze: In-depth Mining of Java Deserialization Gadget Chains with JDD
Introduction
Java deserialization vulnerabilities have long been the 'white whale' of application security. Since the high-profile Log4Shell (CVE-2021-44228) incident, the security community has been hyper-aware of the risks associated with insecure data handling. Yet, despite years of research, Java Object Injection (JOI) remains a top-tier threat, appearing consistently in the OWASP Top 10. The core of the problem lies in 'gadget chains'—sequences of legitimate code fragments that, when executed in a specific order during deserialization, result in Remote Code Execution (RCE).
In this post, we explore a revolutionary approach to finding these chains using JDD, a tool developed by researchers from Fudan University and Johns Hopkins University. JDD utilizes a bottom-up search strategy and dataflow-guided fuzzing to uncover vulnerabilities that traditional static and dynamic analysis tools miss. If you are a security researcher, developer, or pentester working with Java ecosystems, understanding these techniques is vital for securing modern enterprise applications.
Background & Context
Serialization is the process of converting a Java object into a byte stream for storage or transmission, while deserialization is the inverse. Vulnerabilities occur when an application deserializes untrusted data without sufficient validation. An attacker can craft a serialized object that, when processed by a common method like readObject(), triggers unexpected code execution paths.
The main difficulty in defending against JOI is the sheer variety of 'gadgets' available in a typical Java classpath. A gadget is any method already present in the application's libraries that can be reached during deserialization. By chaining these methods together via polymorphism (e.g., overriding equals(), hashCode(), or toString()), an attacker can eventually reach a 'sink'—a dangerous function like Runtime.exec() or Method.invoke().
Technical Deep Dive
The Challenge: Path and State Explosion
Traditional static analysis uses a 'top-down' approach, starting from a deserialization entry point and searching forward for sinks. However, at every polymorphic call, the search space branches. For example, the toString() method in a large application might have thousands of implementations. Checking every possible path leads to 'path explosion,' where the analysis becomes computationally impossible.
Understanding JDD's Bottom-Up Approach
JDD solves this by flipping the script. Instead of starting from the source, it starts from the sinks and works backward.
- Fragment-based Summary: JDD breaks potential gadget chains into smaller 'fragments' bounded by dynamic method calls.
- Bottom-Up Search: It analyzes these fragments to see which ones can reach a sink. Because fragments are often reused across different chains, JDD can cache their results (summaries), reducing search complexity from exponential to polynomial.
- On-Demand State Merging: By working backward, the tool only calculates the necessary conditions (taint requirements and link conditions) required to reach the previous step in the chain.
Step-by-Step Payload Construction with IOCD
Finding a theoretical chain is only half the battle; the researcher must prove it is exploitable by generating a valid payload. Java objects often have complex dependencies—for example, a HashMap might require two keys to have the exact same hash code to trigger an equals() call.
JDD introduces the Injection Object Constraint Diagram (IOCD) to model these requirements:
- Class Nodes: Represent the classes involved in the chain.
- Field Nodes: Store constraints discovered during static analysis (e.g., 'Field A must not be null' or 'Field B must be an instance of Class X').
- Directed Fuzzing: Instead of random mutations, JDD uses the IOCD to guide its fuzzer. It generates a high-quality initial seed based on the structural constraints and then mutates only the fields that affect the attack payload. This ensures that the generated byte stream is a valid, deserializable Java object that satisfies all logical conditions to traverse the gadget chain.
Mitigation & Defense
Defending against deserialization is notoriously difficult because 'gadget' code is often part of legitimate libraries. Simple blacklisting (e.g., blocking AbstractExtractor) is often ineffective because researchers (and attackers) can easily find alternative fragments to achieve the same result.
Best Practices for Defenders:
- Avoid Untrusted Deserialization: Use safer data formats like JSON or Protobuf which do not involve complex object reconstruction logic.
- Look-ahead Deserialization: Use libraries like
SerialKilleror the nativeObjectInputFilter(introduced in newer JDKs) to validate classes before they are instantiated. - Principle of Least Privilege: Run Java applications with minimal permissions to mitigate the impact of a successful RCE.
- Keep Dependencies Updated: Many gadgets are found in older versions of libraries like FastJson, Jackson, or Groovy.
Conclusion & Key Takeaways
The research behind JDD demonstrates that Java deserialization remains a critical attack vector. By leveraging bottom-up search and dataflow-aided payload construction, the researchers were able to discover 127 zero-day vulnerabilities in supposedly 'secure' latest versions of popular frameworks.
Key Takeaways:
- Static analysis must evolve to handle polymorphic path explosion through summarization.
- Automated payload construction is possible when guided by structural constraints (IOCD).
- Signature-based blacklists are a 'cat-and-mouse' game; architectural changes are the only permanent fix.
For those interested in exploring these findings further, the JDD tool is open-source. We encourage all security practitioners to integrate these advanced scanning techniques into their SDLC to identify hidden gadget chains before they are exploited in the wild.
AI Summary
The presentation focuses on the persistent threat of Java Object Injection (JOI) and the difficulties in detecting and exploiting complex deserialization gadget chains. Java serialization is a fundamental mechanism for state exchange, but when untrusted data is deserialized using methods like `readObject()`, attackers can manipulate object types and values to trigger a chain of internal methods (gadgets) that eventually lead to Remote Code Execution (RCE). The presenters highlight that while deserialization vulnerabilities have been known for years (e.g., Log4Shell, OWASP Top 10), they remain difficult to eliminate because they are deeply integrated into enterprise frameworks. The researchers identify two primary technical challenges in finding these vulnerabilities: path explosion in static analysis and the complexity of generating valid exploit payloads. Static tools often struggle with the exponential number of possible execution paths created by polymorphic method calls (like `toString()`, `hashCode()`, or `equals()`). To solve this, the authors introduce JDD, which utilizes a 'fragment-based summary' and a 'bottom-up search' approach. By breaking gadget chains into smaller fragments at dynamic method call boundaries and searching from the 'sink' (the dangerous operation) back to the 'source' (the entry point), JDD reduces search complexity from exponential to polynomial. Furthermore, JDD addresses the 'payload construction' challenge. Generating a serialized object that satisfies all field constraints and dataflow dependencies is nearly impossible with random fuzzing. JDD uses a novel structure called an Injection Object Constraint Diagram (IOCD). This diagram models class hierarchies and field-related constraints (e.g., a field cannot be null, or specific fields must share the same hash value) derived from static analysis. This IOCD then guides a directed fuzzer to mutate only relevant fields, ensuring the resulting payload successfully triggers the intended gadget chain. The effectiveness of JDD was evaluated against six popular Java applications, including Apache Dubbo, Sofa-RPC, and Solon. The tool successfully identified 127 zero-day gadget chains, leading to 6 new CVEs with CVSS scores of 9.8. The presenters also discuss how attackers can bypass existing blacklists by simply swapping out one fragment of a gadget chain for another, proving that traditional signature-based defenses are insufficient. They conclude by announcing that JDD is open-source and encouraging the security community to use it for discovering and patching these critical vulnerabilities.
More from this Playlist




Dismantling the SEOS Protocol
