Skip to content

Latest commit

 

History

History
149 lines (115 loc) · 14.1 KB

File metadata and controls

149 lines (115 loc) · 14.1 KB

Attack Tree Analysis for fasterxml/jackson-databind

Objective: Compromise Application via Jackson-databind Vulnerabilities

Attack Tree Visualization

Attack Goal: Compromise Application via Jackson-databind Vulnerabilities [HIGH-RISK GOAL] ├── Exploit Deserialization Vulnerabilities [HIGH-RISK PATH] │ ├── Remote Code Execution (RCE) via Deserialization [CRITICAL PATH] [HIGH-RISK PATH] │ │ ├── Craft Malicious JSON Payload [CRITICAL NODE] │ │ │ ├── Polymorphic Deserialization Exploitation [HIGH-RISK PATH] │ │ │ │ ├── Example: Default Typing Enabled (ObjectMapper.enableDefaultTyping()) [CRITICAL NODE] │ │ │ │ ├── Specify Gadget Class │ │ │ │ │ ├── Example: Use known vulnerable classes on classpath (e.g., from libraries like commons-collections, spring-beans, etc.) [CRITICAL NODE] │ │ │ ├── Known CVE Exploitation [HIGH-RISK PATH] │ │ │ │ ├── Utilize Publicly Available Exploit [CRITICAL NODE] │ ├── Denial of Service (DoS) via Deserialization [MEDIUM-HIGH RISK PATH] │ │ ├── Resource Exhaustion [CRITICAL NODE] ├── Exploit Configuration Issues [MEDIUM-HIGH RISK PATH] │ ├── Insecure Default Settings [HIGH-RISK PATH] │ │ ├── Jackson Defaults Enable Vulnerable Features [CRITICAL NODE] │ │ │ ├── Example: Default Typing enabled without careful consideration [CRITICAL NODE]

  • Description: The attacker aims to exploit weaknesses in the jackson-databind library to compromise the application using it. This is a high-risk goal due to the potential for severe impact, including data breaches, system compromise, and service disruption.
  • Description: This is a primary attack vector targeting the core functionality of jackson-databind - deserializing JSON data into Java objects. Deserialization vulnerabilities arise when untrusted data is processed without proper validation, allowing attackers to manipulate the deserialization process for malicious purposes.
  • Impact: Can lead to Remote Code Execution (RCE) or Denial of Service (DoS).
  • Mitigation:
    • Keep jackson-databind updated to the latest version.
    • Carefully manage polymorphic deserialization.
    • Implement input validation and resource limits.
  • Description: The most critical threat. Attackers aim to achieve arbitrary code execution on the server by exploiting deserialization vulnerabilities in jackson-databind.
  • Impact: Full system compromise, data breach, malware installation, complete loss of confidentiality, integrity, and availability.
  • Mitigation:
    • Disable Default Typing: ObjectMapper.disableDefaultTyping() is crucial.
    • Whitelist Allowed Classes for Polymorphism: If polymorphic deserialization is necessary, use @JsonTypeInfo and @JsonSubTypes with a strict whitelist of allowed classes.
    • Regularly Update Jackson-databind: Patch known vulnerabilities promptly.
    • Classpath Awareness: Understand the libraries on your application's classpath and potential gadget chains they might contain.
    • Runtime Application Self-Protection (RASP): Consider RASP solutions for runtime detection and prevention of deserialization attacks.
  • Description: This is a crucial step in exploiting deserialization vulnerabilities. The attacker must craft a JSON payload that, when deserialized by jackson-databind, triggers the vulnerability.
  • Impact: Enables exploitation of deserialization vulnerabilities, leading to RCE or DoS.
  • Mitigation:
    • Input validation, although primarily focused on application logic, can sometimes detect unusual patterns in payloads.
    • Robust logging and monitoring can help identify suspicious payloads being sent to the application.
  • Description: Exploits Jackson's polymorphic type handling features (like @type property). If not properly secured, attackers can inject malicious type identifiers to instantiate arbitrary classes during deserialization.
  • Impact: Remote Code Execution (RCE).
  • Mitigation:
    • Disable Default Typing (ObjectMapper.disableDefaultTyping()): This is the most effective mitigation if polymorphism is not strictly required.
    • Explicit Type Information with Whitelisting: When polymorphism is needed, use @JsonTypeInfo and @JsonSubTypes to explicitly define and whitelist allowed classes. Avoid relying on default typing or insecure custom implementations.
  • Description: Enabling default typing in jackson-databind (ObjectMapper.enableDefaultTyping()) is a common misconfiguration that makes polymorphic deserialization exploitation significantly easier. It allows attackers to specify arbitrary classes for instantiation using the @type property in JSON.
  • Impact: Direct path to Remote Code Execution (RCE).
  • Mitigation:
    • Disable Default Typing: Ensure ObjectMapper.disableDefaultTyping() is used unless there is a very strong and well-understood reason to enable it. If enabled, it must be done with extreme caution and robust whitelisting.

