Active

hackthebox.com - © HACKTHEBOX

🔗 Activearrow-up-right

Task 1 - Deploy the machine

🎯 Target IP: 10.10.10.5

Create a directory for machine on the Desktop and a directory containing the scans with nmap.

Task 2 - Reconnaissance

I prefer to start recon by pinging the target, this allows us to check connectivity and get OS info.

Sending these three ICMP packets, we see that the Time To Live (TTL) is ~128 secs. this indicates that the target is a Windows system, while *nix systems usually have a TTL of 64 secs.

2.1 - What is the name of the service is running on TCP port 21 on the target machine?

command
result

sudo

run as root

sC

run default scripts

sV

enumerate versions

A

aggressive mode

T4

run a bit faster

oN

output to file with nmap formatting

It looks like there are 2 open ports on the machine: 21, 80.

Now, we need to search which services are running on open ports, in details on port 21:

circle-info

Microsoft ftpd

2.2 - Which basic FTP command can be used to upload a single file onto the server?

We can use put command to upload a single file.

circle-info

put

2.3 - Are files put into the FTP root available via the webserver?

We can try to put a file using ftp, in this case we use nmap result file (port_scan):

circle-info

yes

2.4 - What file extension is executed as a script on this webserver? Don't include the ..

circle-info

aspx

2.5 - Which metasploit reconnaissance module can be used to list possible privilege escalation paths on a compromised system?

We launch msfconsole:

and we search a post/multi/recon exploit:

circle-info

local_exploit_suggester

Task 3 - Find user flag

3.1 - Submit the flag located on the babis user's desktop.

Now, we can use msfvenom to generate an exploit to upload using ftp

LHOST is local ip, while, LPORT is the port that we'll use to connect by netcat.

Now we can launch netcat on port 444 and run script:

We're iis apppool\web user, the flag maybe is on the babiis user's desktop

We've not access to babibs' directory, we can try to find "user.txt" flag using while command in C:\ root.

Nothing to do! Now, we need to privilege escalation and access on bibis' dir.

We launch systeminfo command to know info about OS:

OS Version: 6.1.7600 N/A Build 7600

Searching on google we found this exploitarrow-up-right for OS vs.

We download this script: "40564.c" and we compile it using mingw32

Now we can re-open ftp in binary mode and put it (exploit.exe)

We can find exploit.exe file using where command and run it to escalate privilege!

Starting to root folder (C:\) we can find quickly flags, using where command in recusive mode (/r):

and read user.txt flag using type command (equivalent to cat on *nix):

chevron-right🚩 Flag 1 (user.txt)hashtag

5d3fc209e1fae6d5df926fe7dc8a16bd

Task 4 - Find root flag

After that, we do the same thing for root.txt flag

chevron-right🚩 Flag 2 (root.txt)hashtag

cb43e154f9c2ca60b68c8150e5162f32