SQL Injection. Cross-Site Scripting. These are just two of web application security flaws that can be prevented by effectively filtering user input. Web developers can filter user-supplied input in two ways – either by utilizing white-list or black-list input validation. Each method of input sanitization has their own pros and cons, so I will go through each of them individually.
Black-list input validation is one of the most common ways user-supplied input can be validated. The way black-list input sanitization works is pretty simple: when a list of disallowed values is created and any of those values appear in a request, the request gets blocked. However, the issue with validating user-supplied input in such a way is that web developers, especially those who are not very keen in the field of web security, are very likely to block only one or very few attack vectors which means that potential attacker would have very many options to choose from when crafting his payload. Nonetheless, there is another option – white-list input validation.
White-list input validation is very similar to black-list input validation in that it also uses values to understand which requests should be blocked, but it works in an opposite way – when using white-list input sanitization, developers provide a list of allowed values as opposed to providing only disallowed values. In most cases, white-list input sanitization is much more effective than black-list input sanitization, but in some cases, it might be very difficult to create an effective white-list filter because white-list input validation is only very effective when all good values are known.
Here’s some functions that can be useful when sanitizing input in PHP:
This blog will walk you through some lessons for conference speakers who speak remotely no…
Insecure data storage is the second vulnerability in the OWASP Mobile Top 10 list. Insecure…
The improper platform usage vulnerability is the first vulnerability in the OWASP Mobile Top 10.…
If you ever heard of web application security, you probably heard of OWASP. And if…
If you have ever built a website, chances are you took care of security. Securing…
It's November. For some developers it's just an ordinary month - for some of them…