How do I secure my web site?

Submitted by n8coder on Sat, 05/09/2009 - 04:24
  1. Brute force dedection should be enabled.
  2. Cache directories should be secured.
  3. Captcha's should be enabled and required for anonym users to avoid spam.
  4. Code Injection should be prevented.
  5. Cookies should NOT be used to store passwords and sensitive data.
  6. CSRF should be prevented.
  7. Directory listing should be disabled.
  8. File Inclusion should be prevented. Use white-list/black-list and validation model.
  9. File uploads should be enabled just for authorized users.
  10. Firewall should be enabled.
  11. FTP Uploads for anonym users should be disabled.
  12. PHP system-shell functions(system, exec, dl, shell_exec,...) should be disabled.
  13. Register Globals for PHP should be set to off.
  14. Safe mode for PHP should be on.
  15. Sessions should be used for authentication.
  16. Session Fixation should be prevented.
  17. Session hijacking should be prevented.
  18. Source Code should be hidden.
  19. SQL Injection should be prevented. Use filters or install apache-modules like modsecurity or suhosin.
  20. Temp directory should be secured.
  21. XSS should be prevented.

Read this documents for detailed information:

Submitted by Anonymous (not verified) on Sat, 05/09/2009 - 04:31


use professional applications like drupal, joomla, wordpress, phpbb, vbulletin.

use secure frameworks like zend, symfony, cakephp etc...

seperate design and code, update your core system.

follow security news, bugs etc...

use hard passwords

secure your tool-directories like phpmyadmin etc

Submitted by aaa (not verified) on Sun, 05/10/2009 - 16:26


Instead of bothering everyone with CAPTCHA you should implement something smarter.

Use bayesian filters and blacklists - there are open source projects with ready solutions. Or use Akismet/Defensio if you don't want to maintain one yourself.

For small sites there are tricks with CSS/JS that can replace CAPTCHA.

Submitted by Anonymous (not verified) on Thu, 06/04/2009 - 01:37


Amateur coders use mysql_query() and try to assemble SQL queries by hand. Quoting the parts is often forgotten, that's where the problem comes from.
Professional programmers use PARAMETERIZED SQL instead. See PDO and ? parameters.

"Filters and Apache modules" are not a solution. Obviously providing newbies with magic_quotes and other workarounds, hasn't exactly led to better understanding. As showcased here.