Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Group Policies / Defending Windows Domain Against Mimikatz Attacks

December 7, 2017 Group PoliciesSecurity

Defending Windows Domain Against Mimikatz Attacks

The IT community remembered late June, 2017, due to massive infection of many largest companies and government institutions in Ukraine, Russia, Germany, France and some other countries with a new ransomware Petya (NotPetya). In most cases, after its penetration into a corporate network Petya quickly spread to all computers and servers of a domain, thus paralysing up to 70-100% of all Windows infrastructure. Though one of the methods Petya used to spread to the network computers was the EternalBlue exploit (like in case with WannaCry malware), but it was not the main channel of the ransomware distribution. Unlike WCry, spreading only due to the SMBv1 vulnerability, NotPetya had been designed to attack corporate networks. After the system had been infected, the malware obtained the credentials (passwords, hashes) of computer users with the help of the publicly available Mimikatz tool and used them to spread further in the network via WMI and PsExec, up to total control over the domain. So, to protect against it, it was not enough just to install MS17-010 security update.

In this article, we’ll look at the basic techniques for defending Windows systems in the Active Directory domain against Mimikatz-like tools attacks .

Using sekurlsa module, Mimikatz allows to extract passwords and hashes of the authenticated users that are stored in LSASS.EXE (Local Security Subsystem Service ) system process. We have already had an article giving the example of using mimikatz to get user passwords in clear text (from WDigest, LiveSSP and SSP).

Contents:
  • How to Prevent Getting Debug Privileges
  • Disabling WDigest
  • LSA Protection Against Connection of Third-Party Modules
  • How to Disable LM and NTLM
  • How to Disable Reversible Encryption
  • Protected Users Security Group
  • How Prevent the use of saved passwords
  • How to Disable Credential Caching
  • Credential Guard
  • Conclusion

How to Prevent Getting Debug Privileges

In the article following the link above, you can see how using the debug privilege allows Mimikatz to get access to LSASS system process and extract passwords from it.

By default, the permissions to use debug mode are given to the group of local administrators (BUILTIN\Administrators). Although in 99% of cases the administrators do not use this feature (as a rule, it is necessary for system programmers), so for the security purposes it is better to disable SeDebugPrivilege. You can do it using GPO (local or domain one). Go to Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> User Rights Assignment and enable the policy Debug Program. Add the domain group of users to it who may need debug privileges (as a rule, these are the developers) or leave this group empty so that nobody has these privileges.

Windows security policy against mimikatz - disable Debug Program privelegies

Now if you try to get debug privileges using mimikatz, the following error will appear:

ERROR kuhl_m_privilege_simple ; RtlAdjustPrivilege (20) c0000061

mimikatz: ERROR kuhl_m_privilege_simple ; RtlAdjustPrivilege (20) c0000061

Note. However, the restrictions of this policy can be easily circumvented. See an article How to Obtain SeDebugPrivilege

Disabling WDigest

WDigest protocol appeared in Windows XP and was used to perform HTTP Digest Authentication that used user passwords in clear text. The feature to totally prohibit storing passwords in clear text in LSASS appeared in Windows 8.1 and Server 2012 R2. To prohibit storing WDigest in the memory, in these OSs there is the DWORD parameter with the name UseLogonCredential and the value 0 in the following branch of the registry: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SecurityProviders\WDigest.

If you want to completely disable WDigest authentication method, set the value of Negotiate parameter to 0 in the same registry branch (HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\SecurityProviders\WDigest).

To enable this feature in Windows 7, 8 and Windows Server 2008 R2 / 2012, install KB2871997 update and then set these keys in the registry. In the domain environment, it is easier to distribute the registry keys using GPO.

disable wdigest via registry key UseLogonCredential

Tip. If you want to disable storing WDigest in the memory, first of all test if users and applications are correctly authenticated on your IIS servers.

LSA Protection Against Connection of Third-Party Modules

In Windows 8.1 and Windows Server 2012 R2, there appeared an opportunity to enable LSA protection that provided LSA memory protection and prevented unprotected processes from accessing to it. To enable this type of protection, create RunAsPPL parameter with the value 1 in the following registry branch: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA.

After this parameter has been applied, a hacker will not be able to get access to LSA memory, and mimikatz will return the following error to securlsa::logonpassword command:

ERROR kuhl_m_securlsa_acquireLSA : Handle on memory (0x00000005).

mimikatz securlsa::logonpassword - ERROR kuhl_m_securlsa_acquireLSA : Handle on memory (0x00000005).

How to Disable LM and NTLM

An obsolete protocol of LM authentication, an storing LM hashes, respectively, should be disabled using Network Security: Do Not Store LAN Manager Hash Value On Next Password Change group policy (on the level of Default Domain Policy).

Then you should stop using at least NTLMv1 protocol (the policy in the section Computer Configuration -> Policies -> Windows Settings -> Security Settings -> Local Policies -> Security Options  —  Network Security: Restrict NTLM: NTLM authentication in this domain), or NTLMv2 as well, which is even better.

