在 Chrome 上我收到错误 Refused to execute a JavaScript script. Source code of script found within request.
在发布包含域名称的数据后(还要注意任一页面上都缺少 javascript)。
<form action="/badpage2.html" method="post">
<input type="hidden" name="name" value="href=%22http://www.w3.org/%22"/>
<input type="submit" name="submit"/>
</form>
<!DOCTYPE html>
<html>
<head>
<base href="http://www.w3.org/"/>
</head>
<body>
<img src="Icons/w3c_home" alt="">
</body>
</html>
如果您直接转到 badpage2.html
该图像将显示,但如果您通过 badpage1.html
访问它,图像将不会显示(基本标记不起作用)。
这是 Chrome XSS 检测中的错误吗?如果不是,我将如何绕过它?为了绕过这个过滤器而对发布的数据进行编码似乎很愚蠢。
编辑:
在我的例子中,发送的post值是为了更新页面的部分内容。如果它恰好包含在 <base>
中使用的域名,问题就会出现。 (如本例所示)它将触发禁用 <base>
的 XSS 检测标签。
最佳答案
我发现我可以发送自定义 HTTP header X-XSS-Protection
在由于保护而困惑的页面上。
我将以下代码用于我的 PHP 解决方案:
header( "X-XSS-Protection: 0" );
关于html - 发布后忽略基本标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9423220/