id: apache-tomcat-exposed

info:
  name: Tomcat Exposed - Detect
  author: Podalirius,righettod,Ahmed Sherif,geeknik,sinKettu
  severity: info
  description: |
    An Apache Tomcat instance was detected.
  classification:
    cpe: cpe:2.3:a:apache:tomcat:*:*:*:*:*:*:*:*
  metadata:
    max-request: 1
    verified: true
    vendor: apache
    product: tomcat
    shodan-query:
      - title:"Apache Tomcat"
      - http.title:"apache tomcat"
      - http.html:"apache tomcat"
      - cpe:"cpe:2.3:a:apache:tomcat"
    fofa-query:
      - body="apache tomcat"
      - title="apache tomcat"
    google-query: intitle:"apache tomcat"
  tags: panel,tomcat,apache,discovery,login

http:
  - method: GET
    path:
      - '{{BaseURL}}/host-manager/html'
      - '{{BaseURL}}/manager/status'
      - '{{BaseURL}}/manager/html'
      - '{{BaseURL}}/docs/'
      - '{{BaseURL}}/examples/'

    stop-at-first-match: true

    matchers:
      - type: dsl
        dsl:
          - 'status_code == 200 || status_code == 401'
          - 'contains_any(to_lower(body), "apache tomcat", "tomcat-users.xml")'
        condition: and

    extractors:
      - type: regex
        part: body
        group: 1
        regex:
          - 'Version\s+([0-9.]+),'
          - '(?i)/lib/([a-z0-9.]+)/webapps'
          - '(?i)<h3>Apache\s+Tomcat/([0-9.]+)'
# digest: 4a0a004730450220306218a591189443e2662fc52e028fea1a5751f930fe06705942b19b4b0a5af7022100c1b07f162d5e408ef4dd9d6cfc12dfbb210b0e38ac432d31e8306796840689f9:922c64590222798bb761d5b6d8e72950