TryHackMe / Medium / Linux
Boiler CTF
Tested by:
Testing performed by Nikolay Kravtsov, a beginner information security specialist at 21:33 *(good room, but for me it’s good as a warm-up. However, I would recommend it for beginners)*
Testing scope and services used.
| IP/domain | Port | Service | Target Server Service |
|---|---|---|---|
| localhost | 5901 | WinKexServer | - |
| localhost | - | Nmap Port Scanner | - |
| localhost | - | DirBuster Directory Scanner | - |
| localhost | - | Obsidian Notes | - |
| localhost | - | hashcat hash cracker | - |
| 10.10.77.106 | 80 | httpd Web Server | + |
| 10.10.77.106 | 21 | FTPd | + |
| 10.10.77.106 | 55007 | SSH | + |
Files used:
- log.txt - file with user data for ssh connection.
- backup.sh - a file with another user's data.
- .secret - flag.
- root.txt - flag.
Procedure
1) Launch openvpn for access; kex to make Linux more convenient
kex --win && sudo openvpn lab_Kolya080808.ovpn2) Scanning ports using nmap.
Results:
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 3.0.3
| ftp-syst:
| STAT:
| FTP server status:
| Connected to ::ffff:10.9.3.5
| 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.3 - secure, fast, stable
|_End of status
|_ftp-anon: Anonymous FTP login allowed (FTP code 230)
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
|_http-title: Apache2 Ubuntu Default Page: It works
| http-robots.txt: 1 disallowed entry
|_/
|_http-server-header: Apache/2.4.18 (Ubuntu)
10000/tcp open http MiniServ 1.930 (Webmin httpd)
|_http-title: Site doesn't have a title (text/html; Charset=iso-8859-1).
Service Info: OS: Unix
3) Launch Gobuster to search for directories.
- Results:
┌──(kolya080808㉿Nikolapc)-[~]
└─$ gobuster dir -w directory-list-2.3-medium.txt -u http://10.10.77.106/joomla/ -b 404
===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url: http://10.10.77.106/joomla/
[+] 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
===============================================================
/images (Status: 301) [Size: 320] [--> http://10.10.77.106/joomla/images/]
/templates (Status: 301) [Size: 323] [--> http://10.10.77.106/joomla/templates/]
/media (Status: 301) [Size: 319] [--> http://10.10.77.106/joomla/media/]
/modules (Status: 301) [Size: 321] [--> http://10.10.77.106/joomla/modules/]
/tests (Status: 301) [Size: 319] [--> http://10.10.77.106/joomla/tests/]
/bin (Status: 301) [Size: 317] [--> http://10.10.77.106/joomla/bin/]
/plugins (Status: 301) [Size: 321] [--> http://10.10.77.106/joomla/plugins/]
/includes (Status: 301) [Size: 322] [--> http://10.10.77.106/joomla/includes/]
/language (Status: 301) [Size: 322] [--> http://10.10.77.106/joomla/language/]
/components (Status: 301) [Size: 324] [--> http://10.10.77.106/joomla/components/]
/cache (Status: 301) [Size: 319] [--> http://10.10.77.106/joomla/cache/]
/libraries (Status: 301) [Size: 323] [--> http://10.10.77.106/joomla/libraries/]
/installation (Status: 301) [Size: 326] [--> http://10.10.77.106/joomla/installation/]
/build (Status: 301) [Size: 319] [--> http://10.10.77.106/joomla/build/]
/tmp (Status: 301) [Size: 317] [--> http://10.10.77.106/joomla/tmp/]
/layouts (Status: 301) [Size: 321] [--> http://10.10.77.106/joomla/layouts/]
/administrator (Status: 301) [Size: 327] [--> http://10.10.77.106/joomla/administrator/]
/cli (Status: 301) [Size: 317] [--> http://10.10.77.106/joomla/cli/]
/_files (Status: 301) [Size: 320] [--> http://10.10.77.106/joomla/_files/]
Progress: 220560 / 220561 (100.00%)
===============================================================
Finished
===============================================================
4) At first I simply guessed one of the answers.
Result:

5) Then we go to ftp and find this:
Result:

6) I downloaded it and didn’t find anything interesting, we were just trolled:
Result:

7) Then I looked at the site (or rather the /joomla directory):
- Result:

8) Since gobuster didn’t find anything interesting for us, I tried by analogy with /_files go to /_test and there I found RCE:
Result:

9) Having found the password, I tried to log in to the specified ports via ssh, but in vain:
Result:

10) So I tried to enter data in other places, but in the end I got into a dead end:
Result:

11) Therefore, I once again performed a port scan from port 49824 to 57000 and found what I needed:
- Result:
PORT STATE SERVICE VERSION
55007/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.8 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 e3:ab:e1:39:2d:95:eb:13:55:16:d6:ce:8d:f9:11:e5 (RSA)
| 256 ae:de:f2:bb:b7:8a:00:70:20:74:56:76:25:c0:df:38 (ECDSA)
|_ 256 25:25:83:f2:a7:75:8a:a0:46:b2:12:70:04:68:5c:cb (ED25519)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
And again the result:

12) Having gained access to SSH, I looked at the files and found an interesting one containing the username and password of another user on the system:
Result:

13) Well, we change the user and read .secret:
Result:

14) Let's see how we can increase privileges:
Result:

15) Increase privileges with findand read root.txt:
Result:

Note:
A good room, one might even say for warming up.
I advise beginners to take it! Thanks TryHackMe for the room!
Vulnerabilities found
Information Disclosure
PoC:
(point 8)
CVSSv3 Score: 7.9 (Critical)
Description:
In this case, information disclosure is associated with incorrectly configured rights to the page with RCE.
Reproducing the vulnerability:
PoC compliant.
Remediation recommendations:
- Restrict access to this page.
- Create a user system and make sure that only administrators have access to this page.
- Fix RCE.
Remote code execution
PoC:
(point 8)
CVSSv3 Score: 10.0 (Critical)
Description:
RCE is an incorrectly written page code, which in turn, when certain actions are taken, gives access to the shell using a browser.
Reproducing the vulnerability:
PoC compliant.
Remediation recommendations:
- Look at this site how can it be fixed.
It's also worth a look OWASP website to fix it.
Video walkthrough
Original:
- YouTube