id: element-web-detect

info:
  name: Element Web - Detect
  author: davidegirardi
  severity: info
  description: Identify if a web application is vanilla Element Web and return the version
  classification:
    cpe: cpe:2.3:a:matrix:element:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 2
    vendor: matrix
    product: element
    shodan-query: html:"manifest.json"
  tags: tech,matrix,element,detect,discovery

http:
  - method: GET
    path:
      - "{{BaseURL}}/manifest.json"
      - "{{BaseURL}}/version"

    host-redirects: true
    max-redirects: 2
    matchers:
      - type: dsl
        dsl:
          - 'status_code_1 == 200'
          - 'contains(content_type_1, "application/json")'
          - 'contains(json_minify(body_1), "\"name\":\"Element\"")'
          - 'status_code_2 == 200'
        condition: and

    extractors:
      - type: regex
        part: body
        regex:
          - '[^\s]+'
# digest: 4b0a00483046022100b627ba4e24c1b18f86a8d57547441ca51ac33d849826b35da06e608f134c7abb0221008412f8ab72e422be8257eee98aa2c5b4b18f027a8c3458d2dceef2f27b0c6c85:922c64590222798bb761d5b6d8e72950