id: zenserp-api-key

info:
  name: Zenserp Api Key
  author: ritikchaddha
  severity: high
  reference:
    - https://github.com/trufflesecurity/trufflehog/blob/main/pkg/detectors/zenserp/zenserp.go
  metadata:
    max-request: 2
  tags: exposure,token,zenserp,apikey,vuln

flow: http(1) && http(2)

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

    matchers:
      - type: regex
        part: body
        name: token
        regex:
          - '([0-9a-z-]{36})'
        internal: true

  - raw:
      - |
        @Host: https://app.zenserp.com:443
        GET /api/v2/status HTTP/1.1
        Host: app.zenserp.com
        Apikey: {{token}}

    disable-path-automerge: true
    matchers:
      - type: dsl
        dsl:
          - status_code == 200
          - contains(content_type, 'application/json')
          - contains(body, 'remaining_requests')
        condition: and

    extractors:
      - type: dsl
        dsl:
          - token
# digest: 4a0a0047304502202263e771a1aa3ca7d791c26440a46a4a8173a1b461c992f656a8e7a92a43b4c0022100a7a7d5e4f41d7d167e08435c17b0565a0ea9375e715bbf76c8063606100055ed:922c64590222798bb761d5b6d8e72950