← Back to list

CTF Writeup — DC-1 — VulnHub

DC-1 is a CTF hacking challenge. It has numerous routes to go in. In the below writeup I have tried to be as comprehensive as possible. I…

Abhishek Tamang · 2023-02-24 13:59 · 0 claps · 4.5 min read
#capture-the-flag #vulnhub-walkthrough #cybersecurity #network-security #web-security
Open on Medium ↗
Wiki topics: 🔒 · Cybersecurity

CTF Writeup — DC-1 — VulnHub – Abhishek Tamang

DC-1 is a CTF hacking challenge. It has numerous routes to go in. In the below writeup I have tried to be as comprehensive as possible. I hope you enjoy and learn.

Main Screen — DC-1

Main Screen — DC-1

Download — https://www.vulnhub.com/entry/dc-1,292/

After installing, I made sure both machines — DC-1 and Kali are on NAT.

  1. Starting with the discovery of the machine on the network using —

arp-scan -l

192.168.183.131 is the DC-1

192.168.183.131 is the DC-1

arp-scan, also known as ARP Sweep or MAC Scanner, is a very fast ARP packet scanner that shows every active IPv4 enabled device on your subnet. Since ARP is non-routable, this type of scanner only works on the local LAN (local subnet or network segment).

We got DC1 at 192.168.183.131

  1. Next step is to get the initial information regarding the open ports on the machine, using Nmap.

Found an Apache running on port 80

Found an Apache running on port 80

Nmap, short for Network Mapper, is an open-source Linux command-line tool that is used to scan IP addresses and ports in a network. It allows network admins to find which devices are running on their network, discover open ports and services and detect vulnerabilities.

  1. Drupal Site

Drupal Site

Drupal Site

Running Drupal 7

Running Drupal 7

As it was observed that the machine has hosted a Drupal 7 site. Upon checking for any vulnerabilities for the same, I found Drupalgeddon 2 in Metasploit.

  1. Drupalgeddon 2

Metasploit Framework is a very powerful tool which can be used by cybercriminals as well as ethical hackers to probe systematic vulnerabilities on networks and servers. Because it is an open source framework, it can be easily customized and used with most operating systems.

Its info page says that Drupal 7.x is one of the available targets:

  1. Arming Drupalgeddon

set RHOSTS

set RHOSTS

Set the RHOSTS to the DC-1 IP — 192.168.183.131

  1. Attacking DC

We now hit “exploit”.

Drupalggedon will do its work and will give us the meterpreter shell to work on.

Flag1.txt

Flag1.txt

Going through the files, we get the flag1.txt

Flag1.txt contents

Flag1.txt contents

  1. The hint in the flag1 points towards the config file of the Drupal CMS.

Upon googling the location to the config file, we found:

Location to Drupal config file

Location to Drupal config file

Now that we have the path to the config file — sites/default/settings.php, we navigate ourselves to the config file:

Path to settings.php

Path to settings.php

Now that we have the settings.php, we now check the contents of the config file.

Flag 2

Flag 2

The config file gives away two things —

  1. Database credentials

  2. flag 2 — which hints towards us using these credentials.

  3. We need to access the database, but before that we need to spawn a python shell. We do this by executing below command:

python -c 'import pty; pty.spawn("/bin/bash")'

Now that we have the shell, we now access the database.

Accessing Database

Accessing Database

Users

Users

We found ‘users’ table. We inspect the same:

users table

users table

In the users table, we found two users, with their hashed passwords.

  1. Using hashcat, to crack the hash, against rockyou.txt.

Cracked — 53cr3t

Cracked — 53cr3t

Now that we have the cracked password, we now enter the CMS.

As observed below in the content tab, flag3 is found.

flag3

flag3

Contents:

flag3 — hint

flag3 — hint

  1. The flag3 hints towards checking SUID bit enabled file/command.

SUID allows an application to be run as root, even when a different user is running it.

Running the command to find the flag4:

find -name flag4*

flag4.txt location

flag4.txt location

Reading the contents of flag4.txt.

flag4.txt — contents

flag4.txt — contents

  1. Locating the final flag.

The hints suggests that to use the same method to find or access.

While navigating to /root we are not allowed to access:

/root permission denied

/root permission denied

Now checking any SUID bit set command:

find is set with SUID bit.

find is set with SUID bit.

We have find with SUID bit enabled, which means we can execute the command on behalf root.

Now checking the file list in /root

thefinalflag.txt

thefinalflag.txt

Upon checking a the find command execution options, we found the below:

find options.

find options.

Now using this to execute cat command to read the thefinalflag.txt

The DC-1 has been successfully “pwned”.

I hope you were able to follow and learn.

Meet you in the next installment!!


메타데이터
post_id
6bdbc7723a6f
slug
ctf-writeup-dc-1-vulnhub-6bdbc7723a6f
url
https://medium.com/@0verl0rd/ctf-writeup-dc-1-vulnhub-6bdbc7723a6f
canonical_url
https://medium.com/@0verl0rd/ctf-writeup-dc-1-vulnhub-6bdbc7723a6f
author_url
https://medium.com/@0verl0rd
status
ok
fetched_at
2026-06-29 01:02:39