TryHackMe / Medium / Linux
Smol
Tested by:
Testing performed by Nikolay Kravtsov, a novice information security specialist at 11:55 *(quite a complex room, I don’t think it’s a medium, I think it’s more hard even)*.
Files used:
- user.txt - flag
- root.txt - flag
- wordpress.old.zip - file for increasing privileges to xavi.
Procedure:
1) Editing /etc/resolv.conf for Internet access, creating a room folder, enabling win kex for convenience, enabling VPN for accessing rooms
1) sudo nano /etc/resolv.conf; clear; mkdir smol; cd smol; clear; kex --win; clear; sudo openvpn ../Kolya080808.ovpn
2) clear; sudo ./thm-troubleshoot; nmap -sCV 10.10.103.188; gobuster dir -w directory-list-2.3-medium.txt -b 404 -u http://www.smol.thm
2) Scanning ports using nmap.
- Results:
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.9 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 44:5f:26:67:4b:4a:91:9b:59:7a:95:59:c8:4c:2e:04 (RSA)
| 256 0a:4b:b9:b1:77:d2:48:79:fc:2f:8a:3d:64:3a:ad:94 (ECDSA)
|_ 256 d3:3b:97:ea:54:bc:41:4d:03:39:f6:8f:ad:b6:a0:fb (ED25519)
80/tcp open http Apache httpd 2.4.41 ((Ubuntu))
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Did not follow redirect to http://www.smol.thm
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
3) Launch Gobuster to search for directories.
- Results:
===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url: http://www.smol.thm
[+] Method: GET
[+] Threads: 10
[+] Wordlist: directory-list-2.3-medium.txt
[+] Negative Status codes: 404
[+] User Agent: gobuster/3.6
[+] Timeout: 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
/wp-content (Status: 301) [Size: 317] [--> http://www.smol.thm/wp-content/]
/wp-includes (Status: 301) [Size: 318] [--> http://www.smol.thm/wp-includes/]
Progress: 2659 / 220561 (1.21%)^C
[!] Keyboard interrupt detected, terminating.
Progress: 2659 / 220561 (1.21%)
===============================================================
Finished
===============================================================
4) After launching gobuster, I started looking at what could be done with wordpress:
Result:

5) Having found this plugin, I, with the help of the creator's hint, using LFi, found the username and password for wp-admin:
Result:

6) Then came the hard part: finding the RCE. Thanks to my experience with wordpress, I found that rce can be obtained using the default hello dolly plugin, and I got it (it took me 2 days, actually):
Result:

7) Having gained access to the server, I re-read the description of the room and found an interesting hint that said that you can find hashes and just hack them, and by going into mysql and copying the hashes, I did it:
Result:

8) After changing the user to diego, I read the user flag:
Result:

9) Then in /home/think/.ssh I found the ssh key and used it to access the machine via ssh:
Result:

10) Next, in the gege directory, I found the wordpress.old.zip file and tried to unpack it, but it didn’t work: firstly, I didn’t have the rights, and secondly, it was password protected. After looking at the think user groups, I found that I could escalate privileges to user gege without a password and download the archive:
Result:

11) We brute-force the ZIP archive’s password and then gain access as xavi:
Result:

12) Well, now the simplest thing: the xavi user has the right to change the user to root without any problems. So we do this and read root.txt:
Result:

Note
Note:
I think this room is more hard than medium. However, I really liked it, it was made cool both in technical and software parts, and simply in terms of passage.
Thanks josewdf for the room!
Video walkthrough
- Original:
- YouTube