id: zenscrape-api-key

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

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

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

    matchers:
      - type: regex
        part: body
        name: token
        regex:
          - '([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})'
        internal: true

  - raw:
      - |
        @Host: https://app.zenscrape.com:443
        GET /api/v1/status HTTP/1.1
        Host: app.zenscrape.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: 4b0a00483046022100d18e8ece1ea24eb0634630cfcf33485a5939d3a682af441ceb9539d93a7ec9f8022100c623da0997be027a1355523936b9cc1302dd5da2f24c876ccf416b04355946d4:922c64590222798bb761d5b6d8e72950