id: twitter-bearer-token

info:
  name: Twitter Bearer Token
  author: DhiyaneshDK
  severity: info
  reference:
    - https://github.com/semgrep/semgrep-rules/blob/develop/generic/secrets/gitleaks/typeform-api-token.go
    - https://github.com/semgrep/semgrep-rules/blob/develop/generic/secrets/gitleaks/twitter-bearer-token.yaml
    - https://developer.twitter.com/en/docs/authentication/overview
  metadata:
    verified: true
    max-request: 1
  tags: twitter,exposure,tokens,vuln

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

    extractors:
      - type: regex
        part: body
        regex:
          - (?i)(?:twitter)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}(A{22}[a-zA-Z0-9%]{80,100})(?:['|\"|\n|\r|\s|\x60|;]|$)
# digest: 4a0a00473045022039a00df22004c3843afefb91d3a493e266c7d2e047ff66d27838b562a7fa5f2e022100deff31a892efedc9fa6b9ec2dd023b89a2cdc6b91b8f11fbd113f8e30ef30b00:922c64590222798bb761d5b6d8e72950