Google’s new CSP Evaluator tool is designed to help developers make sure that policies they use for mitigating cross-site scripting errors are effective.
Google has released a new tool called CSP Evaluator that it says can help developers ensure that the polices they use for mitigating cross-site scripting errors are effective and work as intended.Cross-site scripting errors basically let attackers inject malicious code into a web application or webpage.
Attackers often use it to insert malicious code in the HTML pages that are presented to a user visiting a website in order to infect their computers.Though cross-site scripting errors are well understood and have been around for years, they continue to be a major source of vulnerabilities in web applications.
As a result, developers often use a mechanism known as Content Security Policy (CSP) for defining and restricting the conditions under which scripts are allowed to run in an application.The idea is that even if an attacker manages to inject malicious script into a webpage, they would be limited in their ability to do harm.
“CSP is a flexible tool allowing developers to set a wide range of policies,” said Google information security engineers Artur Janc, Michele Spagnuolo, Lukas Weichselbaum and David Ross in a post on the Google Security Blog this week. Most modern browsers support CSPs, though not entirely, they noted.
However, the flexibility has its drawbacks, the Google engineers said.
Too often, developers use CSPs to set policies that only appear to work as intended but rarely do so in real life.
In an analysis that Google conducted earlier this year of more than 1 billion domains, 95 percent of the deployed CSPs offered no protection against cross-site scripting attacks, they said.The study found that even websites and domains that many organizations trust for the purpose of loading scripts were not as safe as assumed.
In fact “14 out of the 15 domains most commonly whitelisted for loading scripts contain unsafe endpoints,” the study found.Not surprisingly, nearly 76 percent of the policies that Google evaluated in its study had script whitelists that would have allowed attackers to bypass their CSPs.Google’s new CSP Evaluator aims to help address this deficiency.
It helps developers visualize how their content security policies are working and to detect minor misconfigurations.
Security engineers at Google currently use CSP Evaluator to ensure their CSPs provide meaningful benefit and cannot be bypassed by attackers, the four Google engineers said in their blog post.CSP Evaluator eliminates the need for developers to review content security policies manually and helps them harden their application against cross-site scripting attacks, Google said in an official description of the tool.
The checks that are contained in the tools are based on its study of more than 1 billion domains.CSP Evaluator is part of a broader effort by Google to get developers to adopt a stricter approach to implementing content security policy.
In addition to CSP Evaluator, the company has published new documentation on the best strategies for implementing CSP and a Chrome extension called CSP Mitigator for helping developers verify if an application is compatible with strict CSP.