YEAR OF SECURITY FOR JAVA – WEEK 11 – X-XSS-PROTECTION

简介: What is it and why should I care? X-XSS-Protection is a Microsoft IE technology used to help prevent reflected XSS attacks in IE.
What is it and why should I care?
X-XSS-Protection is a Microsoft IE technology used to help prevent reflected XSS attacks in IE.


Note 1: This is not a “panacea” for XSS. There is no excuse for not developing your site in a secure manner to prevent XSS. This however is a protection offered by the browser itself (as opposed to an application), meant to protect the masses from the vast amount of XSS litter on the internet.
Note 2: Firefox (by way of NoScript), Chrome (by way of WebKit) and Safari(also WebKit) have similar protections, but apparently don’t use the X-XSS-Protection header as a controlling mechanism.


The XSS protection provided essentially checks for request content that is matched in the response and would cause an XSS vulnerability to be exploited. The filter then performs some mangling of the content to prevent the attack from succeeding. According to the docs, IE has the protection turned on by default for most security zones, including the Internet zone, which is the primary concern for most users.


What should I do about it?
The first thing you should do is work towards resolving any and all XSS issues in your application. As a security minded developer, this is a must.


The recommendation for the use of this header is actually not so straightforward in my opinion. In general, the other HTTP headers I’ve described already in the series have had very little downside. However, the X-XSS-Protection header has had some problems in the past. As far as I’m aware, the IE folks have done a good job of dealing with the known vulns, but I still have concerns since some of the vulns have exposed security problems.


In general, I would recommend keeping the protection enabled, unless you are very sure you have XSS all cleaned up in your app. However, this comes with the caveat that you should at least put some thought into the use cases in your site first. Depending on your choice, here are the options you have available to use, and how you enable them in your application using the X-XSS-Protection HTTP header.


1. Enable the protection for all security zones in blocking mode (Blocking mode means the site won’t display at all if an XSS attempt is found, but rather a simple warning to the user that the attack has been blocked):


1
X-XSS-Protection: 1; mode=block
2. Enable the protection for all security zones:


1
X-XSS-Protection: 1
3. Leave the protection enabled for the default zones:


Do nothing.


4. Disable the protection entirely (I only recommend this in 2 cases: either you’re positive that you’ve completely resolved XSS in your app, or there’s an issue in the XSS filter that you’re aware of that causes an additional vulnerability) :


1
X-XSS-Protection: 0
The protection provided by the X-XSS-Protection header is not complete, but it does raise the bar against attackers and helps protect users. While there have certainly been some implementation issues, the fact that all the major browsers have some implementation of reflected XSS protection shows the importance of this issue. Be prudent in implementation, but certainly do everything you can to help your users be safe.


References
———–
http://blogs.msdn.com/b/ieinternals/archive/2011/01/31/controlling-the-internet-explorer-xss-filter-with-the-x-xss-protection-http-header.aspx
http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-iv-the-xss-filter.aspx
http://blogs.msdn.com/b/mikeormond/archive/2009/01/26/ie8-cross-site-scripting-xss-protection.aspx
http://msdn.microsoft.com/en-us/library/dd565647(v=vs.85).aspx
http://michael-coates.blogspot.com/2009/07/ie-8-anti-xss-bit-overblown.html
http://jeremiahgrossman.blogspot.com/2010/01/to-disable-ie8s-xss-filter-or-not.html
http://www.jtmelton.com/2009/01/12/the-owasp-top-ten-and-esapi-part-2-cross-site-scripting-xss/
http://michael-coates.blogspot.com/2009/11/ie8-xss-filter-bug.html
http://xforce.iss.net/xforce/xfdb/47442
http://hackademix.net/2009/11/21/ies-xss-filter-creates-xss-vulnerabilities/
http://www.theregister.co.uk/2009/11/20/internet_explorer_security_flaw/
目录
相关文章
|
6月前
|
安全 Java 数据安全/隐私保护
使用Java和Spring Security实现身份验证与授权
使用Java和Spring Security实现身份验证与授权
|
7月前
|
SQL 安全 Java
java的SQL注入与XSS攻击
java的SQL注入与XSS攻击
148 2
|
7月前
|
存储 安全 Java
详解 Spring Security:全面保护 Java 应用程序的安全框架
详解 Spring Security:全面保护 Java 应用程序的安全框架
444 1
|
7月前
|
JSON 安全 Java
Java一分钟之-Spring Security:身份验证与授权
【6月更文挑战第7天】本文介绍了Spring Security的常见问题及解决方案,包括配置启动、身份验证、授权、无状态JWT和异常处理。通过`@EnableWebSecurity`启动安全框架,自定义登录页面和登录逻辑,使用`http.authorizeRequests()`设置访问规则。对于JWT,需添加解析器并注册过滤器。此外,处理Spring Security异常,创建自定义的`AccessDeniedHandler`和`AuthenticationEntryPoint`。理解核心概念并按业务需求定制,是确保应用安全的关键。
149 1
|
7月前
|
安全 前端开发 Java
代码审计-Java项目&Filter过滤器&CNVD分析&XSS跨站&框架安全
代码审计-Java项目&Filter过滤器&CNVD分析&XSS跨站&框架安全
|
8月前
|
安全 Java 数据安全/隐私保护
使用Spring Security进行Java身份验证与授权
【4月更文挑战第16天】Spring Security是Java应用的安全框架,提供认证和授权解决方案。通过添加相关依赖到`pom.xml`,然后配置`SecurityConfig`,如设置用户认证信息和URL访问规则,可以实现应用的安全保护。认证流程包括请求拦截、身份验证、响应生成和访问控制。授权则涉及访问决策管理器,如基于角色的投票。Spring Security为开发者构建安全应用提供了全面且灵活的工具,涵盖OAuth2、CSRF保护等功能。
177 4
|
8月前
|
存储 安全 Java
Spring Security应用讲解(Java案列演示)
Spring Security应用讲解(Java案列演示)
|
8月前
|
安全 Java 数据安全/隐私保护
【Java】保护你的应用:深入探讨Spring Security的应用与最佳实践
【Java】保护你的应用:深入探讨Spring Security的应用与最佳实践
198 0
|
存储 XML SQL
Java审计之XSS篇
继续 学习一波Java审计的XSS漏洞的产生过程和代码。
182 0
Java审计之XSS篇
|
存储 安全 算法
Java:SpringBoot整合Spring Security实现认证与授权学习笔记
Java:SpringBoot整合Spring Security实现认证与授权学习笔记
698 0
Java:SpringBoot整合Spring Security实现认证与授权学习笔记