おぎろぐはてブロ

なんだかんだエンジニアになって10年以上

PHP Security Tips #1〜#7

Zend Developer Zoneで、PHP Security Tipsというのが連載されはじめた。現時点で#7まで。

  • PHP Security Tip #1
    • PHPのバージョンを最新に保とう
  • PHP Security Tip #2
    • あなたのサイトについて、エラーを表示させていないことと、潜在的に情報を漏らしていないかを確認しよう
    • Simply setting display_errors = Off in your php.ini of your production server will prevent you from leaking information that may give intruders hints to the structure of your system. By default, display_errors = On.
  • PHP Security Tip #3
    • Since your application may be harboring security vulnerabilities that you have not been exposed to, third-party security software or services should be considered to help bring a fresh perspective and find overlooked weaknesses.
  • PHP Security Tip #4
    • 重要な情報を含むファイルやフォルダは、デフォルトの名前を利用しない
  • PHP Security Tip #5
    • ユーザを信頼するな
    • 入力をフィルタし、出力をエスケープする
  • PHP Security Tip #6
    • 数字をSQLクエリで扱う際は、常にキャストする
  • PHP Security Tip #7
    • session fixation(セッション固定)攻撃対策となるsession_regenerate_id()の利用方法について
    • [補足] session fixationについては、PHPのSession Fixation問題 – yohgaki's blogを参考にすると分かりやすいと思います

軽い内容だけれど、積み重ねていくのが大事かも。