I'm currently learning about how hackers can decrypt files containing dumps of hashed passwords by using password dictionaries which contain a list of common passwords and comparing the hashed value of those with the ones in the password dump file.
It is very common during penetration tests where domain administrator access has been achieved to extract the password hashes of all the domain users for offline cracking and analysis. These hashes are stored in a database file in the domain controller (NTDS.DIT) with some additional information like group memberships and users.The NTDS.DIT file is constantly in use by the operating system and therefore cannot be copied directly to another location for extraction of information. This file can be found in the following Windows location:C:WindowsNTDSNTDS.ditThere are various techniques that can be used to extract this file or the information that is stored inside it however the majority of them are using one of these methods:. Domain Controller Replication Services.
Native Windows Binaries. WMIMimikatzMimikatz has a feature (dcsync) which utilises the Directory Replication Service (DRS) to retrieve the password hashes from the NTDS.DIT file. This technique eliminates the need to authenticate directly with the domain controller as it can be executed from any system that is part of the domain from the context of domain administrator. Therefore it is the standard technique for red teams as it is less noisy.lsadump::dcsync /domain:pentestlab.local /all /csv. Mimikatz – Dump domain hashes via lsadump EmpirePowerShell Empire has two modules which can retrieve domain hashes via the DCSync attack. Both modules needs to be executed from the perspective of domain administrator and they are using Microsoft replication services. These modules rely on the Invoke-Mimikatz PowerShell script in order to execute Mimikatz commands related to DCSync.
The following module will extract the domain hashes to a format similar to the output of Metasploit hashdump command.usemodule credentials/mimikatz/dcsynchashdump. Invoke-DCSync – Metasploit PWDump Format ntdsutilThe ntdsutil is a command line tool that is part of the domain controller ecosystem and its purpose is to enable administrators to access and manage the windows Active Directory database. However it can be abused by penetration testers and red teams to take a snapshot of the existing ntds.dit file which can be copied into a new location for offline analysis and extraction of password hashes.ntdsutilactivate instance ntdsifmcreate full C:ntdsutilquitquit. Ntdsutil – ntds DiskShadowDiskShadow is a Microsoft signed binary which is used to assist administrators with operations related to the Volume Shadow Copy Service (VSS). Originally wrote about this binary in his. This binary has two modes interactive and script and therefore a script file can be used that will contain all the necessary commands to automate the process of NTDS.DIT extraction. The script file can contain the following lines in order to create a new volume shadow copy, mount a new drive, execute the copy command and delete the volume shadow copy.set context persistent nowritersadd volume c: alias someAliascreateexpose%someAlias% z:exec 'cmd.exe' /c copy z:windowsntdsntds.dit c:exfilntds.ditdelete shadows volume%someAlias%resetIt should be noted that the DiskShadow binary needs to executed from the C:WindowsSystem32 path.
If it is called from another path the script will not executed correctly.diskshadow.exe /s c:diskshadow.txt. Transfer Files via CopyInstead of credentials if a Golden ticket has been generated it can be used for authentication with the domain controller via Kerberos. VssadminThe volume shadow copy is a Windows command line utility which enables administrators to take backups of computers, volumes and files even if they are in use by the operating system. Volume Shadow Copy is running as a service and requires the filesystem to be formatted as NTFS which all the modern operating systems are by default. From a Windows command prompt executing the following will create a snapshot of the C: drive in order files that are not normally accessible by the user to be copied into another location (local folder, network folder or removable media).vssadmin create shadow /for=C.
Vssadmin – Create Volume Shadow CopySince all the files in the C: drive have been copied into another location (HarddiskVolumeShadowCopy1) they are not directly used by the operating system and therefore can be accessed and copied into another location. The command copy and will copy the NTDS.DIT and SYSTEM files to a new created folder on the local drive named ShadowCopy.copy?GLOBALROOTDeviceHarddiskVolumeShadowCopy1WindowsNTDSNTDS.dit C:ShadowCopycopy?GLOBALROOTDeviceHarddiskVolumeShadowCopy1WindowsSystem32configSYSTEM C:ShadowCopy. Metasploit – Hashdump on DC fgdumpThe is an old executable file which can extract LanMan and NTLM password hashes. It can be executed locally or remotely if local administrator credentials have been acquired. During execution fgdump will attempt to disable the antivirus that might run on the system and if it is successful will write all the data in two files.
If there is an antivirus or an endpoint solution fgdump should not be used as a method of dumping password hashes to avoid detection since it is being flagged by most antivirus companies including Microsoft’s Windows Defender.fgdump.exe.