id: elastic-cloud-api-key

info:
  name: Elastic Cloud API Key Detection
  author: Chemo850
  severity: high
  description: |
    Detects Elastic Cloud API keys used for programmatic access to the Elastic Cloud and serverless APIs.
  reference:
    - https://www.elastic.co/docs/deploy-manage/api-keys/elastic-cloud-api-keys
  classification:
    cwe-id: CWE-522,CWE-540
  metadata:
    verified: true
    max-request: 1
  tags: elastic,exposure,tokens,vuln

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

    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - "essu_"
      - type: regex
        part: body
        regex:
          - essu_[A-Za-z0-9+/]{80}AAAAA[A-Za-z0-9+/=]{7}

    extractors:
      - type: regex
        part: body
        regex:
          - essu_[A-Za-z0-9+/]{80}AAAAA[A-Za-z0-9+/=]{7}
# digest: 4a0a0047304502205f08fb87c4374967cba03e60a2c5b2775614b9c6eba8de44fd3177cacbe2d7dc022100bb992518b2d67d5e1216f0b14deb60db054501c4bc8644bd950bf10ae3360e78:922c64590222798bb761d5b6d8e72950