Proving Grounds Play : Funbox Walkthrough
Proving Grounds Play : Funbox Walkthrough
Foothold :
- Wordpress 網站透過 wpscan 獲取使用者帳號 joe
- 相關枚舉與測試等都沒有進一步發現
- 最後是透過 hydra 暴力破解 joe 的密碼
- 獲得密碼後 SSH 直接進去
PE :
- 現有 shell 是 rbash,透過 noprofile 跳脫 rbash
- 發現背景固定執行 backup.sh,且有權限對該檔案寫入
- 寫一個 root 使用者到 /etc/passwd
- su 切換使用者後成功提權
Rustscan,└─$ rustscan -a 192.168.151.77 --scripts none --ulimit 5000 | tee rustscan
snmp check
nmap,└─$ sudo nmap -sCV -A -p 21,22,80,33060 192.168.151.77 | tee nmap
測試幾組常用帳號密碼登入 FTP 失敗
MySQL 登入測試失敗
whatweb,顯示 ERROR Opening: http://funbox.fritz.box/ - no address for funbox.fritz.box
寫死 hosts file 將 funbox.fritz.box 指向到靶機再跑一次 whatweb
看來是個 WordPress 且版本是 5.4.2
先掃看看有沒有使用者,wpscan --url http://funbox.fritz.box --enumerate u
發現兩個使用者帳號 admin、joe
帶入 API Token 掃描,結果是說沒有 Plugins
80 /wp-admin 測試幾組帳號密碼都失敗
80 /robots.txt
80 /secret 沒有祕密請加油
gobuster by IP
80 /wp-trackback.php
暫時無解,改使用 Wordpress 枚舉出來的帳號做基本的帳號密碼噴灑沒有作用
改用枚舉出來的使用者名稱 joe 跑跑看 hydra,結果馬上就獲得了憑證 joe:12345
└─$ hydra -l joe -P /usr/share/wordlists/rockyou.txt ssh://192.168.151.77 -V
SSH 登入獲取第一階段 flag local.txt
home 目錄底下有個 mbox 檔案內容看來是一封 root 寫給 joe 的信
一開始提到備份的 Script 已經完成,得到另一個使用者名稱 funny
後面罵了髒話說他的密碼太過簡單了
cat /etc/passwd,兩個使用者 joe & funny
可以看到 joe 是 rbash
登出後使用 noprofile 跳脫 rbash 的限制
└─$ ssh joe@192.168.151.77 -t "bash --noprofile"
cat /etc/passwd,兩個使用者 joe、funny
sudo -l
SUID check
在 funny 的 Home 目錄看到 backup.sh 內容看來是執行備份沒錯
另外一個 .reminder.sh 可以看到叫 joe 測試備份執行檔與告知網站管理員是 Ted
pspy64 發現每分鐘會執行 backup.sh
可以看到 joe 對 backup.sh 有 write 的權限
寫一個 root 使用者 aries 密碼 Oscp#1234 到 .backup.sh 叫他去更新 /etc/passwd 檔案
等一段時間後寫進去了
su 切換使用者,成功提權為 root,獲取第二階段 flag
留言
張貼留言