Footprinting Lab

November 4, 2025 September 23, 2025 Medium
Author Author Hung Nguyen Tuong

Initial Reconnaissance

Mục tiêu là chúng ta cần phải tìm được password của user:

HTB

Service Scanning

┌──(kali㉿hungnt-desktop)-[~]
└─$ rustscan -a 10.129.202.41 -- -sV -sC

PORT      STATE SERVICE       REASON          VERSION
111/tcp   open  rpcbind       syn-ack ttl 127 2-4 (RPC #100000)
| rpcinfo:
|   program version    port/proto  service
|   100000  2,3,4        111/tcp   rpcbind
|   100000  2,3,4        111/tcp6  rpcbind
|   100000  2,3,4        111/udp   rpcbind
|   100000  2,3,4        111/udp6  rpcbind
|   100003  2,3         2049/udp   nfs
|   100003  2,3         2049/udp6  nfs
|   100003  2,3,4       2049/tcp   nfs
|   100003  2,3,4       2049/tcp6  nfs
|   100005  1,2,3       2049/tcp   mountd
|   100005  1,2,3       2049/tcp6  mountd
|   100005  1,2,3       2049/udp   mountd
|   100005  1,2,3       2049/udp6  mountd
|   100021  1,2,3,4     2049/tcp   nlockmgr
|   100021  1,2,3,4     2049/tcp6  nlockmgr
|   100021  1,2,3,4     2049/udp   nlockmgr
|   100021  1,2,3,4     2049/udp6  nlockmgr
|   100024  1           2049/tcp   status
|   100024  1           2049/tcp6  status
|   100024  1           2049/udp   status
|_  100024  1           2049/udp6  status
135/tcp   open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
139/tcp   open  netbios-ssn   syn-ack ttl 127 Microsoft Windows netbios-ssn
445/tcp   open  microsoft-ds? syn-ack ttl 127
2049/tcp  open  nlockmgr      syn-ack ttl 127 1-4 (RPC #100021)
3389/tcp  open  ms-wbt-server syn-ack ttl 127 Microsoft Terminal Services
| ssl-cert: Subject: commonName=WINMEDIUM
| Issuer: commonName=WINMEDIUM
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2025-09-22T06:38:59
| Not valid after:  2026-03-24T06:38:59
| MD5:   c3d7:697a:2b82:2745:8027:4781:e53e:da4f
| SHA-1: 6d6d:0a49:1c9b:94ca:e6da:9474:7180:5b58:eb10:c395
...
|_ssl-date: 2025-09-23T07:41:48+00:00; 0s from scanner time.
| rdp-ntlm-info:
|   Target_Name: WINMEDIUM
|   NetBIOS_Domain_Name: WINMEDIUM
|   NetBIOS_Computer_Name: WINMEDIUM
|   DNS_Domain_Name: WINMEDIUM
|   DNS_Computer_Name: WINMEDIUM
|   Product_Version: 10.0.17763
|_  System_Time: 2025-09-23T07:41:39+00:00
5985/tcp  open  http          syn-ack ttl 127 Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
47001/tcp open  http          syn-ack ttl 127 Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
49664/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
49665/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
49666/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
49667/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
49668/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
49679/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
49680/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
49681/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

Chúng ta thấy target đang chạy các dịch vụ như SMB, NFS, RDP và WinRM.

SMB 135,139,445

Chúng ta enumerate SMB server với null session, hoặc với user anonymous hoặc guest:

image

image

image

Tuy nhiên, các username này đều không được phép kết nối.

NFS 2049

┌──(hungnt㉿kali)-[~/Documents]
└─$ showmount -e 10.129.202.41
Export list for 10.129.202.41:
/TechSupport (everyone)

Ta phát hiện một thư mục được share qua NFS, và bởi vì là (everyone) nên bất kỳ host nào cũng có thể mount được share này.

┌──(hungnt㉿kali)-[/]
└─$ sudo mount -t nfs 10.129.202.41:/ /mnt -o nolock
[sudo] password for hungnt: 

┌──(hungnt㉿kali)-[/]
└─$ cd mnt

┌──(hungnt㉿kali)-[/mnt]
└─$ ls
TechSupport

┌──(hungnt㉿kali)-[/mnt]
└─$ cd TechSupport/
bash: cd: TechSupport/: Permission denied

Có vẻ như thư mục này yêu cầu quyền root để có thể truy cập:

┌──(hungnt㉿kali)-[/mnt]
└─$ sudo su                                                                                                 
┌──(root㉿kali)-[/mnt]
└─# cd TechSupport

image

Tại đây chúng ta phát hiện ra một ticket được gửi từ alex đến Operator.

┌──(root㉿kali)-[/mnt/TechSupport]
└─# cat ticket4238791283782.txt
Conversation with InlaneFreight Ltd

Started on November 10, 2021 at 01:27 PM London time GMT (GMT+0200)
---
01:27 PM | Operator: Hello,. 
 
So what brings you here today?
01:27 PM | alex: hello
01:27 PM | Operator: Hey alex!
01:27 PM | Operator: What do you need help with?
01:36 PM | alex: I run into an issue with the web config file on the system for the smtp server. do you mind to take a look at the config?
01:38 PM | Operator: Of course
01:42 PM | alex: here it is:

 1smtp {
 2    host=smtp.web.dev.inlanefreight.htb
 3    #port=25
 4    ssl=true
 5    user="alex"
 6    password="lol123!mD"
 7    from="alex.g@web.dev.inlanefreight.htb"
 8}
 9
10securesocial {
11    
12    onLoginGoTo=/
13    onLogoutGoTo=/login
14    ssl=false
15    
16    userpass {      
17      withUserNameSupport=false
18      sendWelcomeEmail=true
19      enableGravatarSupport=true
20      signupSkipLogin=true
21      tokenDuration=60
22      tokenDeleteInterval=5
23      minimumPasswordLength=8
24      enableTokenJob=true
25      hasher=bcrypt
26      }
27
28     cookie {
29     #       name=id
30     #       path=/login
31     #       domain="10.129.2.59:9500"
32            httpOnly=true
33            makeTransient=false
34            absoluteTimeoutInMinutes=1440
35            idleTimeoutInMinutes=1440
36    }

Tại đây, chúng ta xác định được username và password của alex cho dịch vụ SMTP. Có thể dịch vụ này được mở trong mạng nội bộ, nên ta không thấy trong kết quả scan từ Nmap.

SMB 135,139,445 (authenticated as alex)

Bây giờ, ta sẽ thử liệt kê share trên SMB server với tài khoản của alex:

image

Ta thấy share devshare cho phép cả quyền đọc và ghi, bên cạnh đó là share Users chỉ cho phép quyền đọc.

┌──(hungnt㉿kali)-[~/Desktop]
└─$ smbclient -U alex \\\\10.129.202.41\\devshare
Password for [WORKGROUP\alex]:lol123!mD
Try "help" to get a list of possible commands.
smb: \> ls
  .                                   D        0  Wed Sep 24 12:41:08 2025
  ..                                  D        0  Wed Sep 24 12:41:08 2025
  important.txt                       A       16  Wed Nov 10 23:12:55 2021

                6367231 blocks of size 4096. 2592194 blocks available
smb: \> get important.txt
getting file \important.txt of size 16 as important.txt (0.0 KiloBytes/sec) (average 0.0 KiloBytes/sec)
smb: \> !cat important.txt
sa:87N1ns@slls83

Tại đây có chứa một file tên là important.txt, và file này đưa cho ta một credentials tại dịch vụ nào đó.

┌──(hungnt㉿kali)-[~/Documents]
└─$ smbclient -U alex \\\\10.129.202.41\\Users                              Password for [WORKGROUP\alex]:

Ta có thể tiếp tục enumerate share Users nhưng tại đây không cung cấp thêm thông tin gì hữu ích.

┌──(hungnt㉿kali)-[~/Documents]
└─$ enum4linux -u alex -p 'lol123!mD' -a 10.129.202.41

Ta có thể thử liệt kê share với credentials mới tìm được, nhưng có vẻ như credentials này không hợp lệ.

image

WinRM 5985

Chúng ta thử sử dụng evil-winrm để mở remote shell đến target với các credentials ở trên, nhưng cũng không có kết quả gì.

image

RDP 3389

Tiếp theo, chúng ta thử RDP đến target:

image

Ở đây, tài khoản sa là không hợp lệ.

image

Với tài khoản của alex, chúng ta thành công RDP đến máy target.

RDP as alex

image

Tại đây, chúng ta truy cập vào MSSQL Server và được yêu cầu đăng nhập với login là sa đã được điền sẵn.

image

Ta thử password tìm được trước đó nhưng không xác thực được để kết nối đến WINMEDIUM.

image

MSSQL Server as Administrator

Chúng ta phát hiện ra rằng password của Administrator cũng chính là password thuộc về sa:

image

image

Bây giờ, chúng ta hãy chạy MSSQL Server với quyền của administrator:

image

Khi đó, ta có thể sử dụng phương pháp xác thực là Windows Authentication với username đã được đặt mặc định là Administator:

image

Để lấy được password của user HTB, ta sẽ trích xuất từ table dbo.devsacc trong database accounts:

image