AD Enumeration & Attacks - Skills Assessment Part I
Last updated
Last updated
Scenario:
A team member started an External Penetration Test and was moved to another urgent project before they could finish. The team member was able to find and exploit a file upload vulnerability after performing recon of the externally-facing web server. Before switching projects, our teammate left a password-protected web shell (with the credentials: admin:My_W3bsH3ll_P@ssw0rd!
) in place for us to start from in the /uploads
directory. As part of this assessment, our client, Inlanefreight, has authorized us to see how far we can take our foothold and is interested to see what types of high-risk issues exist within the AD environment. Leverage the web shell to gain an initial foothold in the internal network. Enumerate the Active Directory environment looking for flaws and misconfigurations to move laterally and ultimately achieve domain compromise.
Let's navigate to http://ip/uploads and log in using the credentials provided above.
Answer: JusT_g3tt1ng_st@rt3d!
Q2) Kerberoast an account with the SPN MSSQLSvc/SQL01.inlanefreight.local:1433 and submit the account name as your answer
To operate more efficiently from our attack machine, we need to establish a reverse shell. Let's generate a reverse shell payload and start the listener.
First, let's identify the system type of the victim machine.
Next, let's initiate our listener using Metasploit.
Let's also start an HTTP server to host the payload, allowing it to be downloaded onto the victim machine.
It is now time to download the payload onto the target machine and execute it.
Now that we have obtained a reverse shell, we need to use setspn
to query all Service Principal Names (SPNs) registered within the domain.
Answer: svc_sql
Q3) Crack the account's password. Submit the cleartext value.
Let's download PowerView on the Windows system to perform a Kerberoasting attack and extract the service ticket hash for the svc_sql user.
Answer: lucky7
Q4) Submit the contents of the flag.txt file on the Administrator desktop on MS01
Answer: spn$r0ast1ng_on@n_0p3n_f1re
Q5) Find cleartext credentials for another domain user. Submit the username as your answer.
Next, we need to connect to MS01.INLANEFREIGHT.LOCAL using the credentials we previously obtained. Since we do not have direct access to this machine, we will first set up a port forwarding rule to enable RDP access from our attacker machine.
Here is the IP address of the MS01 computer, which will be used as the connection IP address.
Let's initiate a connection using RDP.
I used the drive option to ensure convenient access to our tools.
Now, let's use Mimikatz to retrieve the cleartext password.
I found a blank password here, which indicates that WDigest needs to be enabled. WDigest is a Windows authentication protocol that stores user credentials in plaintext within memory, making them accessible to tools like Mimikatz for extraction.
Answer: tpetty
Q6) Submit this user's cleartext password.
After this we will need to restart the computer
Now that we’ve logged in again, let’s repeat the same steps we performed using Mimikatz and review the results.
Answer: Sup3rS3cur3D0m@inU2eR
Q7) What attack can this user perform?
Let's enumerate the user's access control list to determine their permissions and capabilities.
Answer: DCSync
Q8) Take over the domain and submit the contents of the flag.txt file on the Administrator Desktop on DC01
We will now use Mimikatz to perform a DCSync attack to retrieve the hash of the Administrator account. Before proceeding, we need to run the command as the user tpetty.
We have obtained the administrator's hash, which can be used directly for authentication. However, before proceeding, we need to verify which ports are open on the domain controller at 172.16.6.3
.
It instructs Metasploit to route traffic destined for the 172.16.6.3
subnet through the currently compromised host via the Meterpreter session.
Next, let's conduct a port scan to identify the open ports.
I discovered that port 5985 is open, which is the default port for WinRM over HTTP. However, before connecting from our attacking machine, we need to set up port forwarding.
Next, we will use Evil-WinRM
from the attacking machine to establish a connection to the domain controller using the provided credentials.
Answer: r3plicat1on_m@st3r!