githubEdit

enumeration

1. Tomcat Version Detection

Methods:

  • HTTP Server Header:

    curl -I http://target:port/ | grep -i "Server"
    • Check if the "Server" header reveals the Tomcat version.

  • /docs Page:

    curl -s http://target:port/docs/ | grep -i "Apache Tomcat"
    • Default documentation page may disclose the version.

  • Error Pages:

    curl -s http://target:port/nonexistentpage
    • Sometimes, error pages leak version information.

  • Specific File Checks:

    • If access is gained, check JAR files in /lib directory.

    • Version-specific vulnerabilities may relate to these files.


2. Tomcat Directory Structure (Key Files)

  • /bin - Executable scripts.

  • /conf/tomcat-users.xml - Stores user credentials and roles.

  • /conf/web.xml - Defines web application routes and configurations.

  • /webapps/ - Web application deployment directory.


3. Manager Application Enumeration

Directory Brute-forcing:

  • Using Gobuster:

  • Using Wfuzz:

  • Look for /manager and /host-manager paths.

Authentication Checks:

  • Default Credentials:

  • Brute-forcing Credentials:

  • If access is gained, check for application deployment, undeployment, and management functionalities.


4. Tomcat Credential Enumeration

tomcat-users.xml Enumeration:

  • Local File Inclusion (LFI) to read credentials:

  • Check for plaintext usernames and passwords.

web.xml Enumeration:

  • Identify application endpoints:

  • Useful for mapping application routes and identifying potential attack vectors.


5. WAR File Upload (Remote Code Execution)

  • After authentication to /manager:

    • Upload a malicious WAR file containing a JSP web shell.

  • Create JSP reverse shell:

  • Deploy via Manager interface and access via browser:


6. JMX Enumeration & Exploitation

Using jmxterm:

  • Explore MBeans and their attributes/operations.

Using Metasploit:

  • JMX can expose sensitive information and allow for RCE.


7. Connector Enumeration

AJP Connector:

  • Check if AJP is enabled (Default: Port 8009):

  • Exploit AJP using Ghostcat (CVE-2020-1938):

  • AJP misconfigurations can lead to sensitive file disclosure or code execution.


8. Web Application Enumeration

Directory & File Enumeration:

  • Enumerate web applications in /webapps/ directory:

  • Find JSP files and servlets:

Parameter Fuzzing:

  • Fuzz application parameters for vulnerabilities:


9. Configuration File Enumeration

  • Identify sensitive configuration files:

    • catalina.properties

    • server.xml

    • context.xml

  • Extract credentials, ports, and security settings.


10. CVE Enumeration & Exploitation

  • Identify version-specific vulnerabilities:

  • Public exploits for Tomcat:


Important Considerations

  • Least Privilege: Use minimal required privileges during enumeration.

  • Target Scope: Stay within the defined scope of the penetration test.

  • Documentation: Record all findings and methodologies.

  • Client Communication: Keep the client informed of critical discoveries.

  • Clean Up: Remove temporary files and restore original configurations if testing in an authorized environment.


Summary of Key Findings

  • Server Header & Docs: Identify Tomcat version.

  • tomcat-users.xml: Extract credentials and roles.

  • web.xml: Map routes and servlets.

  • /manager & /host-manager: Manage applications.

  • WAR File Upload: Achieve RCE.

  • JMX Exposure: Possible RCE and data leaks.

  • AJP Connector: Check for misconfigurations.

  • Common CVEs: Search for known exploits.

Last updated