Fowsniff CTF

https://tryhackme.com/room/ctf

Task 1: Hack into the FowSniff organisation.

Deploy the machine. On the top right of this you will see a Deploy button. Click on this to deploy the machine into the cloud. Wait a minute for it to become live.

No answer needed

Using nmap, scan this machine. What ports are open?

Let's perform a scan using nmap.

$ nmap -sC -sV 10.10.251.22
Starting Nmap 7.92 ( https://nmap.org ) at 2023-12-17 08:35 IST
Nmap scan report for 10.10.251.22
Host is up (0.13s latency).
Not shown: 996 closed tcp ports (conn-refused)
PORT    STATE SERVICE VERSION
22/tcp  open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.4 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 90:35:66:f4:c6:d2:95:12:1b:e8:cd:de:aa:4e:03:23 (RSA)
|   256 53:9d:23:67:34:cf:0a:d5:5a:9a:11:74:bd:fd:de:71 (ECDSA)
|_  256 a2:8f:db:ae:9e:3d:c9:e6:a9:ca:03:b1:d7:1b:66:83 (ED25519)
80/tcp  open  http    Apache httpd 2.4.18 ((Ubuntu))
| http-robots.txt: 1 disallowed entry 
|_/
|_http-title: Fowsniff Corp - Delivering Solutions
|_http-server-header: Apache/2.4.18 (Ubuntu)
110/tcp open  pop3    Dovecot pop3d
|_pop3-capabilities: CAPA SASL(PLAIN) USER UIDL AUTH-RESP-CODE RESP-CODES PIPELINING TOP
143/tcp open  imap    Dovecot imapd
|_imap-capabilities: post-login OK AUTH=PLAINA0001 have Pre-login more listed capabilities IMAP4rev1 IDLE SASL-IR ENABLE ID LITERAL+ LOGIN-REFERRALS
|_ssl-cert: ERROR: Script execution failed (use -d to debug)
Service Info: 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 30.44 seconds

There are four open ports:

Port
Service

22

ssh

80

http

110

pop3

143

imap

No answer needed

Using the information from the open ports. Look around. What can you find?

We can visit the target using our browser.

No answer needed

Using Google, can you find any public information about them?

On searching for a while, we can find this page which has a bunch of the employees' passwords.

However these passwords are hashed.

No answer needed

Can you decode these md5 hashes? You can even use sites like hashkiller to decode them.

We can identify the hashes using hash-identifier.

Similar to the first one all the rest are hashed using MD5 algorithm.

Now let's save the hashes in a file and use john to crack them.

Users

mauer

mustikka

tegel

baksteen

seina

stone

mursten

parede

sciana

Passwords

mailcall

bilbo101

apples01

skyler22

scoobydoo2

carp4ever

orlando12

07011972

For some reason john could not crack the hash of sixth password.

No answer needed

Using the usernames and passwords you captured, can you use metasploit to brute force the pop3 login?

Let's create the database and run msfconsole.

We can now search for modules related to Pop3.

We will be using the fourth module. Let's select it using the following command:

Let's set up the module.

We are now all set to brute force the login.

No answer needed

What was seina's password to the email service?

Answer

Can you connect to the pop3 service with her credentials? What email information can you gather?

  • We can connect to the Pop3 service using nc.

No answer needed

Looking through her emails, what was a temporary password set for her?

We can use the list command to list out the contents.

There are two messages. Let's read the first message using retr.

Answer

In the email, who send it? Using the password from the previous question and the senders username, connect to the machine using SSH.

Let's read the second message.

The email was sent by baksteen which we can see in the From: field.

Let's connect using SSH.

No answer needed

Once connected, what groups does this user belong to? Are there any interesting files that can be run by that group?

We can check which group the baksteen user belongs to using the following command:

As we can see baksteen belongs to the users group.

Now, let's find the files that can be run by the users group.

No answer needed

Now you have found a file that can be edited by the group, can you edit it to include a reverse shell?

Let's check what the file does.

We can include the reverse shell that was provided to us with a few modifications:

No answer needed

If you have not found out already, this file is run as root when a user connects to the machine using SSH. We know this as when we first connect we can see we get given a banner (with fowsniff corp). Look in /etc/update-motd.d/ file. If (after we have put our reverse shell in the cube file) we then include this file in the motd.d file, it will run as root and we will get a reverse shell as root!

Let's start a nc listener on port 9999.

Let's login again using SSH.

If we check back on our listener, we will find that we have a reverse shell as root.

No answer needed

Last updated

Was this helpful?