id: truenas-api-key

info:
  name: TrueNAS API Key (WebSocket)
  author: DhiyaneshDK
  severity: info
  reference:
    - https://github.com/praetorian-inc/noseyparker/blob/main/crates/noseyparker/data/default/builtin/rules/truenas.yml
    - https://www.truenas.com/docs/api/core_websocket_api.html
    - https://www.truenas.com/docs/api/scale_rest_api.html
    - https://www.truenas.com/docs/scale/scaletutorials/toptoolbar/managingapikeys/
    - https://www.truenas.com/docs/scale/scaleclireference/auth/cliapikey/
    - https://www.truenas.com/docs/scale/api/
    - https://www.truenas.com/community/threads/api-examples-in-perl-python.108053/
  metadata:
    verified: true
    max-request: 1
  tags: truenas,exposure,tokens,vuln

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

    extractors:
      - type: regex
        part: body
        regex:
          - '"params"\s*:\s*\[\s*"(\d+-[a-zA-Z0-9]{64})"\s*\]'
# digest: 490a0046304402203485006d91137829110db32a5b84c3a3bce62c950847b5fe273842557f4abebd0220093288b69e251bba752a038cabe5fa02bb8391a2e8824f2bf4eea153e5b66ad8:922c64590222798bb761d5b6d8e72950