★TryHackMe★【Pickle Rick】
「Pickle Rick」を攻略してみました。
「リックがピクルスから人間に戻るための薬を作る為、3つの材料を見つける必要があります」との事です。何か面白そうなアニメですね。
Nmap
まずNmapでターゲットのサービスバージョンを特定し、標準スクリプトを実行し、詳細な出力を表示させます。
nmap -sV -sC -v
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.11 (Ubuntu Linux; protocol 2.0)
80/tcp open http Apache httpd 2.4.41 ((Ubuntu))
| http-methods:
|_ Supported Methods: HEAD GET POST OPTIONS
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Rick is sup4r cool
MAC Address: 02:21:03:98:A8:E9 (Unknown)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
開いているポート22(SSH)と80(http)が判明しましたので、ブラウザに移動してみます。
ページソースを見てみます。
<!DOCTYPE html>
<html lang="en">
<head>
<title>Rick is sup4r cool</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/bootstrap.min.css">
<script src="assets/jquery.min.js"></script>
<script src="assets/bootstrap.min.js"></script>
<style>
.jumbotron {
background-image: url("assets/rickandmorty.jpeg");
background-size: cover;
height: 340px;
}
</style>
</head>
<body>
<div class="container">
<div class="jumbotron"></div>
<h1>Help Morty!</h1></br>
<p>Listen Morty... I need your help, I've turned myself into a pickle again and this time I can't change back!</p></br>
<p>I need you to <b>*BURRRP*</b>....Morty, logon to my computer and find the last three secret ingredients to finish my pickle-reverse potion. The only problem is,
I have no idea what the <b>*BURRRRRRRRP*</b>, password was! Help Morty, Help!</p></br>
</div>
<!--
Note to self, remember username!
Username: R1ckRul3s
-->
</body>
</html>
Username:R1ckRul3s と記述がありましたので、メモしておきます。
Gobuster
次の手がかりを見つけるために、Gobusterでディレクトリやファイルのスキャンを試してみます。
gobuster dir -u 10.10.99.172 -w /usr/share/dirb/wordlists/common.txt -x html,php,txt
/robots.txt がありますので見てみると、Passwordらしき文字列がありましたので、メモしておきます。
次に/login.phpを見てみると、UsernameとPasswordの入力欄がありますので、メモしておいた
Username:R1ckRul3s、Password:Wubbalubbadubdub を試すとログインできました。
ログイン後のページソースを確認してみると、暗号化されたような文字列がありました。
これをCyberChefで7回From Base64して解読を試みると、rabbit hole と出ました。
つまり引っ掛けでしたね、、、気を取り直して見てみると、入力欄にCommand入力できそうなので、どの言語でページ作成されているかを確認すると、phpで結果が表示されました。
Reverse Shell
ターゲットからの接続を待ち受けて確立してみます。リバースシェルはファイアウォールがある場合でも、内部から外部への通信は通常許可されていることが多いため、リモートアクセスを取得できるという特徴があります。
nc -nvlp 1234
接続できました。早速lsでSup3rS3cretPickl3Ingred.txtというtxtを見つけたので開いてみると、
一つ目の材料が記載されていました。
sudo suでrootに昇格を試みます。無事rootに昇格出来たので、後は縦横無尽にフォルダを探し回り、2つ目と3つ目の材料が記載されたテキストを見つけることができました。
まとめ
Nmap~Gobuster~Reverse Shell~権限昇格
途中でrabbit holeの引っ掛けもありましたが、それも含めてとても楽しい学びでした。
Discussion