iT邦幫忙

2025 iThome 鐵人賽

DAY 4
0

今天開始,我將會一天打一台靶機,並將我的滲透思路記下來
第一台我選了 PG Play 的 Moneybox 這一台靶機
這一台無論是在 Offsec Offical 跟 Community 裡面都是 Easy 難度
相信應該不會太難 xD
那接下來就連上 VPN 並且啟動靶機,準備練習吧!

Recon

Recon (Reconnaissance) 翻譯過來是偵查的意思
所以我們要針對這台靶機進行偵查
最常就是一言不合就 nmaprustscan 開掃 port
我最常使用的就是

rustscan -a <target-ip> --ulimit 5000 -- -sC -sV -o scan_result.txt
  • -a 代表 rustscan 要掃的目標
  • --ulimit 原先設計用意是限制單一 Process 可佔用的系統資源數量。但現在電腦效能優越,使用 RustScan 若不修正 ulimit 數值,而 Linux 預設的 soft limit 太低(預設為 1024)時,則會導致 RustScan 發揮不出原本應有的速度。引自 hack543
  • -- 之後接的就是 nmap 的參數
  • -sC 代表要執行 Default 類型的 NSE Script,而 Default 類型的 NSE Script 通常以資訊蒐集為主,較不具破壞性。引自 hack543
  • -sV 代表輸出服務詳細版本。
  • -o 代表輸出到某某檔案。

接著就是看看報告,有掃到些什麼

# Nmap 7.95 scan initiated Thu Sep 18 00:47:52 2025 as: /usr/lib/nmap/nmap --privileged -vvv -p 21,22,80 -4 -sC -sV -o scan_result.txt 192.168.110.230
Nmap scan report for 192.168.110.230
Host is up, received echo-reply ttl 61 (0.074s latency).
Scanned at 2025-09-18 00:47:53 EDT for 10s

PORT   STATE SERVICE REASON         VERSION
21/tcp open  ftp     syn-ack ttl 61 vsftpd 3.0.3
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_-rw-r--r--    1 0        0         1093656 Feb 26  2021 trytofind.jpg
| ftp-syst: 
|   STAT: 
| FTP server status:
|      Connected to ::ffff:192.168.45.229
|      Logged in as ftp
|      TYPE: ASCII
|      No session bandwidth limit
|      Session timeout in seconds is 300
|      Control connection is plain text
|      Data connections will be plain text
|      At session startup, client count was 3
|      vsFTPd 3.0.3 - secure, fast, stable
|_End of status
22/tcp open  ssh     syn-ack ttl 61 OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey: 
|   2048 1e:30:ce:72:81:e0:a2:3d:5c:28:88:8b:12:ac:fa:ac (RSA)
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCWBZjFZOMKU5jDBL6SwW+89IV0wojGRFPnrSIyxVOp/N7sNSln6NttNOQu1gsC4Sp7WziJ+hL5Map7t7YWJ9Rj9lvcaQU48aTtTzEsL5T991Wm3ZNvZjS0yhSL9Scf6VGxoO0EGqV+z3Z1OMKU609bm8PLoNaxfNXl2zDRdyrAN3VBT4jp8zlgfaT0W4kKQJ9u77IiHXBOU+6JrBg1b4F9x/wYT6zXxtGjH3tJTF8g4E6Da2eHOWsq3ERd40M+Oi1v4Du3+bQRd3Z4KVDOQ1utmdyFI+HcrGxjIPqqRAP0h2PLLm4qh/QZBvPO8cAPUdduLLeqmFGn/qg/FP08nBgZ
|   256 01:9d:fa:fb:f2:06:37:c0:12:fc:01:8b:24:8f:53:ae (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC8xP+l2BvuK5pg2bEpcDV1GAoAI3kIpMznpUyfOJS29SF9N2XyYV1eEcvf0O8exXyxCs+RjVbk+8cxBs8K36CU=
|   256 2f:34:b3:d0:74:b4:7f:8d:17:d2:37:b1:2e:32:f7:eb (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ92TDnimudy2EtcS6I1ja1fGn+OBm3z2/8rxwcZknEH
80/tcp open  http    syn-ack ttl 61 Apache httpd 2.4.38 ((Debian))
| http-methods: 
|_  Supported Methods: POST OPTIONS HEAD GET
|_http-server-header: Apache/2.4.38 (Debian)
|_http-title: MoneyBox
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

Read data files from: /usr/share/nmap
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Thu Sep 18 00:48:03 2025 -- 1 IP address (1 host up) scanned in 10.71 seconds

看得很頭昏對吧?我也覺得
所以平常我只有看他開了什麼服務
從上面可見,他開了ftpsshhttp service
那接下來就是要列舉出來攻擊方法

列舉

從上面的報告可以知道以下的資訊

- ftp
    - vsftpd 3.0.3
    - Anonymous FTP login allowed
    - 有一個`trytofind.jpg`檔案
- ssh  
    - OpenSSH 7.9p1 Debian 10+deb10u2
    - 支援 RSA、ECDSA、ED25519
- http
    - Apache 2.4.38
    - Supported Methods: POST, OPTIONS, HEAD, GET
    - http-title: MoneyBox

我們有這三個方向去嘗試滲透這一台靶機

試錯

ftp

首先就從FTP service 開始吧!
先把trytofind.jpg抓下來
結果...
cat
是一隻貓貓 xD 看起來沒什麼用,那只能繼續看看其他的服務
接下來看看 http 吧!

http

結果只有這樣:
index
這不可能!一定要接著做點什麼
試著用dirsearch掃掃看目錄,發現:
image1
有 blog dir 就輸入進去網址,網址內容變為

I'm T0m-H4ck3r

I Already Hacked This Box and Informed.But They didn't Do any Security configuration

If You Want Hint For Next Step......?

打開 F12 發現,有 Hint:<!-- the hint is the another secret directory is S3cr3t-T3xt -->
就把路徑換成http://<ip>:<port>/S3cr3t-T3xt
結果網頁內容變成

There is Nothing In this Page.........

再打開 F12 ! 就發現了:..Secret Key ...
這樣就知道了 secret ,但目標是滲透機器,不只有取得 secret 而已


這時候先整合目前的線索

  • 一張貓貓圖片
  • 一個 secret
  • 無法登入的 ssh
  • 匿名登入的 ftp

會不會那張圖片有東西?
這時候就是用隱寫工具把它解出來看看

steghide extract -sf trytofind.jpg

他要我們輸入密碼,我們輸入 secret
之後就會有一個 data.txt
裡面的內容是:

Hello.....  renu

      I tell you something Important.Your Password is too Week So Change Your Password
Don't Underestimate it.......

這樣目前得到了 username: renu
之後可以利用爆破工具進行嘗試弱密碼爆破

hydra -l renu -P /usr/share/wordlists/rockyou.txt ssh://192.168.110.230:22

接著就有結果:
crack_result
就可以使用 ssh 登入 renu:987654321

提權

看看有沒有其他使用者
結果在 /home 底下發現了 lily 的這個使用者
看看他家目錄下有沒有一些東西
結果有 ssh 的認證金鑰,直接複製下來就可以 ssh 登入 lily 了
之後進行 sudo -l ,有可以執行的指令,之後去 GTFOBins 翻翻有沒有
有就直接用,就可以 GET root Shell 了!

今天的學習內容

  • 滲透思路
    • 利用一些隱藏內容獲得的資訊來取得進入靶機的門票
    • 再利用檔案管理權限不當,來獲得進一步權限
    • 之後再利用 sudo 管理不當來提權成 root

上一篇
Day 03. Proving Ground ??
系列文
滲透測試 30 天:從基礎到實戰4
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言