This is a walkthrough of what I did to solve Offsec Lab DC-1. Attack chain includes enumeration, vulnerable software exploitation and reverse shell.
The Target
IP Address: 192.168.140.193
Applications: Drupal 7
Difficulty: Fundamental
Enumeration
Service Scan using nmap
Nmap scan report for 192.168.140.193 Host is up, received conn-refused (0.041s latency). Scanned at 2026-09-09 14:00:45 PST for 744s Not shown: 65485 closed tcp ports (conn-refused) PORT STATE SERVICE REASON VERSION 22/tcp open ssh syn-ack OpenSSH 6.0p1 Debian 4+deb7u7 (protocol 2.0) 80/tcp open http syn-ack Apache httpd 2.2.22 ((Debian)) 111/tcp open rpcbind syn-ack 2-4 (RPC #100000)
Web Enumeration using ffuf
profiles [Status: 301, Size: 321, Words: 20, Lines: 10, Duration: 40ms] 0 [Status: 200, Size: 7648, Words: 812, Lines: 150, Duration: 2649ms] themes [Status: 301, Size: 319, Words: 20, Lines: 10, Duration: 212ms] admin [Status: 403, Size: 7740, Words: 808, Lines: 151, Duration: 2789ms] sites [Status: 301, Size: 318, Words: 20, Lines: 10, Duration: 154ms] misc [Status: 301, Size: 317, Words: 20, Lines: 10, Duration: 58ms] includes [Status: 301, Size: 321, Words: 20, Lines: 10, Duration: 92ms] robots [Status: 200, Size: 1561, Words: 128, Lines: 61, Duration: 73ms] node [Status: 200, Size: 7648, Words: 812, Lines: 150, Duration: 2624ms] user [Status: 200, Size: 7501, Words: 761, Lines: 143, Duration: 2333ms] modules [Status: 301, Size: 320, Words: 20, Lines: 10, Duration: 130ms] scripts [Status: 301, Size: 320, Words: 20, Lines: 10, Duration: 128ms] Repository [Status: 403, Size: 293, Words: 21, Lines: 11, Duration: 156ms]
Since there is port 80 that is open, it means it is possible that there is web server running on this target machine. Tried to access the site using a browser:
Checked if the enumerated files are accessible using browser:




Wappalyzer for Tech Detection
Used Wappalyzer to detect what are the tech stack used in this website.

Exploitation
Account Creation
I used Drupalgeddon with exploit number 34992 from ExploitDB. What this does:
- Exploits the bug in the login form where there is no input sanitization in the username field.
- A new username and password is supplied to the script.
- The script scrambles the password before sending the way Drupal stores passwords.
- It sends a fake login requests with DB commands hidden in the username field.
- In the server side, the command is executed and new admin credentials is created.

If the creation is successful, this admin account will be used to login to Drupal's web console.
PHP Reverse Shell
After logging in as an admin, enable PHP content to allow uploading a PHP reverse shell.



I used revshells.com to generate a PHP reverse shell code.

Before continuing, start the nc listener.

Then, edit any article and paste the code for reverse shell.

Privilege Escalation
Once connected via reverse shell, used this command to find paths to escalate privileges:
find / -perm -4000 -type f -exec ls -la {} 2>/dev/null \;
Result

find was set SUID-root (-rwsr-xr-x), so it runs as root no matter who launches it. Its -exec flag lets it execute any command, and that command inherits root's privileges. /bin/bash -p spawns a shell that keeps those privileges instead of dropping them, giving www-data a root shell.
As Root
By executing this command, I was able to switch as root:
find . -exec /bin/bash -p \; -quit

Capture the Flag
Once switching as root is successful, you can already do anything in the target machine. This allows capturing the flag, or in simple terms opening the file and copying the contents to submit it as a flag.
