Softpedia
 

NEWS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
Home > News > Security > Security Fixes and Improvements

June 24th, 2009, 11:50 GMT · By

New Mozilla Technology to Mitigate Cross-Site Scripting

SHARE:

Adjust text size:


Mozilla promotes Content Security Policy (CSP) to tackle the XSS problem
Enlarge picture
Security engineers from Mozilla want to tackle cross-site scripting attacks with a new technology they call the Content Security Policy (CSP). This new specification would allow websites to set directives that enforce certain restrictions over what content the CSP-aware browsers trust.

Cross-site scripting, also known as XSS, are the most common vulnerabilities on the web today. By exploiting XSS weaknesses, attackers can inject rogue code, such as IFrames, into websites.

Rogue IFrames are notorious for being used to attack visitors, by serving malware or by executing exploits hosted on third-party servers. Even the largest and most security-aware websites have been compromised in this way during the past several years, showing that the programming mistakes that generate these XSS holes, like poor input validation, can't easily be prevented.

Mozilla proposes another approach, which would allow websites to protect their visitors even if they get compromised. "Content Security Policy (CSP) provides a mechanism for sites to explicitly tell the browser which content is legitimate. The browser can then disregard any content which has not been blessed by the site," Brandon Sterne, Mozilla's security program manager, explains.

In terms of legitimate JavaScript code, it implies two rather dramatic restrictions, compared with the way websites function today. The first one implies that only JavaScript code loaded from an external file is to be trusted by browsers. This would render the inline scripting, specific to XSS attacks, ineffective. The second restriction goes even further and allows websites to actually specify the trusted hosts from where JavaScript can be loaded.

The Mozilla security engineers say that, after analyzing multiple samples and scenarios, they could not find any case in which legit JavaScript could not be migrated out of the pages and into separate files. According to them, this is also consistent with "the programming paradigm 'don’t mix code with content' so there may be additional functional benefits to be gained by implementing such separation."

However, they realize that this is a drastic change that would imply implementation costs, especially for large websites. Because of this, they propose a gradual adoption, as CSP has many other useful directives that can be easily enforced to block certain script injection attack vectors, until all the JavaScript code is moved to external files.

CSP features can also be used to mitigate clickjacking (UI redressing) or packet sniffing attacks, but mitigation is not the only benefit of this new technology. A directive called report-uri can tell CSP-enabled browsers where to report the policy violations they encounter on the website. This means that webmasters can easily and quickly be alerted about rogue injected code in their pages by the website's own visitors.

Mozilla plans to start implementing this new, but backward compatible, technology in future Firefox nightly builds. "Content Security Policy has been a collaboration of many individuals and has received input from multiple web sites, browser vendors, and web app security researchers. We are very excited to have reached a level of stability in the design that has allowed us to begin implementation of the CSP specification," Brandon Sterne notes.

TELL US WHAT YOU THINK:

2,429 hits · 1 comment · Link to this article · Print article · Send to friend · Subscribe to news

MUST-READ RELATED ARTICLES:


MSN Canada Website Compromised by Hackers

StrongWebmail Hacking Contest Winners Officially Recognized

Multiple Visa Websites XSSed

Browser Vulnerability Opens Door to New Phishing Techniques

Clickjacking Attack Launched on Twitter

READER COMMENTS:


Comment #1 by: Eric on 24 Jun 2009, 20:11 UTC reply to this comment

This sounds like a great idea...Mozilla is always aggressively finding ways to improve security on the browser side. But that in and of itself is a problem, because Mozilla is just one browser. If their CSP system were a standard implemented across all browsers, then maybe it would be worth pouring through dozens or hundreds of pages to revise JavaScript implementation.

Yes, inline JavaScript is "bad" according to the "don't mix code and content" principle. But theory is different from reality; Softpedia being just one example of a legit website using inline JavaScript.

In short, this will never become bigger than a handful of websites that don't find the cost to implement too painful. But still, that handful of more secure websites isn't a bad thing, and maybe it will start a trend that at leasts encourages developers to be conscious of XSS before development instead of as an afterthought.

Copyright © 2001-2012 Softpedia. Contact/Tip us at

WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM