Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果允许用户使用他们想要的任何 src 属性创建 img 标签,它会损害网站的安全性吗?
可能造成什么样的伤害?
也可以通过使用网络错误http://en.wikipedia.org/wiki/Web_bug来跟踪您的网站访问者
允许元素上的任意src值<img>将允许跨站点脚本,从而允许在您的页面上执行任意 JavaScript 代码:
src
<img>
<img src="javascript:…">
它还可以用于伪造任意 GET 请求,类似于跨站点请求伪造,但其引荐来源网址来自您的站点。