发布后忽略基本标记

Ken*_*ins 5 html xss post redirect base-tag

在Chrome上我Refused to execute a JavaScript script. Source code of script found within request.发布包含域名的数据后发现错误(另请注意,任何一个页面都缺少javascript).

badpage1.html:

<form action="/badpage2.html" method="post">
<input type="hidden" name="name" value="href=%22http://www.w3.org/%22"/>
<input type="submit" name="submit"/>
</form>
Run Code Online (Sandbox Code Playgroud)

badpage2.html:

<!DOCTYPE html>
<html>
    <head>
        <base href="http://www.w3.org/"/>
    </head>
    <body>
        <img src="Icons/w3c_home" alt="">
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

如果你直接去badpage2.html图像会显示,但如果你去看它badpage1.html,图像将不会显示(基本标签不起作用).

这是Chrome XSS检测中的错误吗?如果不是,我该如何绕过这个?对发布的数据进行编码只是为了绕过这个过滤器似乎很愚蠢.

编辑:

就我而言,发送的帖子值是更新页面内容的一部分.如果它包含恰好包含在其中使用的域名<base>(如本例所示),它将触发禁用<base>标记的XSS检测.

Ken*_*ins 3

我发现我可以X-XSS-Protection在由于保护而混乱的页面上发送自定义 HTTP 标头。

我的 PHP 解决方案使用以下代码:

header( "X-XSS-Protection: 0" );
Run Code Online (Sandbox Code Playgroud)