Chrome下出现:
The XSS Auditor refused to execute a script in 'http://192.168.16.53/ads/index/viewPostion' because its source code was found within the request. The auditor was enabled as the server sent neither an 'X-XSS-Protection' nor 'Content-Security-Policy' header.
情景:当你在一个页面里输出了一段 html代码 而该html代码里含有一个http的请求;
例如:
我要把以下这段代码直接在viewPostion 页面中输出
就会出现上述的XXS跨脚本攻击 ;
不论你使用js先获取到值,还是使用json在解析以后,在用document.wirte写到页面上,依旧会出现XXS的错误。
下面列出的为有用和安全相关的 http 响应头
X-XSS-Protection xxs 用于构建到最新的浏览器中ie8以上chrome(不确定版本) 默认开启
Strict-Transport-Security 安全的执行http通过ssl/ tls 链接到服务器
X-Frame-Options , Frame-Options 提供Clickjacking 保护
X-Content-Type-Options
Content-Security-Policy、X-Content-Security-Policy X-WebKit-CSP
Content-Security-Policy-Report-Only
The XSS Auditor refused to execute a script in 'http://192.168.16.53/ads/index/viewPostion' because its source code was found within the request. The auditor was enabled as the server sent neither an 'X-XSS-Protection' nor 'Content-Security-Policy' header.
情景:当你在一个页面里输出了一段 html代码 而该html代码里含有一个http的请求;
例如:
我要把以下这段代码直接在viewPostion 页面中输出
<!--ad100广告位 营销广告路由-->
<iframe style="overflow:hidden;
width:320px;
height:100px;
position:fixed;
left:0px;
top:0px;
border:none;
margin:0px;
padding:0px;"
</iframe>
就会出现上述的XXS跨脚本攻击 ;
不论你使用js先获取到值,还是使用json在解析以后,在用document.wirte写到页面上,依旧会出现XXS的错误。
如何跳过XXS呢?
其实上边的红色字已经告诉你了,就是 X-XSS-Protection = 0下面列出的为有用和安全相关的 http 响应头
X-XSS-Protection xxs 用于构建到最新的浏览器中ie8以上chrome(不确定版本) 默认开启
Strict-Transport-Security 安全的执行http通过ssl/ tls 链接到服务器
X-Frame-Options , Frame-Options 提供Clickjacking 保护
X-Content-Type-Options
Content-Security-Policy、X-Content-Security-Policy X-WebKit-CSP
Content-Security-Policy-Report-Only