Your First 10 PHP Security Rules. Don’t Break Them.Best Security Tips offers daily news, information, advices and tips about spyware, adware, viruses, trojans, web vulnerabilities, hackers, other threats    | Register now | Login
   
TIPS NEWS TOOLS DOWNLOADS MALWARE FORUM BOOKS FREE MAGAZINES FREE WEBCASTS & VIDEOS
GFI LANguard Network Security Scanner - Dld 30-day trial! del.icio.us  digg  Furl  NewsVine  Spurl  Blinklist  Ma.gnolia  Reddit  Tailrank  YahooMyWeb 
Best Tips
Security Scanner
Security Categories
Advertise With Us!
Latest Viruses / Threats
2008/8/20 3:43:07
2008/8/20 3:43:07
2008/8/20 3:43:07
2008/8/20 0:00:00
2008/8/19 18:16:23
Downloads
RSS / Atom Feeds
Web Security : Your First 10 PHP Security Rules. Don’t Break Them.
Posted by Max on 2007/3/10 0:24:54 (946 reads)
Web Security

No matter what PHP project you start, you should always code with security in mind. There alre lots of PHP security tips out there  but here is your first  Top 10 PHP Web Application Security Rules you should never break.


Most application security vulnerabilities apply to PHP applications just like other environments. You can write robust, secure and fast web applications using PHP as long as you use a few basic security coding standards. Here are the first 10 Rules you should never break.


1. Use HTML_Safe (or a similar javascript stripping library) to check for and remove javascript when you’re accepting data that will be output to a page.

2. Check every $_SERVER['GET'] and $_SERVER['POST'] variable for validity.Every web site has url like “dosomething.php?id=3″. Make sure that id you’re accepting is actually a number (or whatever type you’re allowing).

3. Escape strings before sending to the database. Not doing so leaves you wide open to SQL injection.

4. Make sure display_errors, magic_quotes, and register globals are all off. Log the errors to the error_log instead.

5. Update often. If you have root access, don’t fall to far behind in stable releases. Bugs are fixed all the time.

6. Do not blindly send mail to the address entered in a form. It’s easy for someone to perform header injection and spam thousands of people before you’ll even notice.

7. Use a firewall/iptables. Turn off all ports you aren’t using.Especially mysql's 3306 TCP port.

8. Cookies can be abused. Do not write any sensitive data to a cookie. I thought this was obvious but I’ve seen it enough where I throw it in the list.

9. Mind the robots. Don’t put senstive directories in robots.txt as your only security. Instead, use passwords to  protect your admin areas.

10. Backup your stuff offsite. Have the offsite computer connect to the server to download the backup, not the other way around.




Other articles
2008/8/13 16:42:03 - 10 Million Zombies Are Spreading Spam and Malware Every Day
2008/8/11 9:03:35 - Nearly $8.5 Billion Lost by US Consumers because of Online Threats
2008/8/8 6:35:36 - EDS' Eight Tips for Consumers to Protect Themselves from Identity Theft
2008/8/4 11:16:32 - NovaShield, Inc. Launches NovaShield AntiMalware Version 2.0 With 90-Day Free Trial
2008/8/3 4:35:31 - Full P2P Anonymity using Torrent Privacy

The comments are owned by the poster. We aren't responsible for their content.

Poster Thread
Max
Posted: 2007/3/11 11:10  Updated: 2007/3/11 11:10
Home away from home
Joined: 2006/9/29
From:
Posts: 624
 Re: Your First 10 PHP Security Rules. Don’t Break Them.
In addition to this list, don't forget to check the PHP Security Guide