使用 img src 属性中的 javascript 进行 XSS 攻击 [英] XSS attack with javascript in img src attribute

查看:146
本文介绍了使用 img src 属性中的 javascript 进行 XSS 攻击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一些较旧的浏览器容易受到 XSS 攻击

Some older browsers are vulnerable to XSS attacks as such

<img src="javascript:alert('yo')" />

当前版本的 IE、FF、Chrome 不是.

Current versions of IE, FF, Chrome are not.

我很好奇是否有任何浏览器容易受到类似的攻击:

I am curious if any browsers are vulnerable to a similar attack:

<img src="somefile.js" />

<iframe src="somefile.js" />

或其他类似的,其中 somefile.js 包含一些恶意脚本.

or other similar where somefile.js contains some malicious script.

推荐答案

没有.图像数据永远不会作为 JavaScript 执行.如果 src 是 JavaScript 链接,则执行 JavaScript,但读取来自对 src 的请求的数据的基本操作不涉及 JavaScript.

No. Image data is never executed as JavaScript. The if the src is a JavaScript link, the JavaScript is executed, but the fundamental reading of data that comes from a request to the src does not involve JavaScript.

这篇关于使用 img src 属性中的 javascript 进行 XSS 攻击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