Skip to content

Latest commit

 

History

History
199 lines (141 loc) · 17 KB

File metadata and controls

199 lines (141 loc) · 17 KB

Attack Tree Analysis for apache/struts

Objective: Compromise Struts Application

Attack Tree Visualization

Root Goal: Compromise Struts Application **[HIGH-RISK PATH]**
├─── 1. Exploit Struts Vulnerabilities **[CRITICAL]** **[HIGH-RISK PATH]**
│    ├─── 1.1. Exploit OGNL Injection Vulnerabilities **[CRITICAL]** **[HIGH-RISK PATH]**
│    │    ├─── 1.1.2. Craft Malicious OGNL Payload **[CRITICAL]** **[HIGH-RISK PATH]**
│    │    │    ├─── 1.1.2.1. Command Execution Payload **[CRITICAL]**
│    │    │    ├─── 1.1.2.2. Data Exfiltration Payload **[CRITICAL]**
│    │    │    ├─── 1.1.2.3. Web Shell Deployment Payload **[CRITICAL]**
│    │    ├─── 1.1.3. Inject and Execute OGNL Payload **[CRITICAL]** **[HIGH-RISK PATH]**
│    │    │    ├─── 1.1.3.1. Inject via URL Parameters **[CRITICAL]**
│    │    │    ├─── 1.1.3.2. Inject via Form Fields **[CRITICAL]**
│    │    │    ├─── 1.1.3.4. Leverage Struts Tags Vulnerabilities **[CRITICAL]**
│    ├─── 1.2. Exploit File Upload Vulnerabilities **[CRITICAL]** **[HIGH-RISK PATH]**
│    │    ├─── 1.2.2. Bypass File Type Restrictions **[CRITICAL]**
│    │    │    ├─── 1.2.2.1. Modify File Extension **[CRITICAL]**
│    │    │    ├─── 1.2.2.2. MIME Type Manipulation **[CRITICAL]**
│    │    ├─── 1.2.3. Upload Malicious File **[CRITICAL]** **[HIGH-RISK PATH]**
│    │    │    ├─── 1.2.3.1. Web Shell Upload (JSP, etc.) **[CRITICAL]**
│    │    ├─── 1.2.4. Execute Malicious File **[CRITICAL]** **[HIGH-RISK PATH]**
│    │    │    ├─── 1.2.4.1. Direct Access to Uploaded File **[CRITICAL]**
│    ├─── 1.4. Exploit Configuration Vulnerabilities **[HIGH-RISK PATH]**
│    │    ├─── 1.4.3. Exposed Struts Admin Interfaces (if any) **[CRITICAL]** **[HIGH-RISK PATH]**
│    ├─── 1.5. Exploit Dependency Vulnerabilities in Struts Libraries **[CRITICAL]** **[HIGH-RISK PATH]**
│    │    ├─── 1.5.2. Check for Known Vulnerabilities in Dependencies **[CRITICAL]**
│    │    ├─── 1.5.3. Exploit Vulnerable Dependency **[CRITICAL]** **[HIGH-RISK PATH]**
│    └─── 1.6. Exploit Known Struts Vulnerabilities (CVEs) **[CRITICAL]** **[HIGH-RISK PATH]**
│         ├─── 1.6.2. Research CVEs for Identified Struts Version **[CRITICAL]**
│         ├─── 1.6.3. Exploit Known CVE **[CRITICAL]** **[HIGH-RISK PATH]**
│         │    ├─── 1.6.3.1. Utilize Public Exploits (Metasploit, Exploit-DB, etc.) **[CRITICAL]**
  • Attack Vector: Targeting weaknesses inherent in the Apache Struts framework itself, rather than general web application vulnerabilities.
  • Impact: Potentially leads to full application compromise, data breaches, and system takeover.
  • Mitigation: Prioritize patching and upgrading Struts, implement Struts-specific security configurations, and conduct regular Struts-focused security assessments.
  • Attack Vector: Exploiting flaws in how Struts handles Object-Graph Navigation Language (OGNL) expressions, allowing attackers to inject malicious OGNL code.
  • Impact: Remote Code Execution (RCE), data exfiltration, web shell deployment, Denial of Service.
  • Mitigation: Strict input validation and sanitization for all inputs processed by OGNL, avoid dynamic OGNL expressions where possible, use parameterized actions, and consider alternative expression languages.
  • Attack Vector: Developing OGNL expressions designed to perform malicious actions when executed by the Struts application.
  • Impact: Depends on the payload crafted, ranging from command execution to data theft.
  • Mitigation: Focus on preventing OGNL injection in the first place (see 1.1 mitigation).
  • Attack Vector: OGNL payload designed to execute arbitrary system commands on the server.
  • Impact: Full system compromise, complete control over the server.
  • Mitigation: Strong input validation, principle of least privilege for the application user, and system-level security hardening.
  • Attack Vector: OGNL payload designed to access and extract sensitive data from the application's context, session, or server environment.
  • Impact: Data breach, exposure of confidential information, privacy violations.
  • Mitigation: Secure coding practices to minimize data exposure, access control mechanisms within the application, and data loss prevention strategies.
  • Attack Vector: OGNL payload designed to write a web shell (e.g., JSP) to the web server's accessible directory.
  • Impact: Persistent backdoor access to the application and server, long-term compromise.
  • Mitigation: File integrity monitoring, web server hardening, and regular security audits to detect and remove web shells.
  • Attack Vector: Delivering the crafted malicious OGNL payload to the vulnerable Struts application and triggering its execution.
  • Impact: Payload execution and associated impacts (command execution, data theft, etc.).
  • Mitigation: WAF to filter malicious requests, robust input validation, and secure coding practices to prevent injection vulnerabilities.
  • Attack Vector: Injecting the OGNL payload within URL parameters that are processed by vulnerable Struts components.
  • Impact: Payload execution.
  • Mitigation: Input validation for URL parameters, avoid processing dynamic expressions from URL parameters, and WAF rules to detect OGNL injection patterns in URLs.
  • Attack Vector: Injecting the OGNL payload within form fields that are processed by vulnerable Struts components.
  • Impact: Payload execution.
  • Mitigation: Input validation for form fields, avoid processing dynamic expressions from form fields, and WAF rules to detect OGNL injection patterns in form data.
  • Attack Vector: Exploiting specific vulnerabilities in Struts tags that can lead to OGNL injection, often through improper handling of tag attributes or values.
  • Impact: Payload execution.
  • Mitigation: Keep Struts updated to patch tag vulnerabilities, carefully review and audit usage of Struts tags, and avoid using vulnerable tag configurations.
  • Attack Vector: Abusing file upload functionality in the Struts application to upload and execute malicious files.
  • Impact: Web shell deployment, remote code execution, data breaches, and potentially further system compromise.
  • Mitigation: Strict file type validation (server-side), validate file content, store uploaded files securely outside the web root, implement access controls, and use secure file processing practices.
  • Attack Vector: Circumventing file type validation mechanisms implemented by the application to allow uploading of disallowed file types (e.g., executable files).
  • Impact: Allows uploading of malicious files, prerequisite for file upload exploitation.
  • Mitigation: Robust server-side file type validation, validate file content (magic numbers), not just extensions, and avoid relying solely on client-side validation.
  • Attack Vector: Changing the file extension of a malicious file to bypass extension-based validation checks.
  • Impact: Bypassing file type restrictions.
  • Mitigation: Validate file content, not just extension, and use robust server-side validation logic.
  • Attack Vector: Manipulating the MIME type in the HTTP request header to bypass MIME type-based validation checks.
  • Impact: Bypassing file type restrictions.
  • Mitigation: Validate file content, not just MIME type, and use server-side validation that is not solely reliant on the client-provided MIME type.
  • Attack Vector: Successfully uploading a malicious file (e.g., web shell, executable) to the server after bypassing file type restrictions.
  • Impact: Allows for further exploitation, such as web shell access or code execution.
  • Mitigation: Effective file type restriction bypass prevention (see 1.2.2 mitigations), and secure storage of uploaded files.
  • Attack Vector: Uploading a web shell (e.g., JSP, PHP) to gain remote command execution capabilities.
  • Impact: Persistent remote access, command execution, full control over the web server.
  • Mitigation: Prevent file upload vulnerabilities, file integrity monitoring, and web server hardening to limit the impact of web shells.
  • Attack Vector: Triggering the execution of the uploaded malicious file on the server.
  • Impact: Code execution, web shell access, system compromise.
  • Mitigation: Store uploaded files outside the web root and ensure they are not directly accessible, implement access controls, and avoid application logic that directly executes uploaded files.
  • Attack Vector: Directly accessing the uploaded malicious file via a web URL if the file is stored in a publicly accessible location.
  • Impact: Easy execution of the malicious file, immediate compromise.
  • Mitigation: Store uploaded files outside the web root and ensure they are not directly accessible via web URLs.
  • Attack Vector: Taking advantage of insecure configurations in the Struts application or its environment.
  • Impact: Information disclosure, unauthorized access, and potentially pathways to more severe vulnerabilities.
  • Mitigation: Secure configuration management, regular configuration audits, follow security best practices for Struts configuration, and disable debug mode in production.
  • Attack Vector: Accessing exposed Struts administration or management interfaces, often due to misconfiguration or default settings.
  • Impact: Administrative access to the Struts application, potentially leading to full control.
  • Mitigation: Properly secure and protect admin interfaces, use strong authentication, restrict access to authorized users/networks, and disable or remove unnecessary admin interfaces in production.
  • Attack Vector: Exploiting known vulnerabilities in third-party libraries that Struts depends on.
  • Impact: Varies depending on the dependency vulnerability, but can range from information disclosure to remote code execution.
  • Mitigation: Maintain an inventory of Struts dependencies, regularly scan dependencies for known vulnerabilities using tools like OWASP Dependency-Check, and promptly update vulnerable dependencies.
  • Attack Vector: Identifying vulnerable dependencies by analyzing project dependencies and consulting vulnerability databases.
  • Impact: Identifying potential attack vectors.
  • Mitigation: Use dependency scanning tools and regularly check security databases for vulnerabilities in project dependencies.
  • Attack Vector: Exploiting specific vulnerabilities found in Struts dependencies.
  • Impact: Depends on the vulnerability, potentially leading to code execution, information disclosure, or other forms of compromise.
  • Mitigation: Patch vulnerable dependencies promptly, implement workarounds if patches are not immediately available, and monitor for security advisories related to dependencies.
  • Attack Vector: Targeting publicly known vulnerabilities (CVEs) in specific versions of Apache Struts.
  • Impact: Varies depending on the CVE, but many Struts CVEs have led to remote code execution and full system compromise.
  • Mitigation: Maintain an up-to-date Struts version, promptly apply security patches released by Apache Struts, and monitor CVE databases and Struts security bulletins for new vulnerabilities.
  • Attack Vector: Identifying relevant CVEs by determining the Struts version in use and searching vulnerability databases and security bulletins.
  • Impact: Identifying potential attack vectors based on known vulnerabilities.
  • Mitigation: Regularly check CVE databases and Struts security bulletins for vulnerabilities affecting the deployed Struts version.
  • Attack Vector: Utilizing exploits (public or custom) to target known CVEs in the Struts application.
  • Impact: Varies depending on the CVE, but often leads to remote code execution and system compromise.
  • Mitigation: Patch vulnerable Struts versions, implement intrusion detection and prevention systems, and monitor for exploit attempts targeting known Struts CVEs.
  • Attack Vector: Using readily available public exploits (e.g., from Metasploit or Exploit-DB) to exploit known Struts CVEs.
  • Impact: Easy and rapid exploitation of vulnerable systems.
  • Mitigation: Patching is the primary mitigation. Additionally, WAF and intrusion detection systems can help detect and block known exploit patterns.