PHP Trailing Slash "open_basedir" Security Bypass

PHP には、php.ini の open_basedir を設定して PHP スクリプトを動作させるディレクトリを制限する機能がありますが、その制限を回避されてしまう場合があることが報告されています。

Secunia の例では、/home/user1/ でのみ PHP を動作させるつもりで以下のように設定していた場合、

open_basedir = /home/user1/

/home/user11/, /home/user12/, ... などの前方が /home/user1 と一致するパス名を持つ全てのディレクトリで PHP スクリプトが動作します。/home/user2/ など、1文字でも違いがある場合は問題はありません。

open_basedir を使用して PHP の動作を制限している場合は問題が起きないか確認した方が良いかもしれません。この問題は PHP 4.4.0 や PHP 5.0.4 でも確認されているそうです。


PHP Trailing Slash "open_basedir" Security Bypass(Secunia)
http://secunia.com/advisories/16971/

Bug #32937 PHP don't respect trailing slashes in open_basedir(bugs.php.net)
http://bugs.php.net/bug.php?id=32937

libapache2-mod-php4 - open_basedir bug - security(Debian Bug report)
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=323585

PHP Variable Tests

PHP で変数の扱いをまとめた非常に便利な表です。
PHP 4.2.2 以降のバージョン間でこの結果と違いがないかを確認してみましたが、特に問題ないようです。ただし、PHP 5.1RC1 では ctype_*() 関数での空文字列("")の扱いに変更があったようで、少しだけ違いがありました。

PHP Variable Tests
http://www.deformedweb.co.uk/php_variable_tests.php

PDV - phpDocumentor for Vim : Provides really comfortable generation of phpDocumentor doc blocks for PHP4 & 5.

phpDocumentor 用のコメントを自動生成してくれる Vim プラグインです。
http://www.vim.org/scripts/script.php?script_id=1355&rating=life_changing