I just starting out learning PHP, I've been developing web apps in ASP.Net for a long time. I was wondering if there are any PHP specific security mistakes that I should be looking out for.
So, my question is what are the top security tips that every PHP developer should know?
Please keep it to one tip per answer so people can vote up/down effectively.
Always use POST and not GET for important Data...
Avoid using register_globals.
is_uploaded_file()
to validate that a file was uploaded andmove_uploaded_file()
instead ofcopy()
orrename()
.OWASP provides a lot of insight into security issues that are the biggest problems in applications today. It is nice to see that they have a PHP dedicated page available
http://www.owasp.org/index.php/PHP_Top_5
don't use "Register Global Variables" and filter user input for xss and injections
Have a look at the Suhosin Hardening Patch, and check out the security vulnerabilities that it addresses.