Fixing XSS: A practical guide for developers

Source: Internet
Author: User

I'm happy to announce a new document we just made available: Fixing XSS: a practical guide for developers. if you're currently at the RSA conference, you should come to Coverity's booth (#1759) and either get a hardcopy or a USB stick with this document on it.
 
As the title suggests, this document is a guide for developers on how to handle dynamic data in various locations and common constructs in HTML. we leveraged the data we got from our research for our talk at RSA to come up with some of the most common HTML contexts and nested contexts, and improved the Coverity Security Library to have a solution for all of these cases.
 
Looking at the documentation available for XSS, several things strikes us:
1. It's often talking about how to exploit an XSS and not how to fix this issue
2. The HTML contexts information is always lacking precision and often makes the documentation complex to read (we're also guilty of this in some previous blog posts)
3. The fixes are limited or too restrictive (I. e., not applicable for developers)
That's mostly why we decided to create our own document mostly for developers.
 
The first release of this document contains13 common HTML constructs, And we plan on adding more to it. we also describe what HTML contexts are and why it's important to think about them when outputting dynamic data in a web page. however, we're also thinking to create a collateral that gives more complete information about HTML contexts and why it matters for XSS.
 
In this document, you can perform CT to learn what happens when you want to add dynamic data in a HTML context such as HTML snippet inside a JavaScript string such:
1. <div id = "forMyContent"> </div>
2. <script>
3.VarFoo = "

4. $ ("# forMyContent ")
5. html (foo );
6. </script> and why you need to first use an HTML escaper, then a JavaScript string escaper.
 
You'll also see the usage of a newly introduce function asUrl from CSL that helps writing fully dynamic URLs inside an HTML attribute such:
1. <a href = "$ {cov: htmlEscape (cov: asURL (content)}">
2. Click me
3. </a>
The current document uses the Java Expression Language (EL) notation to show the dynamic data (here $ {content}), but all functions are also available directly from Java when using CSL.
 
Whether you develop web applications, have developers, or do security review, you shocould read and share this document. We're re also happy to receive any feedback to keep improving this document.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.