Simple CTF

https://tryhackme.com/room/easyctf

Task 1: Simple CTF

How many services are running under port 1000?

Let's scan the target using nmap.

$ nmap -sC -sV 10.10.48.90 
Starting Nmap 7.92 ( https://nmap.org ) at 2023-12-07 22:29 IST
Nmap scan report for 10.10.48.90
Host is up (0.14s latency).
Not shown: 997 filtered tcp ports (no-response)
PORT     STATE SERVICE VERSION
21/tcp   open  ftp     vsftpd 3.0.3
| ftp-syst: 
|   STAT: 
| FTP server status:
|      Connected to ::ffff:10.17.48.138
|      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 1
|      vsFTPd 3.0.3 - secure, fast, stable
|_End of status
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_Can't get directory listing: TIMEOUT
80/tcp   open  http    Apache httpd 2.4.18 ((Ubuntu))
| http-robots.txt: 2 disallowed entries 
|_/ /openemr-5_0_1_3 
|_http-title: Apache2 Ubuntu Default Page: It works
|_http-server-header: Apache/2.4.18 (Ubuntu)
2222/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.8 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 29:42:69:14:9e:ca:d9:17:98:8c:27:72:3a:cd:a9:23 (RSA)
|   256 9b:d1:65:07:51:08:00:61:98:de:95:ed:3a:e3:81:1c (ECDSA)
|_  256 12:65:1b:61:cf:4d:e5:75:fe:f4:e8:d4:6e:10:2a:f6 (ED25519)
Service Info: OSs: Unix, 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 50.85 seconds

There are three open ports:

Port
Service

21

ftp

80

http

2222

ssh

Out of the three, only two are below 1000.

Answer

What is running on the higher port?

The highest port is 2222 which has SSH running on it.

Answer

What's the CVE you're using against the application?

We can use gobuster to brute force the web pages.

Let's visit the /simple page.

On the web page, in the footer section we can find the version of the CMS.

Let's check Exploit-DB to see if there is an exploit for that version.

Answer

To what kind of vulnerability is the application vulnerable?

The vulnerability is mentions in the CVE page.

Answer

What's the password?

Let's save the exploit to a file called exploit.py.

If you don't have termcolor, you can use the following command:

We will have to modify the exploit a bit for Python3.

Answer

Where can you login with the details obtained?

Let's try and login through SSH using the mitch username and secret password.

Note that we had to specify port 2222 because that is the port SSH was running on in this machine.

Answer

What's the user flag?

We can stabilize the shell using the following commands:

Let's read the user flag.

Answer

Is there any other user in the home directory? What's its name?

Let's check for other users.

Answer

What can you leverage to spawn a privileged shell?

  • We can check the files that mitch can execute using the following command:

Answer

What's the root flag?

We can find an exploit on GTFOBins.

Let's run the exploit.

We can now read the root flag.

Answer

Last updated