Checklist
- Check if the Replication share is mountable. If yes, grep for assword in Groups.xml, which can be recovered with PowerSploit’s Get-GPPPassword.ps1.
A domain of a DC consists out of the following elements:
- users
- groups
- computers
An object in AD may have a set of ACE Access Control Entries which is called ACL Access Control List. An object’s ACE can be retrieved in PS with Get-ObjectAcl [-Identity| $object.
The SCM Service Control Manager contains a database of installed services and drivers on Windows.
Authentication methods
Authentication is performed mainly via NTLM and Kerberos
NTLM
- Client calculates a NTLM hash from the user’s password.
- Client sends to the Application Server AS a username.
- AS sends to the Client a Nonce/Challenge.
- Client encrypts the Nonce/Challenge with the NTLM hash (aka user password) and sends it to the AS.
- AS sends this to the DC together with the username and nonce.
- The DC compares it with the stored NTLM hash from the user and when identical, it sends a green light to the AS.
Kerberos
The DC is the Key Distribution Center. Because TGT can only be used for a short time because of the aging timestamp, the system has to been able to generate new TGT for which is need the user’s password. It is cached in the Local Security Authority Subsystem Service LSASS. To obtain the hashes, system access is needed.
Service Account attacks
Low and slow passwort guessing
Check the password policies on a AD system
net accounts
Note the Lockout threshold and the Lockout observation window. The idea is to try very few common passwords against a large set of users.
The script Spray-Passwords.ps1 can be used for this.
.\Spray-Passwords.ps1 -Pass 'pw1,pw2,pw3' -Admin
This script can be let on the victim’s system. It will perform n‑1 password attempts in each time windows and maybe somewhen deliver a positive result.
Tools
responder: See blog post
mitm6: Windows preferes IPv6 over IPv4 for DNS servers. mitm6 can announce itself as IPv6 DNS server which would then be used by Windows systems. (Source)
- See also the source article which describes how to catch DNS requests and add payload into requests.
mitm6 -d lab.local
bloodhound: See the article
GetUserSPNs.py: Retrieves an Kerberos ticket which can include a hash. (Download)
GetUserSPNs.py -request -dc-ip $victim $domain/$user
User/Attributes: See OSCP 630f for a PowerShell script which enumerates through all users with their attributes.
ADAPE: Please describe me: https://github.com/hausec/ADAPE-Script
DeathStar: Pease describe me: https://github.com/byt3bl33d3r/DeathStar
Get password hashes
The DC stores password hashes for all users in the whole domain in the %systemroot%\ntds\ntds.dit file. It can be parsed with Impacket’s secretsdump.py.
See also Windows password files post.
Secretsdump.py
Required: Domain Admin user account and password.
Get the krbtgt credentials (e.g. to perform Golden Ticket attacks afterwards):
secretsdump.py domain.local/svcsqlserver:$password@$dc-ip -just-dc-user krbtgt
Skeleton Key (Generalschlüssel)
When having domain admin access to the DC, a malware can be injected into the memory which patches the authentication to check against the normal processes (NTLM/Kerberos) and a constant string. An attacker can then use this constant string as password to obtain any ticket. There is no need to crack a domain admin’s password anymore.
Mimikatz has integrated this patch. Execute the following on a DC with domain admin access:
privilege::debug
misc::skeleton
That’s it. Now, the password mimikatz is valid for all users in the whole domain. Notes:
- This does not affect the “real” credentials. All users can authenticate as before.
- The patch is applied in the memory. After the DC restarts, the skeleton key is not longer available. (But hey, who ever restarts a DC…?)
DCShadow
DCShadow makes another system to a primary DC. On this temporary DC, actions can be performed like password changes, which propagate to the “real” (now secondary) DC and all other systems but without having logging events on these systems. The logging takes place on the “faked” DC.
On an attacker (Windows Server-) system, execute Mimikatz. Make all changes there and then make the “real” DC again to the primary DC.
Notes
- SPN Service Principal Name is used to determine a specific service within a AD.
- Article with attack techniques
- To prevent password reusage, the DC normally stores the current and the previous password (in Mimikatz ntlm‑0 and ntlm‑1). Maybe the old hash/password can work somewhere…?
- DFSR Distributed File System Replication: A standard AD service which synchronizes directories on all AD-joined systems. Is used to replicate small configurations on every device. (The other, for users visible way, is samba.)
Countermeasures
- Check if there are tickets somewhere with a life-span which is too long. (Can be up to 10 years, which is used by most tools, but “normal” tickets have a lifetime only for some minutes/hours.)
- Check periodic on end-user systems (e.g. with klist) if there are tickets with a validity time which is too long.
- Monitor the DCs log for logs about new DCs/replications.
Leave a Reply
You must be logged in to post a comment.