標籤:
1 命令執行
PHP中可以使用下列函數來執行外部的應用程式或函數
system 、exec 、passthru、shell_exec、popen
system函數原型
string system(string $command [, int &$return_var ] )
參數:
command
-
要執行的命令。
-
return_var
-
如果提供 return_var 參數, 則外部命令執行後的返回狀態將會被設定到此變數中
傳回值:
成功則返回命令輸出的最後一行, 失敗則返回 FALSE
exec函數原型
passthru函數原型
shell_exec函數原型
popen函數原型
system漏洞執行個體(Windows環境)
<?phpprint("Please specify the name of the dir to print");print("<p>");$dirname=$_GET[‘dirname‘];$rest=system("dir $dirname",$return_var);?>
請求:
http://127.0.0.1/syscommad.php?dirname=c:\
響應:
Please specify the name of the dir to print?????? C ?е??û?б???? ???????к??? C038-3181 c:\ ???¼ 2016/06/23 16:41 1,024 .rnd 2015/12/03 01:39 burpsuitev1.6.24 2015/08/30 10:30 Drivers 2015/09/22 14:27 IDAPro6.6 2016/06/08 12:24 IDA_Pro_v6.8_Green 2016/04/21 18:07 java 2016/06/14 21:31 masm32 2016/06/27 15:55 metasploit 2009/07/14 11:20
PHP安全性漏洞