As a security researcher, I regularly come across software applications that are susceptible to a few basic types of attacks – and I struggle to understand how these can continue to slip through each phase of development and into production. There are a handful of vulnerabilities that fit into this group; cross-site scripting (XSS) being one of them – and we find them in just about every application we test.
Anything that can render HTML or includes a web interface is potentially vulnerable including mobile devices and desktop applications. When the script is stored in a database it becomes persistent, which is far worse because the same attack can be used for any user that browses to the site.
Below are common mistakes that organizations make that leave their applications vulnerable to attack. Be sure they don’t exist in yours.
- Failure to use whitelist validation before it is processed by the application.
- Trusting data retrieved from any database or other data source
- Failing to encode any remotely provided data, including reverse DNS lookup, cookie contents, uploaded files, etc.
- Improperly converting "safe" tags to HTML.
- Displaying user input directly without encoding it appropriately for the context in which it is used.
- Checking user submitted data against a blacklist instead of a whitelist.
In my next blog entry, I’ll talk about how to properly use Input validation to prevent XSS flaws.