Services File Permissions Weakness
Adversaries may replace service executable binaries by exploiting weak file or directory permissions on service binaries. Windows services run with specific account privileges (often SYSTEM, LocalService, or NetworkService). If the permissions on the service binary or its parent directory allow non-privileged users to write, an adversary can overwrite the binary with a malicious payload. When the service starts (on reboot or manually), the malicious binary executes at the service's privilege level. BlackEnergy malware used this technique to replace disabled driver service binaries and then re-enable the service for persistence. PowerSploit's Get-ModifiableServiceFile discovers exploitable service binaries.
DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType in ("FileModified", "FileCreated")
| where FileName endswith ".exe" or FileName endswith ".dll"
| where FolderPath has_any ("\\Program Files\\", "\\Program Files (x86)\\", "\\Windows\\")
| where not(InitiatingProcessFileName in~ ("msiexec.exe", "wusa.exe", "trustedinstaller.exe", "svchost.exe"))
| where InitiatingProcessAccountName != "SYSTEM"
| where InitiatingProcessAccountName != "NT AUTHORITY"
| where InitiatingProcessAccountName != ""
| join kind=leftouter (
DeviceRegistryEvents
| where Timestamp > ago(24h)
| where RegistryKey has "Services"
| where RegistryValueName =~ "ImagePath"
| extend ServiceName = extract(@"Services\\([^\\]+)\\ImagePath", 1, RegistryKey)
| project DeviceId, ServiceName, ImagePath=RegistryValueData
) on DeviceId
| where ImagePath has FileName
| project Timestamp, DeviceName, AccountName=InitiatingProcessAccountName, FileName, FolderPath, ServiceName, SHA256
| sort by Timestamp desc Data Sources
Required Tables
False Positives
- Software auto-updaters that replace service binaries during updates (often run with user-level permissions rather than SYSTEM)
- IT management tools (SCCM, Intune) that update service binaries as part of software deployment
- Antivirus self-update mechanisms that replace their own service binaries
- Some developer workflows where the developer account has write access to Program Files for testing
Unlock Pro Content
Get the full detection package for T1574.010 including response playbook, investigation guide, and atomic red team tests.