TL;DR
This paper introduces GCMiner, a novel approach to automatically discover Java deserialization vulnerabilities. By analyzing dynamic program features like method overriding and employing an "overriding-guided" object generation strategy, GCMiner significantly outperforms existing tools, finding 56 previously undiscovered gadget chains.
What Problem Does This Paper Address?
Java's deserialization mechanism, while convenient for data transmission, is a significant security risk. Attackers can exploit vulnerabilities by chaining together existing code snippets (gadgets) to form a "gadget chain." This chain allows them to inject malicious objects into an application, potentially leading to remote code execution (RCE). Existing tools for finding these gadget chains struggle because they often fail to account for dynamic Java features like runtime polymorphism, leading to missed vulnerabilities (false negatives) or incorrect findings (false positives). Furthermore, generating valid "injection objects" to test these chains is challenging, often causing fuzzing tools to get stuck.
Methods
GCMiner tackles this problem in three main stages:
- Graph Construction: It builds a "Deserialization-Aware Call Graph" (DA-CG). This graph goes beyond standard call graphs by incorporating method overriding relationships, crucial for understanding how Java's dynamic features are exploited. It uses static analysis and Class Hierarchy Analysis (CHA) to capture both explicit and implicit method calls.
- Chain Identification: Using the DA-CG, GCMiner employs graph traversal with custom Cypher queries to identify "suspicious" gadget chains. It uses a curated list of 11 magic methods (entry points) and 25 security-sensitive call sites (sinks) derived from their empirical study.
- Chain Verification: This is where GCMiner introduces its key innovation: an "overriding-guided object generation" approach. Instead of generic fuzzing, it uses the identified overriding relationships to guide the creation of injection objects. This ensures the generated objects are more likely to follow the intended execution path of the gadget chain and reach the security-sensitive sink. The generated objects are then fed into a coverage-guided fuzzer (JQF) for dynamic execution and verification.
Datasets
The authors created a benchmark dataset consisting of 86 publicly known exploitable gadget chains. This benchmark was compiled from the popular ysoserial repository and 18 other Java applications. They specifically selected applications that support deserialization and have reported vulnerabilities, ensuring the chains are relevant and verifiable.
Key Insights and Ideas
- Runtime Polymorphism is Key: The empirical study revealed that a vast majority (87.2%) of Java deserialization gadgets are exploited by abusing runtime polymorphism, specifically by reusing serializable overridden methods. This highlights the inadequacy of static analysis that overlooks these dynamic behaviors.
- Dynamic Binding is Crucial for Construction: Constructing exploitable gadget chains heavily relies on dynamic binding (at least once) to modify injection object properties and trigger overridden methods. This is how attackers guide the malicious data flow.
- Overriding-Guided Generation is Effective: Simply generating injection objects isn't enough; they need to be semantically valid and follow the gadget chain's logic. GCMiner's approach of using overriding relations to guide object generation significantly improves the ability to create valid, sink-reachable injection objects, overcoming limitations of previous fuzzing techniques.
Key Results
GCMiner significantly outperforms existing state-of-the-art tools:
- It identified 61 out of 86 known gadget chains, achieving a recall of 70.9% with no false positives in their evaluation.
- GCMiner discovered 56 unique gadget chains that were missed by baseline approaches like Gadget Inspector and Serhybrid.
- Compared to Gadget Inspector, GCMiner showed a recall of 70.9% versus 5.8%, with a much lower false positive rate.
- Against Serhybrid, GCMiner generated more valid injection objects (10 vs. 2) for a smaller set of known chains, demonstrating better coverage despite Serhybrid's higher precision on a subset.
- Ablation studies confirmed the importance of both including more magic methods/sinks and, crucially, incorporating method overriding information for effective gadget chain mining.
Limitations and Future Work
- External Validity: The authors acknowledge that their findings are specific to Java and may not directly apply to other programming languages. They also note that while their knowledge base of sources and sinks is configurable, the effectiveness relies on having a comprehensive set.
- Internal Validity: They addressed potential biases by manually reproducing vulnerabilities and comparing with Serhybrid under controlled conditions.
- Future Work: The authors plan to extend GCMiner to industrial scenarios for large-scale case studies and investigate automatic exploit generation techniques for vulnerability reproduction and confirmation. They also suggest exploring the applicability to other programming languages.
Summary updated