CTF: DC-4, DC-5, DC-6 (intermediate)

As part of my CEH Practical prep, I’m sharpening my enumeration and exploitation workflow using realistic boot2root machines. The DC series on VulnHub is perfect for this: local, legal, and logically progressive. In this post, I’ll walk through DC-4, DC-5, DC-6 — there are more web-focused VMs in the series.

DC-4

Enumeration

Let’s start with a full Nmap scan:

Only SSH and HTTP open. Let’s hit the web server first.

Webserver (port 80)

The root page was just a login form. Time to go down the usual rabbit hole.

  • Ran gobuster – nothing useful beyond /images and /css, both forbidden.
  • Tried robots.txt, path traversal, SQLi, null bytes… even nginxpwner. Nada.
  • Eventually, I decided to YOLO it with Hydra:

At first, I thought it was a joke — but they were all valid logins. Even better, using Burp and filtering by length, I found several more:

Initial Acces

Regardless of which credentials I used, I ended up here:

Intercepting this with Burp showed we could tamper with the command:

Attempt 1: Raw Bash Reverse Shell

Failed — the & gets encoded or stripped.

Attempt 2: Base64 payload

Final shot: Python reverse shell

Reverse shell landed as www-data.

Escalating privileges

After looking around, we’ve got a user called jim with the following files:

While the test.sh script was amusing, the backup-passwords.bak file looked far more promising. So, I downloaded it to my local machine and ran Hydra against it.

After some initial digging, I didn’t uncover anything useful — but running LinPEAS revealed the following:

The email contained the following information:

How kind of Charles to share his password — after switching to his user and running sudo -l, things got interesting.

After looking into privilege escalation with teehee (which turns out to be a modified version of tee), I came across this method: Sudo Tee Privilege Escalation | Exploit Notes

And just like that — root access achieved.

DC-5

the nmap showed:

HTTP (port 80)

The website on port 80 looked like a basic template with fake-looking content — but there was a contact form. After submitting some data, it redirected me to a new URL, which looked dynamic and potentially injectable.

Naturally, I tested it for LFI (Local File Inclusion).

Local File Inclusion & Log Poisoning

Turns out, the LFI worked. Although browsing files wasn’t super practical, I did manage to access the nginx logs. From there, AI nudged me toward log poisoning — a classic trick. To test it, I sent a malicious User-Agent string containing PHP code:

After that, I used the LFI to include the poisoned log file and execute commands via cmd= in the URL.

With the log successfully poisoned, I went for a reverse shell:

Despite the log poisoning trick working initially and giving me command execution, I just couldn’t get a reverse shell to stick. I tried multiple payloads — from Bash to Python to Netcat — tweaking encodings, changing IPs and ports, even checking if outbound connections were being blocked… but nothing.

It seemed like the webserver only executed the payload once, and after that, the log file stopped behaving like PHP. Maybe it was being cached or sanitized after the first hit. Either way, nothing I tried after that would trigger execution again. At some point, I realized I was spending more time trying to force a shell than it was worth — especially for a challenge box. So yeah… this one beat me (for now 😤).

Sometimes walking away is better than going down a rabbit hole. On to the next!

DC-6

Started this one off with the usual full port scan:

HTTP (port 80)

The website looked like a fresh WordPress install with the classic “twentyseventeen” theme. I ran gobuster to confirm some default paths and then used wpscan to dig deeper. No vulnerable plugins turned up, but the theme version (twentyseventeen v2.1) did have a stored XSS vulnerability: CVE-2023-5162 — sadly, this requires authentication to exploit. So the next step: enumerate users.

The VulnHub description hinted that we shouldn’t wait “5 years” and gave us a command to speed things up — a clear nudge toward password spraying or bruteforcing:

Eventually, I was able to log in with limited permissions under a helpdesk-style account. No admin dashboard, no plugin editing — just basic access. But something interesting did stand out: ‘Plainview Activity Monitor’

Some quick research revealed a known exploit:: WordPress Plugin Plainview Activity Monitor 20161228 – Remote Code Execution (RCE) (Authenticated) (2) – PHP webapps Exploit After trying it we got a shell:

While snooping around with a somewhat shaky shell, I stumbled across this:

We also have permission to edit the file, so we can simply insert a reverse shell payload like this:

Then, by running sudo -l, we discovered we can execute nmap as root without a password.

Using this, we escalated to root and retrieved the flag:

Lessons Learned

This trio of challenges reinforced several key pentesting principles and techniques:

  1. Thorough Enumeration is Crucial: Each machine required a methodical approach to scanning and enumeration. From using full port scans and service detection in DC-5 and DC-6 to digging into HTTP services and forms in DC-4, uncovering every potential attack vector depends heavily on detailed reconnaissance.
  2. Don’t Underestimate Simple Vulnerabilities: DC-4’s log poisoning and DC-6’s vulnerable WordPress plugin highlight that even well-known, “old-school” vulnerabilities like log injection or authenticated RCE can be just as effective as more complex exploits—especially when chained together.
  3. Privilege Escalation Creativity: DC-4 and DC-6 demonstrated different privilege escalation paths, from misconfigured sudo permissions to leveraging nmap’s root execution capability. These remind us that understanding the underlying system and installed software is as important as finding the initial foothold.
  4. Persistence & Adaptability: The struggle to get a stable shell in DC-5 was a good lesson in patience and flexibility. Sometimes exploits or payloads fail intermittently, so testing multiple methods and adapting is essential.
  5. User Enumeration & Password Spraying: DC-6 emphasized the power of username enumeration combined with password spraying to gain access. This remains a fundamental technique for breaking into web apps and CMS platforms like WordPress.
  6. Always Check for Post-Exploitation Opportunities: Once inside, examining files like things-to-do.txt or running commands like sudo -l can reveal unexpected privilege escalation routes or useful insights, turning a limited shell into a full compromise.

Overall, these challenges reinforced that a successful pentest isn’t just about flashy exploits but about persistence, creativity, and attention to detail at every stage.