A Windows domain controller where anonymous LDAP enumeration surfaces a first credential — and a built-in backup privilege allows reading registry hives directly, leading to a full domain compromise.
Tools
- ldapsearch
- crackmapexec
- smbpasswd
- evil-winrm
- impacket-secretsdump
Getting User
Nmap
1 | |
Foothold
add domain name and the dcs’s to hosts file
1 | |
using ldapsearch i was able to find this description which shows an initial password
1 | |
I tested the credentials to login with Teresa.Bell with crackmapexec but credentials failed
I created a users.txt to try the password on the users I found
1 | |
1 | |
but it wasn’t successful also
i found more accounts by using grep to view only the dn (Distinguished Name) which shows us the CN (Common Names) of the objects
1 | |
I’m going to save the output of CN to allusers.txt, also removing the spaces and replacing them with .
1 | |
Going to try smbmapexec again against all the users
I got a hit, the password belongs to Caroline.Robinson
but I have to change the user’s password
1 | |
I changed the password to BabyStart321! using smbpasswd
1 | |
Now I am able to login using evil-winrm to get the user flag
1 | |
Getting Root
Information Gathering
First I checked user privileges
1 | |
I see that i’m in this group BUILTIN\Backup Operators and have the following privileges
1 | |
I save sam and lsa secrets using impacket-reg on the target’s machine
1 | |
I downloaded them using evil-wirnm
1 | |
next, I dumped the secrets using impacket-secretsdump
1 | |
I tried to login to administrator using the administrator hash but failed, then tried it against the users.txt, which also failed
1 | |
then I tried the hash of the machine account and it was correct
1 | |
Privilege Escalation
now I’ll dump sam and lsa secrets of the machine account using the hash
1 | |
I tested the administrator’s hash against all the users and got a hit the administrator account
1 | |
logged in using evil-winrm and I am now able to get the root flag
1 | |