HTML5 : Cross-Site Scripting Protection
Summary
X-XSS-Protection HTTP response header enables developers and security architects to manage browser protection against reflected cross-site scripting. The mechanism is also known as the XSS Auditor in Chrome and the XSS filter in Internet Explorer. In modern browsers, the Content-SecurityPolicy header can provide better protection against XSS and setting X-XSS-Protection might be redundant. However, this header can reduce the risk of reflected XSS attacks in earlier browsers that do not support CSP.
This header can be set to one of three possible values: 0 , 1 , or 1 ; mode=block . A value of 0 disables the protection. A value of 1 is the default behaviour in modern browsers that enables the protection in filter or replacement mode. For example, IE replaces JavaScript keywords such as <script> with <scr#pt> to render injected string ineffective. The value of 1 ; mode=block instructs browsers to block the response from rendering in the browser. Reports of multiple exploits that leverage false positives from default behaviour that filters or replaces JavaScript injection string within the response r eturned from server. Therefore, the current recommendation is to set the header in block mode.
Explanation
Attackers may leverage zero day reflective XSS against a site. If the header is not set in block mode, an attacker can use browser-specific filter bypass bugs to succeed in launching a reflected XSS against the site.
Execution
Click the response tab for the highlighted request. The response header X-XSS-Protection is either missing or set to 1 .
By default, WebInspect flags only one instance of this vulnerability per host because it is typical to set this header at the host level in a server configuration.
Perform the following steps to flag all instances of this issue:
Create a new policy with the selection of checks that you want to include in a rescan. We recommend using the Blank or Passive policy as a base.
Select this check and unselect the check input, “FlagAtHost”,from standard description window.
Save the policy.
Rescan with this new custom policy.
Recommendation
Add a configuration setting or a line of code that adds a response header or tag to set X-XSSProtection with the value ‘ 1 ; mode=block ’
Correct configuration Example:

Comments
Post a Comment