- A script to Detect if the HiveNightmare problem exists
- A script to Remediate the HiveNightmare problem and remove existing Shadow Copies
- HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsNT\Printers\PointAndPrint
NoWarningNoElevationOnInstall = 0 (DWORD)or not defined (default setting)UpdatePromptSettings = 0 (DWORD)or not defined (default setting)
RestrictDriverInstallationToAdministrators = 0
Get-Service -Name Spooler
Get-ItemProperty HKLM:HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows NT\Printers\PointAndPrint -Name "RestrictDriverInstallationToAdministrators"
Look for the creation of suspicious DLL files spawned in the \spool\ folder along with DLLs that were recently loaded afterwards from \Old. Query:
DeviceFileEvents
| where FolderPath contains @"\system32\spool\drivers\x64\3\"
| where FileName endswith ".dll"
| where ActionType in ("FileCreated", "FileRenamed")
| join kind=inner DeviceImageLoadEvents on DeviceId,DeviceName,FileName,InitiatingProcessFileName
| where Timestamp1 >= Timestamp and FolderPath1 contains @"\system32\spool\drivers\x64\3\Old"
Creation of suspicious files in the /spools/driver/ folder. This is a broad-based search that will surface any creation or modification of files in the folder targeted by this exploit. False Positives for legitimate driver activity (when that activity should be present) in this folder are possible:
DeviceFileEvents
| where FolderPath has @"System32\spool\drivers"
| project DeviceName,Timestamp,ActionType,FolderPath,FileName,SHA1
Automate the addition of RestrictDriverInstallationToAdministrators registry value
To automate the addition of the RestrictDriverInstallationToAdministrators registry value, follow these steps:
Open a Command Prompt window (cmd.exe) with elevated permissions.
Type the following command and then press Enter:
reg add "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows NT\Printers\PointAndPrint" /v RestrictDriverInstallationToAdministrators /t REG_DWORD /d 1 /f
Set RestrictDriverInstallationToAdministrators using Group Policy
After installing updates released October 12, 2021 or later, you can also set RestrictDriverInstallationToAdministrators using a Group Policy, using the following instructions:
Open the group policy editor tool and go to Computer Configuration > Administrative Templates > Printers.
Set the Limits print driver installation to Administrators setting to "Enabled". This will set the registry value of RestrictDriverInstallationToAdministrators to 1.
vssadmin list shadows
A vulnerable system will report BUILTIN\Users:(I)(RX) in the output
icacls $env:windir\system32\config\sam
vssadmin delete shadows /for=%systemdrive% /Quiet
This could be a way to verify the return for compliance check
icacls $env:windir\system32\config\*.* /inheritance:e