id: weglot-api-key-exposure

info:
  name: Weglot API Key - Exposed
  author: 0x_Akoko
  severity: medium
  description: |
   Detected Weglot API key was found exposed in a publicly accessible JavaScript file.
  reference:
    - https://developers.weglot.com/api/authentication
    - https://medium.com/@zx10a/my-first-accepted-hackerone-report-finding-exposed-weglot-api-keys-across-5-targets-fb14ecda869b
  metadata:
    verified: true
    max-request: 1
    fofa-query: body="/scripts/weglot.js" || body="/js/weglot.js" || body="Weglot.initialize" && body="api_key"
  tags: exposure,weglot,api-key,secret,js,misconfig

http:
  - method: GET
    path:
      - "{{BaseURL}}/scripts/weglot.js"

    matchers:
      - type: dsl
        dsl:
          - 'status_code == 200'
          - 'contains(content_type, "javascript")'
          - 'regex("wg_[a-f0-9]{32,40}", body)'
          - 'contains(body, "Weglot.initialize")'
        condition: and

    extractors:
      - type: regex
        part: body
        regex:
          - 'wg_[a-f0-9]{32,40}'
# digest: 490a004630440220427d36f556eec2129a56bd5ad24c987dbbfa291e5b73d01c33521875838ebb0e022036050f88b4aa0b84fe611d86945d2025e04059e76845d9ec33b9b585fd56c641:922c64590222798bb761d5b6d8e72950