If disabling NTLMv1 usually goes without any problems, you will have to put some effort to disable NTLMv2. In the large infrastructures, as a rule, they come to the scenario of maximum restriction on using NTLMv2. It means, Kerberos authentication should be used wherever it is possible (you will have to spend some time setting Kerberos authentication on IIS and SQL), and the rest of the systems should retain NTLMv2.

How to Disable Reversible Encryption

You should explicitly prohibit storing user passwords in AD in clear text. To do it, enable the domain policy Store password using reversible encryption for all users in the domain in the Computer Configuration -> Windows Settings ->Security Settings -> Account Policies -> Password Policy section and set its value to Disabled.

Disable policy Store password using reversible encryption for all users in the domain

Protected Users Security Group

When using the functional level of Windows Server 2012 R2 domain, you can use a special security group Protected Users to protect privileged users. In particular, these accounts are protected against compromise due to the fact that the members of the group can authenticate only using Kerberos (no NTLM, WDigest or CredSSP, etc.). Follow the link above to get more information. It is better to add the accounts of domain and servers administrators, to this group. This feature is available on the servers and will be available in Windows Server 2012 R2 (for Windows Server 2008 R2 you will have to install the above mentioned KB2871997 update).

How Prevent the use of saved passwords

You can prevent domain users from storing their passwords in Credential Manager to access the network resources.

To do it, enable Network access: Do not allow storage of passwords and credentials for network authentication policy in the Computer Configuration -> Windows Settings ->Security Settings ->Local Policies ->Security Options section.

Group Policy:Network access: Do not allow storage of passwords and credentials for network authentication

Note. Please, note that the storage of passwords will also be forbidden for the Task Scheduler jobs.

How to Disable Credential Caching

One of mimikatz features is getting hashes of user passwords from HKEY_LOCAL_MACHINE\SECURITY\Cache key of the registry, where the password hashes of last 10 (by default) logged on domain users are saved. Usually these hashes can be used to authenticate users in the system if the domain controller is not available.

It is recommended to prohibit storing the cached credentials by enabling Interactive Logon: Number of previous logons to cache (in case domain controller is not available) policy in Computer Configuration -> Windows Settings -> Local Policy -> Security Options by changing the value of its parameter to 0.

Disable Windows Credential Caching

Also, to accelerate LSASS memory clear from the credentials of logged off users, create a DWORD parameter with the name TokenLeakDetectDelaySecs and the value of 30 in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa. It means that the memory will be cleared in 30 seconds after the user has logged off. In Windows 7, 8/ Server 2008R2, 2012, you will have to install the above-mentioned KB2871997 update to make this key work.

Credential Guard

In Windows 10 Enterprise, Windows Server 2016 a new component, Credential Guard, has appeared that allows to isolate and protect LSASS from unauthorized access. For more information, click here.

Conclusion

The methods considered above allow to considerably restrict the opportunities of mimikatz and other tools to obtain passwords and hashes of the administrators from LSASS and the system registry. Anyway, if you decided to implement these policies and methods, you should do it step-by-step with mandatory testing.

In the next article we’ll consider the best practices to improve safety in Windows networks due to the restrictions of using administrator accounts that should improve the protection of Windows domain against such attacks on the technical and organizational levels. Watch for updates!

0 comment
5
Facebook Twitter Google + Pinterest
previous post
How to Clear Windows Event Logs Using PowerShell or Wevtutil
next post
Windows Update Error 0x80244022 and WsusPool Memory Limit

Related Reading

Clear Cache and Temp Files in User Profiles...

March 13, 2023

How to Disable NTLM Authentication in Windows Domain?

February 28, 2023

Group Policy Management in Active Directory

February 27, 2023

How to Add, Set, Delete, or Import Registry...

February 7, 2023

Configure User’s Folder Redirection with Group Policy

February 3, 2023

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • How to Run Program without Admin Privileges and Bypass UAC Prompt?

    March 24, 2023
  • Configure Network Settings on Windows with PowerShell: IP Address, DNS, Default Gateway, Static Routes

    March 24, 2023
  • Exchange Offline Address Book Not Updating in Outlook

    March 21, 2023
  • Attaching Host USB Devices to WSL or Hyper-V VM

    March 20, 2023
  • Sending an E-mail to a Microsoft Teams Channel

    March 17, 2023
  • How to Restore Deleted Users in Azure AD (Microsoft 365)?

    March 16, 2023
  • Fix: Remote Desktop Services Is Currently Busy

    March 15, 2023
  • Send-MailMessage: Sending E-mails with PowerShell

    March 14, 2023
  • Clear Cache and Temp Files in User Profiles on Windows (RDS) with PowerShell and GPO

    March 13, 2023
  • Prevent Users from Creating New Groups in Microsoft 365 (Teams/Outlook)

    March 6, 2023

Follow us

woshub.com
  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Backup/Restore and Export Local Group Policy Settings to Another Computer
  • How to Configure a Slideshow Screensaver Using GPO
  • Using WMI Filter to Apply Group Policy to IP Subnet
  • How to Block Viruses and Ransomware Using Software Restriction Policies
  • Troubleshoot Slow GPO Processing and Login Speed Impact
  • Recovering Encrypted Files from VSS Snapshot after Ransomware Infection
  • Securing Administrative (Priveleged) Accounts in Active Directory
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top