{"id":1275,"date":"2015-01-19T19:12:21","date_gmt":"2015-01-20T00:12:21","guid":{"rendered":"http:\/\/adsecurity.org\/?p=1275"},"modified":"2015-04-12T23:48:09","modified_gmt":"2015-04-13T03:48:09","slug":"attackers-can-now-use-mimikatz-to-implant-skeleton-key-on-domain-controllers-backdoor-your-active-directory-forest","status":"publish","type":"post","link":"https:\/\/adsecurity.org\/?p=1275","title":{"rendered":"Attackers Can Now Use Mimikatz to Implant Skeleton Key on Domain Controllers &#038; BackDoor Your Active Directory Forest"},"content":{"rendered":"<p>Once an attacker has gained Domain Admin rights to your Active Directory environment, there are several methods for keeping privileged access. Skeleton Key is an ideal persistence method for the modern attacker. More information on <a title=\"Active Directory Domain Controller Skeleton Key Malware &amp; Mimikatz\" href=\"https:\/\/adsecurity.org\/?p=1255\">Skeleton Key is in my earlier post<\/a>.<\/p>\n<p>Note that the behavior documented in this post was observed in a lab environment using the version of Mimikatz shown in the screenshot. There are likely differences in the Skeleton Key malware documented by Dell SecureWorks and the Mimikatz skeleton key functionality. Mimikatz effectively &#8220;patches&#8221; LSASS to enable use of a master password with any valid domain user. Rebooting the DC refreshes the memory which removes the &#8220;patch&#8221;.<\/p>\n<h4><span style=\"text-decoration: underline;\"><strong>Implanting the Mimikatz Skeleton Key on one or multiple Domain Controllers:<\/strong><\/span><\/h4>\n<p>Mimikatz can now inject a skeleton key into LSASS on the Domain Controller by running the following command on the DC:<\/p>\n<blockquote><p>mimikatz.exe &#8220;privilege::debug&#8221; &#8220;misc::skeleton&#8221; exit<\/p><\/blockquote>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-Skeleton-Implant.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1260\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-Skeleton-Implant.png\" alt=\"Mimikatz-Skeleton-Implant\" width=\"622\" height=\"280\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-Skeleton-Implant.png 733w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-Skeleton-Implant-300x135.png 300w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><\/a><\/p>\n<p>When there are multiple Domain Controllers in an Active Directory site, all of them need the Skeleton Key implant to ensure the skeleton key master password is accepted as the user&#8217;s valid password.. Since the client discovers a Domain Controller using DCLocator, the DC the client selects is effectively random. If all the DCs don&#8217;t have skeleton key configured, the master password won&#8217;t work when the client authenticates to a DC without skeleton key.<\/p>\n<p><strong>Scenario:<\/strong><\/p>\n<p><!--more-->Either the attacker exploits <a title=\"PyKEK Kerberos Packets on the Wire aka How the MS14-068 Exploit Works\" href=\"https:\/\/adsecurity.org\/?p=763\">MS14-068 <\/a>or has the <a title=\"Kerberos &amp; KRBTGT: Active Directory\u2019s Domain Kerberos Account\" href=\"https:\/\/adsecurity.org\/?p=483\">KRBTGT <\/a>NTLM password hash and uses it to generate a Kerberos Golden Ticket to impersonate a valid Domain Admin account. The attacker leverages the forged Kerberos TGT ticket to access the Domain Controllers via PowerShell remoting. PowerShell remoting runs over WinRM and provides a shell running on the remote computer (much like SSH). In this case, the attacker runs a PowerShell script that uses &#8220;invoke-command&#8221; to run the mimikatz command on the DCs.<\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-Skeleton-Implant-GoldenTicket-PSRemotingScript.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1278\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-Skeleton-Implant-GoldenTicket-PSRemotingScript.png\" alt=\"Mimikatz-Skeleton-Implant-GoldenTicket-PSRemotingScript\" width=\"695\" height=\"440\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-Skeleton-Implant-GoldenTicket-PSRemotingScript.png 884w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-Skeleton-Implant-GoldenTicket-PSRemotingScript-300x190.png 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/a><\/p>\n<h4><span style=\"text-decoration: underline;\"><strong>Domain Controller Security Events When Implanting the Mimikatz Skeleton Key:<\/strong><\/span><\/h4>\n<p>When implanting the skeleton key remotely using <a href=\"http:\/\/blog.gentilkiwi.com\/mimikatz\">Mimikatz <\/a>the following events are logged on the Domain Controller.<br \/>\n<strong>Event Id 4673 Sensitive Privilege Use<\/strong>,<\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyImplant-DCSecurityEvent-46731.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1284\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyImplant-DCSecurityEvent-46731.png\" alt=\"Mimikatz-SkeletonKeyImplant-DCSecurityEvent-4673\" width=\"486\" height=\"392\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyImplant-DCSecurityEvent-46731.png 632w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyImplant-DCSecurityEvent-46731-300x242.png 300w\" sizes=\"auto, (max-width: 486px) 100vw, 486px\" \/><\/a><\/p>\n<p><strong>Event 4611: A trusted logon process has been registered with the Local Security Authority.<\/strong><\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4611.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1312\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4611.png\" alt=\"Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4611\" width=\"436\" height=\"337\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4611.png 572w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4611-300x232.png 300w\" sizes=\"auto, (max-width: 436px) 100vw, 436px\" \/><\/a><\/p>\n<p>If Process Tracking (logging) is enabled, there are two events that are logged reliably.<\/p>\n<p><strong>Event 4688: A new process has been created.<\/strong><\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4688.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1325\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4688.png\" alt=\"Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4688\" width=\"574\" height=\"375\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4688.png 850w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4688-300x196.png 300w\" sizes=\"auto, (max-width: 574px) 100vw, 574px\" \/><\/a><\/p>\n<p><strong>Event 4689: A new process has exited.<\/strong><\/p>\n<p><strong><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4689.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1326\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4689.png\" alt=\"Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4689\" width=\"525\" height=\"462\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4689.png 562w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKeyLocalImplant-DCSecurityEvent-4689-300x264.png 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/a><\/strong><\/p>\n<h4><span style=\"text-decoration: underline;\"><strong>Authenticating with the Mimikatz Skeleton Key:<\/strong><\/span><\/h4>\n<p>Testing user password and user account with skeleton key password.<br \/>\nNote that both passwords are accepted &#8211; the valid user password and the skeleton key master password!<\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKey-ShareConnect-Admin-DifferentPassword-Success1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1283\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKey-ShareConnect-Admin-DifferentPassword-Success1.png\" alt=\"Mimikatz-SkeletonKey-ShareConnect-Admin-DifferentPassword-Success\" width=\"695\" height=\"206\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKey-ShareConnect-Admin-DifferentPassword-Success1.png 884w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKey-ShareConnect-Admin-DifferentPassword-Success1-300x89.png 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/a><\/p>\n<p>Testing Domain Admin account with password &amp; skeleton key password.<br \/>\nNote that both passwords are accepted &#8211; the valid user password and the skeleton key master password!<\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKey-ShareConnect-DifferentPassword-Success2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1285\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKey-ShareConnect-DifferentPassword-Success2.png\" alt=\"Mimikatz-SkeletonKey-ShareConnect-DifferentPassword-Success\" width=\"693\" height=\"244\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKey-ShareConnect-DifferentPassword-Success2.png 888w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-SkeletonKey-ShareConnect-DifferentPassword-Success2-300x106.png 300w\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" \/><\/a><\/p>\n<h4><span style=\"text-decoration: underline;\"><strong>\u00a0Skeleton Key Mitigation:<\/strong><\/span><\/h4>\n<ul>\n<li>Protect domain-level admin (DLA) accounts (Domain Admin, Administrators, etc) which reduces the risk of attackers gaining access to these credentials. Don&#8217;t let DLA accounts logon to systems at a different security level from Domain Controllers. Don&#8217;t let services run as Domain Admin on member servers that aren&#8217;t protected at the same level as DCs.<\/li>\n<li>Enable smart card authentication for all users.<\/li>\n<li>Ensure Domain Controllers have limited connectivity to the network until MS14-068 is patched (<a href=\"http:\/\/support.microsoft.com\/kb\/3011780\">kb3011780<\/a>). The challenge is that the patch has to be applied after DCPromo is complete.<\/li>\n<li>Security software that prevents LSASS patching may mitigate the issue.<\/li>\n<li>Application whitelisting (ex. AppLocker) can prevent unapproved applications from running on Domain Controllers.<\/li>\n<li>Enabling Process Logging on Domain Controllers provides additional data on what applications (exes) are executed on Domain Controllers.<\/li>\n<li>Enable <a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/dn408187.aspx\">LSASS as a protected process on Windows Server 2012 R2<\/a> (Mimikatz can bypass with a driver, but that should make some noise in the event logs):<\/li>\n<\/ul>\n<blockquote><p>The LSA, which includes the Local Security Authority Server Service (LSASS) process, validates users for local and remote sign-ins and enforces local security policies. The Windows 8.1 operating system provides additional protection for the LSA to prevent reading memory and code injection by non-protected processes. This provides added security for the credentials that the LSA stores and manages.<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<blockquote>\n<div>\n<h4><strong><span style=\"color: #000000;\"><a class=\"LW_CollapsibleArea_TitleAhref\" style=\"color: #000000;\" title=\"Click to collapse. Double-click to collapse all.\"><span class=\"LW_CollapsibleArea_Title\">To enable LSA protection on a single computer<\/span><\/a><\/span><\/strong><\/h4>\n<div class=\"sectionblock\">\n<ol class=\"ordered\">\n<li>Open the Registry Editor (RegEdit.exe), and navigate to the registry key that is located at: HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa.<\/li>\n<li>Set the value of the registry key to: &#8220;RunAsPPL&#8221;=dword:00000001.<\/li>\n<li>Restart the computer.<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<div>\n<h4><strong><span style=\"color: #000000;\"><a class=\"LW_CollapsibleArea_TitleAhref\" style=\"color: #000000;\" title=\"Click to collapse. Double-click to collapse all.\"><span class=\"LW_CollapsibleArea_Title\">To enable LSA protection using Group Policy<\/span><\/a><\/span><\/strong><\/h4>\n<div class=\"sectionblock\">\n<ol class=\"ordered\">\n<li>Open the Group Policy Management Console (GPMC).<\/li>\n<li>Create a new GPO that is linked at the domain level or that is linked to the organizational unit that contains your computer accounts. Or you can select a GPO that is already deployed.<\/li>\n<li>Right-click the GPO, and then click <strong>Edit<\/strong> to open the Group Policy Management Editor.<\/li>\n<li>Expand <strong>Computer Configuration<\/strong>, expand <strong>Preferences<\/strong>, and then expand <strong>Windows Settings<\/strong>.<\/li>\n<li>Right-click <strong>Registry<\/strong>, point to <strong>New<\/strong>, and then click <strong>Registry Item<\/strong>. The <strong>New Registry Properties<\/strong> dialog box appears.<\/li>\n<li>In the <strong>Hive<\/strong> list, click <strong>HKEY_LOCAL_MACHINE<\/strong>.<\/li>\n<li>In the <strong>Key Path<\/strong> list, browse to <strong>SYSTEM\\CurrentControlSet\\Control\\Lsa<\/strong>.<\/li>\n<li>In the <strong>Value name<\/strong> box, type <strong>RunAsPPL<\/strong>.<\/li>\n<li>In the <strong>Value type<\/strong> box, click the <strong>REG_DWORD<\/strong>.<\/li>\n<li>In the <strong>Value data<\/strong> box, type <strong>00000001<\/strong>.<\/li>\n<li>Click <strong>OK<\/strong>.<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/blockquote>\n<p>&nbsp;<\/p>\n<p><strong>\u00a0Mimikatz bypassing LSA Protection:<\/strong><\/p>\n<p><a href=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-Bypass-LSASS-ProtectedProcess2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1339\" src=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-Bypass-LSASS-ProtectedProcess2.png\" alt=\"Mimikatz-Bypass-LSASS-ProtectedProcess\" width=\"436\" height=\"417\" srcset=\"https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-Bypass-LSASS-ProtectedProcess2.png 523w, https:\/\/adsecurity.org\/wp-content\/uploads\/2015\/01\/Mimikatz-Bypass-LSASS-ProtectedProcess2-300x287.png 300w\" sizes=\"auto, (max-width: 436px) 100vw, 436px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Once an attacker has gained Domain Admin rights to your Active Directory environment, there are several methods for keeping privileged access. Skeleton Key is an ideal persistence method for the modern attacker. More information on Skeleton Key is in my earlier post. Note that the behavior documented in this post was observed in a lab &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"https:\/\/adsecurity.org\/?p=1275\">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,101,415,71,411,416,414],"class_list":["post-1275","post","type-post","status-publish","format-standard","hentry","category-microsoft-security","category-technical-reference","tag-activedirectory","tag-domaincontroller","tag-lsa","tag-lsass","tag-mimikatzskeleton","tag-patchlsass","tag-skeletonkey","item-wrap"],"_links":{"self":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/1275","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=1275"}],"version-history":[{"count":26,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/1275\/revisions"}],"predecessor-version":[{"id":1340,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/1275\/revisions\/1340"}],"wp:attachment":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}