开发者

XSS via img tag, redundant semicolons?

开发者 https://www.devze.com 2023-03-14 19:11 出处:网络
I was looking over the WebGoat exercises, and for one question they ask that you create a JavaSc开发者_JS百科ript alert using an img tag.

I was looking over the WebGoat exercises, and for one question they ask that you create a JavaSc开发者_JS百科ript alert using an img tag.

Their solution is thus:

<img src=x onerror=;;alert('XSS') />

Looking at their solution, I wonder why two (as opposed to just one) semicolns are necessary before the actual alert?


Indeed the semicolons aren't necessary i just tested the same tag w/o the semicolons on FF5 and Chrome latest, they both send the alerts with this

<img src=x onerror=;;alert('XSS') />
<img src=x onerror=alert('XSS') />
<img src="x" onerror="alert('XSS')" />

i think they are trying to stop the onerror event in the first semicolon, then output the bogus code out of the event in the alert

i tried this

<img src=x onerror=alert('eventfire');;alert('XSS') />

and it encloses both alerts inside the event, so its not running the second alert outside the event scope.

answer? seems to be doing the same thing w/o the semicolons (maybe there for old browsers that parse the html poorly and execute the alert outside the scope of the event???)

0

精彩评论

暂无评论...
验证码 换一张
取 消