Categories
Posts

PHP Security

Code security is one of those things that we need to have regular reminders about. This reminder is for PHP, but several of the issues apply to any language – Survive The Deep End: PHP Security.

The “Basic Security Thinking” section has a good general list of principles:

  1. Trust nobody and nothing
  2. Assume a worse-case scenario
  3. Apply Defense-In-Depth
  4. Keep It Simple Stupid (KISS)
  5. Principle of Least Privilege
  6. Attackers can smell obscurity
  7. RTFM but never trust it
  8. If it wasn’t tested, it doesn’t work
  9. It’s always your fault!

Personally I’d replace “Attackers can smell obscurity” with “Never underestimate the amount of time or resources your attacker has”, but the overall list still gets you in the right frame of mind.

If you deal with PHP code the rest of the document is definitely worth the time to read.