Objective: Attacker's Goal: RCE or Data Exfiltration via jackson-databind
[Attacker's Goal: RCE or Data Exfiltration via jackson-databind] | ------------------------------------------------- | [Exploit Deserialization Vulnerabilities] |
| | [Untrusted Data Input] [Polymorphic Type Handling (PTH) Abuse] | ---> |
| | | | | [Network Input] [File Upload] [JNDI] [Other] [Enable Default Typing] | ---> | | ---> | | ---> [HTTP Request] [Message Queue] [CVE-XXX] ... [No Type Validation] ... [System.exec]
Attack Tree Path: High-Risk Path 1
Untrusted Data Input: The attack begins with the attacker providing malicious input to the application.
Network Input (HTTP Request): The most common method; the attacker sends a crafted HTTP request (e.g., a POST request with a malicious JSON payload) to the application.
Polymorphic Type Handling (PTH) Abuse: The core vulnerability. The application uses jackson-databind
to deserialize the JSON payload. Because PTH is enabled (either explicitly or due to a lack of proper configuration), Jackson is tricked into instantiating classes specified by the attacker.
JNDI: The attacker leverages a JNDI (Java Naming and Directory Interface) gadget chain. This typically involves using a class like com.sun.rowset.JdbcRowSetImpl
to connect to a malicious JNDI server controlled by the attacker.
CVE-XXX: The attacker exploits a known vulnerability (identified by a CVE number) in jackson-databind
or a related library. This CVE often provides a specific gadget chain or bypasses existing mitigations.
No Type Validation: The application lacks proper type validation, allowing the attacker to instantiate arbitrary classes. This is a critical failure in security.
System.exec: The ultimate goal. The attacker crafts the gadget chain to eventually execute System.exec
(or a similar method like ProcessBuilder
), allowing them to run arbitrary commands on the server. This achieves Remote Code Execution (RCE).
Attack Tree Path: High-Risk Path 2
Untrusted Data Input: The attack starts with the attacker providing malicious input.
File Upload: The attacker uploads a file containing a malicious JSON payload to the application. This assumes the application has a file upload feature and processes the uploaded file's content.
Polymorphic Type Handling (PTH) Abuse: Similar to Path 1, the application deserializes the content of the uploaded file using jackson-databind
with PTH enabled or insufficiently restricted.
... (Gadget Chain): The attacker uses a suitable gadget chain (which could be JNDI-based, Spring-based, or another type) to achieve their objective. The specific gadget chain might differ from Path 1, but the principle is the same.
System.exec: The final step is to execute System.exec
(or similar) to gain RCE.
Attack Tree Path: High-Risk Path 3
Untrusted Data Input: The attack begins with malicious input.
Network Input: The attacker sends the malicious data via a network request (e.g., HTTP).
Misconfigured ObjectMapper: The ObjectMapper
in jackson-databind
is configured insecurely.
Enable Default Typing: The most dangerous misconfiguration. The application uses the deprecated enableDefaultTyping()
method (or equivalent). This effectively disables most security checks related to type handling.
... (Gadget Chain): Because enableDefaultTyping()
is used, the attacker has a much easier time finding and exploiting a gadget chain. They might not even need a complex or specific gadget.
System.exec: The attacker achieves RCE by executing System.exec
.
Attack Tree Path: Critical Nodes (Detailed Explanation)
Attacker's Goal: RCE or Data Exfiltration via jackson-databind: The attacker's ultimate objective is to either execute arbitrary code on the server (RCE) or steal sensitive data. RCE is generally the more impactful and common goal.
Exploit Deserialization Vulnerabilities: This is the overarching attack vector. jackson-databind
's core functionality of deserializing data is inherently risky if not handled securely.
Polymorphic Type Handling (PTH) Abuse: This is the most critical vulnerability within jackson-databind
. PTH allows Jackson to deserialize data into objects of different types based on type information in the data. Attackers can manipulate this to instantiate arbitrary classes, leading to gadget chains.
JNDI: Java Naming and Directory Interface. A very common and dangerous component of many gadget chains. Attackers often use JNDI to load and execute remote code.
CVE-XXX (and other CVEs): Specific, known vulnerabilities in jackson-databind
or related libraries. These CVEs often provide readily available exploit paths and are a high priority for attackers.
Enable Default Typing: An extremely dangerous configuration option that should never be used with untrusted data. It essentially disables most of Jackson's built-in security checks.
No Type Validation: The absence of any type validation or whitelisting makes exploitation significantly easier. The attacker has much greater freedom in choosing which classes to instantiate.
System.exec (and ProcessBuilder): Common methods used to execute arbitrary commands on the server, representing the final step in achieving RCE.
HTTP Request: The most common method for an attacker to deliver malicious input to a web application.