id: scalar-detection

info:
  name: Scalar API Documentation - Detect
  author: recepgunes
  severity: info
  description: Scalar API documentation panel was detected.
  classification:
    cvss-metrics: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N
    cwe-id: CWE-200
  metadata:
    verified: true
    max-request: 2
    vendor: scalar
    product: scalar
    shodan-query: title:"Scalar API Reference"
    fofa-query: title="Scalar API Reference"
    google-query: intitle:"Scalar API Reference"
  tags: panel,scalar,api,documentation,detect,discovery

http:
  - method: GET
    path:
      - "{{BaseURL}}/scalar"
      - "{{BaseURL}}"

    host-redirects: true
    max-redirects: 2
    stop-at-first-match: true

    matchers-condition: and
    matchers:
      - type: word
        part: response
        words:
          - "Scalar API Reference"
          - "@scalar/api-reference"
          - "scalar-references"
          - 'src="scalar.js'
          - './scalar.aspnetcore.js'
          - '/scalar/v1'
        condition: or

      - type: status
        status:
          - 200

    extractors:
      - type: regex
        name: version
        part: body
        group: 1
        regex:
          - '@scalar/api-reference@([0-9.]+)'
          - 'scalar.*version.*([0-9.]+)'
# digest: 4a0a00473045022100e70fb12c841694f1089041618c5df2e6721dfeb6ed009e156bb84f78b143f28c02205865795dab693bb192ec9e7e9571a7cf9ebfc739f7827f99b80e90bf1278a2d2:922c64590222798bb761d5b6d8e72950