# Detection by Bronson M.
Get-ADDomain | ForEach-Object ReplicaDirectoryServers | ForEach-Object {
get-service -name spooler -ComputerName $_ -ErrorAction SilentlyContinue | Select-Object MachineName, Status, StartType
}
# Mitigation Option 1 Kill the Service on DCs
$DCs = get-addomaincontroller -filter * | Select-Object -expand hostname
foreach ($DC in $DCs) {
invoke-command -ComputerName $DC -ScriptBlock {
stop-service -name spooler ; set-service -name spooler -StartupType Disabled } }
# Mitigation Option #2
# Step 2a: Set Permissions
$Path = "C:\Windows\System32\spool\drivers"
$Acl = Get-Acl $Path
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule("System", "Modify", "ContainerInherit, ObjectInherit", "None", "Deny")
$Acl.AddAccessRule($Ar)
Set-Acl $Path $Acl
# Step 2b: Remove the Above
$Path = "C:\Windows\System32\spool\drivers"
$Acl = Get-Acl $Path
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule("System", "Modify", "ContainerInherit, ObjectInherit", "None", "Deny")
$Acl.RemoveAccessRule($Ar)
Set-Acl $Path $Acl