Building Magic

AD Challenge Lab (Medium) - by Noah Heroldt & Haik Isikbay

The following post by 0xb0b is licensed under CC BY 4.0


This is the first machine release on Hack Smarter https://courses.hacksmarter.org/dashboard!

Initially, we are provided with the following scope and leaked database hashes:

Scope and Objective

Leaked Database File:

Recon

The Nmap scan of 10.1.168.5 revealed numerous Windows/Active Directory-related services, including DNS 53, Kerberos 88/464, LDAP 389/636/3268/3269, SMB 139/445, RPC 135/593, and RDP 3389, alongside web services on ports 80 and 8080. This indicates the host is likely a domain controller with both directory services and a web application attack surface.

The default script and service scan does not provide any further information, but only confirms the domains that are already known from the scope.

Access as r.widdleton

We continue cracking the existing hashes using hashcat and are able to crack only one password.

Further hashes could be cracked using the site https://crackstation.net/.

From the Nmap scan, we know that SMB is available. We use NetExec and test the cracked passwords. We are successful with the user r.widdelton.

We see that there is a share called File-Share, but we have neither read nor write access to it. But we have read access to the IPC$ share, which allows us to perform a rid brute force.

https://www.netexec.wiki/smb-protocol/enumeration/enumerate-users-by-bruteforcing-rid

Username Enumeration

We will see if we can find other users besides those with leaked credentials. To do this, we use the aforementioned rid bruteforce.

And we are able to get the following users, which might come in handy later.

Access as r.haggard

With the credentials from r.widdleton, we continue with the enumeration and use Bloodhound for this purpose. Since I had problems with DNS timeouts, I used DNSChef for this case.

We run the collectors script bloodhound-ce.py with the credentials of r.widdleton.

We feed the data into Bloodhound and analyse it using the available cypher queries and the OutBound Object Control relationships. We see that r.widdleton does not have any special permissions. But we find a Kerberosatbale user: r.haggard.

We use GetUserSPNs.py to Kerberoast the user using the credentials of r.widdleton. And we receive the Kerberos 5, etype 23, TGS-REP blob from r.haggard.

Fortunately, this could be cracked using hashcat. And we have now access as r.haggard.

Access as h.potch

We take another look at the data we collected with Bloodhound. Let's take a closer look at r.haggard's Outbound Object Control. The user is able to change h.potch's password. The user h.potch does not appear to have any further permissions or usable relationships in Bloodhound, but we will see what else he can do in a moment.

Next, we change the password of h.potch with the credentials of r.haggerd using net rpc.

We enumerate the shares using NetExec and see that we are now able to read and write to the share File-Share that we have already discovered.

Shell as h.grangon

However, the share appears to be empty.

But since we can write, we can try to place a file in the share that connects to us when opened or viewed in browser and reveals the hash of the calling user. This is called NTLM theft. There is already a handy tool for creating such files:

We prepare the files,

and set up resonder (with root privileges) to catch the request.

Next, we place the .lnk file in that share.

We get a connection with the NTLMv2-SSP of h.grangon.

Once again, we are able to crack the hash.

In Bloodhound, we see that this user is in the Remote Management Users group. This allows us to connect to the machine using evil-winrm. Remember, port 5985 is open.

We connect to the machine using evil-winrm and find the first flag at C:\Users\h.grangon\Desktop\user.txt.

Shell as a.flatch

The user has a fatal permission: SeBackupPrivilege. This allows us to copy the SAM and SYSTEM hive. From this, we can then extract hashes using Impackets secretsdump.

We save hives and download those using evil-winrm. The download of the SYSTEM hive via evil-winrm might take some time.

Next we dump the hashes using Impackets secretsdump. We are now in the possesion of the local Administrator hash. But it seems like it cannot be used using either of the Impacket exec tools like wmiexec.py or psexec.py nor evil-winrm.

Recalling the users list gathered from the rid brute force we try the hash on all the users we know of and are successful with a.fletch.

We see that this user is also an Administrator.

We connect to the machine as a.fletch using the hash.

And we find the final flag at C:\Users\Administrator\Desktop\root.txt.

Last updated

Was this helpful?