html - 发布后忽略基本标签

标签 html post redirect xss 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>

badpage2.html :

<!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/

相关文章:

redirect - 如果页面无法访问,则 Spring Security 重定向

html - 崇高文本 2 : How to search for every instance of an applied class?

html - <a> 位于 <h2> 内,还是 <h2> 位于 <a> 内?

php - 无法从 MySQL 中的 post 数组插入数据

android - 如何在 android 中使用 http post 发送 xml 文件。我将 xml 文件放在代码中的位置

php - Magento 客户登录页面在登录后立即再次加载,并且未创建 Frontedn cookie

html - 媒体查询 - 更改 <h1> 内容?

javascript - 在javascript中为动态表添加表头

json - 使用 crate 的 HTTP API 插入对象数组 : error 4003

apache - 域重定向到www时如何将www子域重定向到非www