{"id":1441,"date":"2015-02-18T23:28:00","date_gmt":"2015-02-19T04:28:00","guid":{"rendered":"http:\/\/adsecurity.org\/?p=1441"},"modified":"2015-02-19T21:14:17","modified_gmt":"2015-02-20T02:14:17","slug":"interesting-krbtgt-password-reset-behavior","status":"publish","type":"post","link":"https:\/\/adsecurity.org\/?p=1441","title":{"rendered":"Interesting KRBTGT Password Reset Behavior"},"content":{"rendered":"<p>Following up on Twitter conversations (@passingthehash, @scriptjunkie1, gentilkiwi, etc) on the new <a href=\"https:\/\/gallery.technet.microsoft.com\/Reset-the-krbtgt-account-581a9e51\">KRBTGT Password Reset Script<\/a> and <a href=\"http:\/\/passing-the-hash.blogspot.com\/2015\/02\/microsoft-finally-releases-guidance-and.html\">Skip Duckwall&#8217;s (@passingthehash) blog post on how KRBTGT password changes work<\/a>.<\/p>\n<p><a href=\"http:\/\/support.microsoft.com\/kb\/2549833\/en-us\">Microsoft KB2549833 states that the KRBTGT password is set automatically<\/a> to a random string when a new password is entered.<\/p>\n<blockquote><p>This occurs because there is special logic when changing the password for krbtgt. While the Active Directory Users and Computers (dsa.msc) snap-in allows you to enter a password, it won&#8217;t be used when changing the password. Instead, the Active Directory creates a very long string of random bits to use as the password.<\/p><\/blockquote>\n<p>Benjamin Delpy posted on <a href=\"http:\/\/pastebin.com\/87gSxN8F\">Pastebin <\/a>the RPC calls performed when the KRBTGT password is changed.<\/p>\n<blockquote><p>[rpc call]<br \/>\nSamrSetInformationUser<br \/>\nSampStoreUserPasswords<br \/>\nSampRestrictAndRandomizeKrbtgtPassword<br \/>\nSampGenerateRandomPassword<br \/>\nCDGenerateRandomBits<\/p><\/blockquote>\n<p>Thanks to the information in the links above, we know that after setting the KRBTGT password to a known value, the DC automagically changes the password to a system-generated password.<br \/>\n<a title=\"Kerberos &amp; KRBTGT: Active Directory\u2019s Domain Kerberos Service Account\" href=\"https:\/\/adsecurity.org\/?p=483\">More information on KRBTGT.<\/a><\/p>\n<p>Skip wonders in his post (linked above) what would happen if an Active Directory admin changed the KRBTGT password manually on several Domain Controllers to &#8220;speed up&#8221; replication. Any AD admin worth his\/her salt knows this a *bad* idea.<\/p>\n<p>I decided to try this out in an isolated lab environment with 4 DCs (Windows Server 2008 R2 DFL):<\/p>\n<ul>\n<li>DC01: Windows Server 2008 R2 [5 FSMOs]<\/li>\n<li>DC02, Windows Server 2008 R2 (not patched)<\/li>\n<li>DC04: Windows Server 2012<\/li>\n<li>DC05: Windows Server 2012 R2<\/li>\n<\/ul>\n<p>I wrote a quick PowerShell script that stops all Domain Controller replication in Active Directory, changes the KRBTGT password to a known value (&#8220;Password99!&#8221;), and restarts replication. After re-enabling replication across all DCs, I forced replication to ensure all DCs were communicating correctly. I was able to successfully log on as a user and connect to the SYSVOL share on each Domain Controller.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>The result:<\/strong> <\/span><\/p>\n<p>The KRBTGT password hash is the same as the Administrator account password which is set to &#8220;Password99!&#8221;<br \/>\nThis didn&#8217;t change even after rebooting all DCs.<\/p>\n<p>I ran through this test twice with the same result. It seems that at least in my isolated lab testing that changing the KRBTGT password when replication isn&#8217;t working can result in the password not being changed by the system. Setting the KRBTGT password with replication occurring normally results in a random, system-generated password.<\/p>\n<p><em><strong>NOTE: This is an isolated lab test and may not be representative in a lab environment.<\/strong> <\/em><\/p>\n<p><strong>Password Hash on DC04 after manual KRBTGT password change to &#8220;Password99!&#8221; before AD replication is re-enabled.<\/strong><\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC04.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1442\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC04.png\" alt=\"KRBTGT-PostPasswordChange-DC04\" width=\"644\" height=\"288\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC04.png 644w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC04-300x134.png 300w\" sizes=\"auto, (max-width: 644px) 100vw, 644px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Password Hash on DC05 after manual KRBTGT password change to &#8220;Password99!&#8221; before AD replication is re-enabled.<\/strong><\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC05.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1443\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC05.png\" alt=\"KRBTGT-PostPasswordChange-DC05\" width=\"644\" height=\"286\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC05.png 644w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC05-300x133.png 300w\" sizes=\"auto, (max-width: 644px) 100vw, 644px\" \/><\/a><\/p>\n<p><strong>Password Hash on DC01 after manual KRBTGT password change to &#8220;Password99!&#8221; before AD replication is re-enabled.<br \/>\n<\/strong>What&#8217;s interesting is that the password is the same as what&#8217;s set (this merits further investigation).<strong><br \/>\n<\/strong><\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1451\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC01.png\" alt=\"KRBTGT-PostPasswordChange-DC01\" width=\"644\" height=\"320\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC01.png 644w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC01-300x149.png 300w\" sizes=\"auto, (max-width: 644px) 100vw, 644px\" \/><\/a><\/p>\n<p><strong>Password Hash on DC02 after manual KRBTGT password change to &#8220;Password99!&#8221; before AD replication is re-enabled.<\/strong><\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1452\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC02.png\" alt=\"KRBTGT-PostPasswordChange-DC02\" width=\"528\" height=\"141\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC02.png 528w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-DC02-300x80.png 300w\" sizes=\"auto, (max-width: 528px) 100vw, 528px\" \/><\/a><\/p>\n<p><strong>After AD replication is re-enabled, this is what the KRBTGT password converged to.<br \/>\n<\/strong> <a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-ReplicationConvergence.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1444\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-ReplicationConvergence.png\" alt=\"KRBTGT-PostPasswordChange-ReplicationConvergence\" width=\"493\" height=\"122\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-ReplicationConvergence.png 493w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-ReplicationConvergence-300x74.png 300w\" sizes=\"auto, (max-width: 493px) 100vw, 493px\" \/><\/a><\/p>\n<p><strong>Here&#8217;s a comparison of the repadmin output for the KRBTGT account password attribute (unicodePwd) after the password change.<\/strong><br \/>\nThe first block shows that the originating DC for the password change is the DC targeted. Since Replication is disabled, the password change doesn&#8217;t replicate out.<br \/>\nThe second block shows that the password change on DC01 trumped the others.<\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-ReplicationStatus.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1445\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-ReplicationStatus.png\" alt=\"KRBTGT-PostPasswordChange-ReplicationStatus\" width=\"689\" height=\"170\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-ReplicationStatus.png 689w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-ReplicationStatus-300x74.png 300w\" sizes=\"auto, (max-width: 689px) 100vw, 689px\" \/><\/a><\/p>\n<p><strong>The AD credential dump shows the auto-generated password hash is different from the Administrator one (before replication).<\/strong><\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-Password-After-Change.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1448\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-Password-After-Change.png\" alt=\"KRBTGT-Password-After-Change\" width=\"447\" height=\"253\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-Password-After-Change.png 447w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-Password-After-Change-300x170.png 300w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><\/a><\/p>\n<p><strong>After full replication, the KRBTGT password hash is the same as the Administrator password hash, meaning that the password is the same.<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-AD-CredsDump.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1450\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-AD-CredsDump.png\" alt=\"KRBTGT-PostPasswordChange-AD-CredsDump\" width=\"493\" height=\"217\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-AD-CredsDump.png 493w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/02\/KRBTGT-PostPasswordChange-AD-CredsDump-300x132.png 300w\" sizes=\"auto, (max-width: 493px) 100vw, 493px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Following up on Twitter conversations (@passingthehash, @scriptjunkie1, gentilkiwi, etc) on the new KRBTGT Password Reset Script and Skip Duckwall&#8217;s (@passingthehash) blog post on how KRBTGT password changes work. Microsoft KB2549833 states that the KRBTGT password is set automatically to a random string when a new password is entered. This occurs because there is special logic &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"https:\/\/adsecurity.org\/?p=1441\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,2],"tags":[20,189,394,463,207],"class_list":["post-1441","post","type-post","status-publish","format-standard","hentry","category-microsoft-security","category-technical-reference","tag-activedirectory","tag-adreplication","tag-krbtgt","tag-krbtgtpasswordreset","tag-mimikatz","item-wrap"],"_links":{"self":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/1441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1441"}],"version-history":[{"count":8,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/1441\/revisions"}],"predecessor-version":[{"id":1461,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/1441\/revisions\/1461"}],"wp:attachment":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}