Attack Tree Path: Specify Gadget Class

  • Description: In polymorphic deserialization exploits, the attacker needs to specify a "gadget class" in the malicious JSON payload. Gadget classes are classes present on the application's classpath that can be chained together to achieve code execution when their methods are invoked during deserialization.
  • Impact: Enables Remote Code Execution (RCE).
  • Mitigation:
    • Classpath Minimization: Reduce the number of libraries on the application's classpath to limit potential gadget classes.
    • Security Audits of Dependencies: Analyze application dependencies for known vulnerable gadget classes.
    • Class Blacklisting/Whitelisting (with caution): While less robust than disabling default typing, blacklisting or whitelisting classes can be attempted, but must be done carefully and comprehensively. Whitelisting is generally preferred.
  • Description: Attackers often leverage well-known gadget chains present in common Java libraries like Apache Commons Collections, Spring Beans, etc., to achieve RCE. These libraries contain classes with methods that can be chained together to execute arbitrary code when deserialized.
  • Impact: Direct path to Remote Code Execution (RCE).
  • Mitigation:
    • Classpath Minimization: Avoid including unnecessary libraries in your application dependencies.
    • Dependency Scanning: Use tools like OWASP Dependency-Check to identify dependencies with known vulnerabilities, including potential gadget classes.
    • Update Vulnerable Libraries: Update vulnerable libraries to patched versions that mitigate gadget chain vulnerabilities.
  • Description: Exploiting publicly known Common Vulnerabilities and Exposures (CVEs) in jackson-databind. Many CVEs have been reported, primarily related to deserialization vulnerabilities.
  • Impact: Can lead to Remote Code Execution (RCE) or Denial of Service (DoS), depending on the specific CVE.
  • Mitigation:
    • Regular Vulnerability Scanning: Use vulnerability scanners to identify vulnerable jackson-databind versions in your application.
    • Prompt Patching and Updates: Immediately apply security patches and upgrade jackson-databind versions when CVEs are disclosed.
    • Stay Informed: Subscribe to security advisories and mailing lists related to jackson-databind to stay updated on new vulnerabilities.
  • Description: For many known CVEs, exploit code or Proof-of-Concept (PoC) exploits are publicly available. Attackers can easily utilize these exploits to compromise vulnerable applications.
  • Impact: Significantly lowers the barrier to entry for exploiting known vulnerabilities, making attacks more likely.
  • Mitigation:
    • Proactive Patching: Patch vulnerabilities before exploits become widely available and are actively used in attacks.
    • Intrusion Detection/Prevention Systems (IDS/IPS): IDS/IPS can potentially detect and block attempts to use known exploits.
    • Web Application Firewalls (WAFs): WAFs can be configured to filter out malicious payloads associated with known exploits.
  • Description: Attackers aim to disrupt application availability by sending specially crafted JSON payloads that consume excessive resources during deserialization, leading to Denial of Service.
  • Impact: Service disruption, application unavailability, financial losses, reputational damage.
  • Mitigation:
    • Input Size Limits: Implement limits on the size of incoming JSON payloads.
    • Resource Limits: Configure resource limits (CPU, memory) for the application.
    • Rate Limiting: Restrict the number of requests from a single source.
    • Complexity Limits: Consider limiting the complexity of JSON structures (e.g., maximum nesting depth).
  • Description: A common DoS technique. Attackers craft JSON payloads with deeply nested objects or arrays. When jackson-databind attempts to parse and deserialize these payloads, it consumes excessive CPU and memory, leading to resource exhaustion and DoS.
  • Impact: Service disruption, application unavailability.
  • Mitigation: (Same as DoS via Deserialization mitigations - Input Size Limits, Resource Limits, Rate Limiting, Complexity Limits)
  • Description: Vulnerabilities arising from misconfigurations of jackson-databind, rather than inherent code flaws. This often involves relying on insecure default settings or incorrectly implementing security features.
  • Impact: Can lead to Remote Code Execution (RCE) or Denial of Service (DoS), depending on the specific misconfiguration.
  • Mitigation:
    • Explicit Configuration: Always explicitly configure jackson-databind ObjectMapper according to security best practices. Avoid relying on default settings.
    • Security-Focused Configuration Review: Regularly review jackson-databind configurations with security in mind.
    • Configuration Audits: Conduct audits of application configurations to identify potential misconfigurations.
  • Description: Relying on default jackson-databind settings, especially in older versions, can leave vulnerable features enabled, such as default typing.
  • Impact: Can lead to Remote Code Execution (RCE) if default typing is enabled.
  • Mitigation:
    • Avoid Default Configurations: Do not rely on default jackson-databind configurations.
    • Disable Default Typing: Specifically disable default typing using ObjectMapper.disableDefaultTyping().
    • Security Hardening: Review and harden jackson-databind configurations based on security best practices.
  • Description: The root cause of many configuration-based vulnerabilities. jackson-databind defaults, particularly in older versions, might enable features that are inherently risky if not carefully managed (e.g., default typing).
  • Impact: Creates opportunities for exploitation, especially RCE via polymorphic deserialization.
  • Mitigation:
    • Override Defaults: Explicitly configure jackson-databind to override insecure default settings.
    • Security Best Practices: Follow security best practices for jackson-databind configuration, focusing on disabling risky default features.
    • Example: Default Typing enabled without careful consideration [CRITICAL NODE]: This is a specific and critical example of an insecure default setting that must be addressed.