id: matrix-homeserver-detect

info:
  name: Matrix Homeserver - Version Detection
  author: davidegirardi
  severity: info
  description: |
    Extract the Matrix homeserver name and version
  classification:
    cpe: cpe:2.3:a:matrix:synapse:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 1
    vendor: matrix
    product: synapse
    shodan-query: title:"Synapse is running"
  tags: tech,matrix,synapse

http:
  - method: GET
    path:
      - "{{BaseURL}}/_matrix/federation/v1/version"

    redirects: true
    max-redirects: 2
    matchers:
      - type: word
        part: body
        words:
          - '"server":'
          - '"name":'
          - '"version":'
        condition: and

    extractors:
      - type: json
        part: body
        json:
          - '.server | select((.name != null) and (.version != null)) | .name, .version'
# digest: 4b0a0048304602210096f62cafdc528606bbe946f4607459b83146e2966badf566e85ea0ef91d1c7440221009709d2609c30d2e3653f29ebbddf24263efdc70032ab7d0ee9986feb2ff7f1c7:922c64590222798bb761d5b6d8e72950