[INVALID] Anti-XSS Protection Regex for google unsafe

Bug reports and enhancement requests
Post Reply
alh
Posts: 2
Joined: Thu Aug 19, 2010 5:01 pm

[INVALID] Anti-XSS Protection Regex for google unsafe

Post by alh »

The Regex in the Anti-XSS Protection for google:

Code: Select all

^https?://([a-z]+)\.google\.(?:[a-z]{1,3}\.)?[a-z]+/(?:search|custom|\1)\?
Allows for matches against domains that aren't owned by google. For example, the Anti-XSS protection doesn't work for the following example hostnames:
* http://www.google.pzt.com/?
* https://www.google.lol.com/custom?

As long as you have http://<subdomain>.google.<3 character domain>.<com net org etc>/? the match will work.

Not a huge issue, but not ideal.
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3 Ubuntu
User avatar
Giorgio Maone
Site Admin
Posts: 9524
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: [INVALID] Anti-XSS Protection Regex for google unsafe

Post by Giorgio Maone »

Thanks for the warning, but this is covered internally: if that regexp matches, a further test is done against the hostname ensure that the terminal part after ".google." is actually a TLD.
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
alh
Posts: 2
Joined: Thu Aug 19, 2010 5:01 pm

Re: [INVALID] Anti-XSS Protection Regex for google unsafe

Post by alh »

In my limited testing I haven't seen this to be the case.

How would the internals even be aware that what comes after google. is a valid TLD as long as the hostname overall is a valid hostname?

google.pzt.com is a valid hostname as far as syntax goes...
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3 Ubuntu
User avatar
Giorgio Maone
Site Admin
Posts: 9524
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: [INVALID] Anti-XSS Protection Regex for google unsafe

Post by Giorgio Maone »

alh wrote:google.pzt.com is a valid hostname as far as syntax goes...
But ptz.com is not a valid TLD.
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
User avatar
GµårÐïåñ
Lieutenant Colonel
Posts: 3370
Joined: Fri Mar 20, 2009 5:19 am
Location: PST - USA
Contact:

Re: [INVALID] Anti-XSS Protection Regex for google unsafe

Post by GµårÐïåñ »

To simplify, what he means is that if what comes RIGHT AFTER google is not a valid TLD, then it would fail it. So doesn't matter what type of valid hostname you put in there, if it manages to somehow satisfy the regex, then it will be nailed by failing the domain test, if it ain't google.com google.TLD then it would not satisfy that and its moot. Get it now?
~.:[ Lï£ê ï§ å Lêmðñ åñÐ Ì Wåñ† M¥ Mðñê¥ ßå¢k ]:.~
________________ .: [ Major Mike's ] :. ________________
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
Post Reply