CTF: DC-1, DC-2, DC-3 (easy)

As part of my prep for the CEH Practical, I wanted to sharpen my enumeration and exploitation workflow with realistic machines. The DC series on VulnHub offers exactly that — legal, local, and logically progressive CTFs. In this post, I walk through DC-1, DC-2, and DC-3. No fancy tools needed — just good ol’ enumeration, exploitation, and a bit of patience.

DC-1

Enumeration

Starting off with an Nmap scan:

Drupal 7 on port 80 caught my eye — classic.

Initial Access

Homepage confirmed Drupal 7. A quick search led me to Drupalgeddon2 a known exploit:

Manual PoC gave a shaky shell, so I used Metasploit:

This gave me a stable Meterpreter session. From there, I found Flag #1 and a hint about Drupal’s default config. In sites/default/settings.php, I found Flag #2 along with the MySQL root credentials.

This revealed a helpful hint suggesting not to brute-force and even provided the database credentials, so I proceeded to connect to MySQL. That’s where I hit a snag — turns out I didn’t really know how to properly interact with Meterpreter… oops. After about 30 minutes of trial and error, I realized I first needed to type shell in Meterpreter to spawn a proper interactive shell. With that in place, I could finally run the MySQL client and inspect the database.

After selecting the users table, I found another hint tucked away inside:

This hint pointed me toward checking UID permissions — time to look for binaries with special privileges:

Getting root

I spotted find with the setuid bit — game on:

Instant root shell. Final flag captured.

DC-2

Enumeration

Same Nmap flow:

Finding SSH running on port 7744 was definitely unexpected, but as usual, I started by checking out the web server first. The basic homepage and the results from Gobuster confirmed it was a standard WordPress installation. Surprisingly, the first flag was just sitting there in plain sight — a freebie!

so lets create a custom wordlist with cewl based on the site’s content:

Alongside the wordlist, we also needed valid usernames — fortunately, SQLMap has a built-in function to enumerate those:

We can also use SQLMap to perform password spraying:

Initial Access

Got two valid users:

  • jerry:adipiscing
  • tom:parturient

Only Jerry has the rights to edit WordPress posts, while Tom can only view them. So, continuing as Jerry, we explore a bit more and eventually discover Flag 2:

This suggests that exploiting WordPress isn’t the way to go—so maybe it’s as simple as logging in via SSH? (KISS: Keep It Simple, Stupid)

Tom can log in and we find Flag 3, but I can’t read it because I’m stuck in a restricted (rbash) shell that doesn’t allow me to use cat:

After reading up on this, the first step is to figure out which commands are available. Then we might be able to use GTFObins to create a shell. So:

We can use vi to break out of the restricted bash (rbash):

The first method I tried failed, but then I switched to the second method, where I needed to set the PATH environment variable. After that—boom! It worked.

Getting Root

After exploring a bit, I found flag4 containing:

Since we were looking for a git repository, I first tried the command find / -name ".git" 2>/dev/null but it didn’t return anything. I got stuck for a while because I hadn’t switched to the user Jerry yet. After switching to Jerry and running sudo -l :

I discovered that we can run the git command as root. So I went back to GTFObins and used the following technique:

DC-3

Enumeration

The NMAP scan:

That makes things easy — we just need to check the Joomla site. It appeared to be a basic Joomla installation, and a Gobuster scan confirmed the default folder structure.

When I visited http://10.0.2.18/administrator/manifests/files/joomla.xml, I found the version was 3.7.0. This didn’t immediately reveal any CVEs or exploits, so I continued enumerating. In msfconsole, there’s a Joomla plugin scanner that can help identify vulnerabilities:

Trying these two vulnerabilities didn’t yield any useful results. Next, I used JoomScan to identify which components were in use. One of them was com_fields, which has an exploit listed on Exploit-DB: https://www.exploit-db.com/exploits/42033. According to the exploit details, I needed to run the following sqlmap command:

And sure enough:

Dumping the database

Using --dump, I dumped the entire database, which took quite some time. Next time, I’ll make sure to check which tables I want to dump beforehand—oops. So I stopped that process and ran the following command instead:

This gave me the following result:

John was able to easily crack the password for me.

Initial Access

According to HackTricks, we can exploit an RCE vulnerability in the templates area since we have admin credentials. This worked perfectly:

Next, I tried to get a reverse shell using the following method:

But that didn’t seem to work, and encoding the characters didn’t help either.

So I uploaded my own page using the default PentestMonkey PHP script:

Always good to have a backup, hehe.

Getting root

I was stuck for a while since I couldn’t find any useful information. Then I ran LinPeas, which revealed that the kernel was outdated. This pointed me to CVE-2016-4557, with a proof of concept available here: https://project-zero.issues.chromium.org/issues/42452340. So, I decided to give it a try:

📘 Lessons Learned

✅ Getting faster at these CTFs — what once felt tough is now almost “easy” thanks to recognizing common patterns

✅ Always have multiple ways to get a shell — escaping rbash with vi, spawning tty shells with Meterpreter, etc.

✅ Hidden hints often appear in unexpected places like databases or uncommon service ports — thorough enumeration pays off

✅ Combining automated tools (sqlmap, Metasploit plugins) with manual techniques is essential for efficiency

✅ Paying close attention to user permissions and roles can reveal privilege boundaries and potential escalation paths

✅ Patience and curiosity are key — don’t rush; sometimes the smallest misconfigurations open the door

This series reinforced that success in CTFs isn’t just about technical skills, but also about mindset: staying adaptable, exploring different angles, and building a versatile toolbox of techniques.