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

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: 4a0a00473045022053f121313deb9eaefc9054649a6853d8b8a02e1e707cebfc0cc3188d93982496022100b635b3a0985f644a5ccd3cdb5906f09603be94c8666809e09197e9f76b5882ce:922c64590222798bb761d5b6d8e72950