This article provides a simple positive model for preventing XSS using output escaping/encoding properly. While there are a huge number of XSS attack vectors, following a few simple rules can completely defend against this serious attack.
These rules apply to all the different varieties of XSS. Both reflected and stored XSS can be addressed by performing the appropriate escaping on the server-side. The use of an escaping/encoding library like the one in ESAPI is strongly recommended as there are many special cases. DOM Based XSS can be addressed by applying these rules on the client on untrusted data.
For a great cheatsheet on the attack vectors related to XSS, please refer to the excellent XSS Cheat Sheet by RSnake. More background on browser security and the various browsers can be found in the Browser Security Handbook.
Related Posts: On this day...
- Pakistani Actress Veena Malik schools a mullah about Islam - 2011
- What does the health care bill mean to you? - 2010
- The Story of Bottled Water - 2010
- Boob jobs banned from the next Pirates of the Caribbean - 2010
- For the traffic camera-thwarting geek: The SQL injection license plate - 2010
- Mint.com CEO Aaron Patzer says it doesn't sell individual data - 2010
- The ObamaCare health bill has PASSED - 2010
- Ever wanted to download the internet? - 2008