Local Windows Password Attacks
SAM database
For non-domain joined Windows system
TL;DR
The idea is making a copy of three registry hives. Then transfer those copies to our attacking machine, dump the creds and then crack the NT hash.
Here are our target registry hives:
hklm\sam : Contains the hashes associated with local account passwords. We will need the hashes so we can crack them and get the user account passwords in cleartext.
hklm\system : Contains the system bootkey, which is used to encrypt the SAM database. We will need the bootkey to decrypt the SAM database.
hklm\security : Contains cached credentials for domain accounts. We may benefit from having this on a domain-joined Windows target.
Create backup of the hives (cmd launched as admin):
Technically we will only need hklm\sam & hklm\system, but hklm\security can also be helpful to save as it can contain hashes associated with cached domain user account credentials present on domain-joined hosts.
C:\WINDOWS\system32 > reg.exe save hklm\sam C:\sam.save
The operation completed successfully.
C:\WINDOWS\system32 > reg.exe save hklm\system C:\system.save
The operation completed successfully.
C:\WINDOWS\system32 > reg.exe save hklm\security C:\security.save
The operation completed successfully.Transfer the backup files to our attacking machine
Creating an SMB share (smbserver.py)
Moving the copies:
Dumping the hashes from hives (secretsdump.py)
Cracking the dumped hashes
Done for the local part for now. This could be done remotely when we have local admin priv for a user. The remote command is below
Remote Dumping and LSA secrets
Local admin privileges required
LSASS service

LSASS is a critical service that plays a central role in credential management and the authentication processes in all Windows operating systems.
Upon initial logon, LSASS will:
Cache credentials locally in memory
Create access tokens
Enforce security policies
Write to Windows security log
Dumping LSASS Process Memory
TL;DR
We will dump LSASS process memory, as the name describes it, with two methods, one that replies on GUI interface and the other doesnt. Then upon transferring it to out attacking host, we will proceed to dump the creds from that file and crack the NT hash.
Task Manager Method

This will create a file at :
And then we can transfer it with whatever method we choose.
Rundll32.exe & Comsvcsdll Method
Before issuing the command to create the dump file, we must determine what process ID (PID) is assigned to lsass.exe.
This file will then be transferred to our machine and we then proceed to dump creds and crack them. For that we will use Pypykatz, a python-version of Mimikatz which runs only on Windows.
Dumping the creds
Some interesting parts in the findings are:
MSV : MSV is an authentication package in Windows that LSA calls on to validate logon attempts against the SAM database. Pypykatz extracted the
SID,Username,Domain, and even theNT&SHA1password hashes associated with the bob user account's logon session stored in LSASS process memory. This will prove helpful in the final stage of our attack covered at the end of this section.WDIGEST is an older authentication protocol enabled by default in
Windows XP-Windows 8andWindows Server 2003-Windows Server 2012. LSASS caches credentials used by WDIGEST in clear-text. This means if we find ourselves targeting a Windows system with WDIGEST enabled, we will most likely see a password in clear-text. Modern Windows operating systems have WDIGEST disabled by default. Additionally, it is essential to note that Microsoft released a security update for systems affected by this issue with WDIGEST. We can study the details of that security update here.Kerberos : Kerberos is a network authentication protocol used by Active Directory in Windows Domain environments. Domain user accounts are granted tickets upon authentication with Active Directory. This ticket is used to allow the user to access shared resources on the network that they have been granted access to without needing to type their credentials each time. LSASS
caches passwords,ekeys,tickets, andpinsassociated with Kerberos. It is possible to extract these from LSASS process memory and use them to access other systems joined to the same domain.DPAPI : The Data Protection Application Programming Interface or DPAPI is a set of APIs in Windows operating systems used to encrypt and decrypt DPAPI data blobs on a per-user basis for Windows OS features and various third-party applications. Mimikatz and Pypykatz can extract the DPAPI
masterkeyfor the logged-on user whose data is present in LSASS process memory. This masterkey can then be used to decrypt the secrets associated with each of the applications using DPAPI and result in the capturing of credentials for various accounts.
AD & NTDS.dit dictionary
For Remote/Domain joined Hosts.
After gaining some valid creds, whether from some google dorks, OSINT, social engineering or custom wordlists (with username-anarchy for example), we can then try to bruteforce our way in with crackmapexec with smb using :
Connecting to the target
To make a copy of the NTDS.dit file, we need local admin (Administrators group) or Domain Admin (Domain Admins group) (or equivalent) rights. We also will want to check what domain privileges we have.
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 is very likely that NTDS will be stored on C: as that is the default location selected at install, but it is possible to change the location. We use VSS for this because it is designed to make copies of volumes that may be read & written to actively without needing to bring a particular application or system down. VSS is used by many different backup & disaster recovery software to perform operations.
It is important to note that we need to import the system bootkey which resides in the hklm/system hive using the methods in here.
After importing both to our machine we use this command:
Then
Moving the copy
Look in here for the first method.
Using crackmapexec
Another faster method is using cme, which does all of the above with just one command.
Cracking the hash
Of course the cracking may be unsuccessful, one consideration is using Pass-the-Hash method which takes advantage of the NTLM authentication protocol.
Instead of username:clear-text password as the format for login, we can instead use username:password hash.
This could be done using :
Creds Hunting In Windows
Coming 😄
Last updated