Detect Exploitation for Defense Evasion in Microsoft Sentinel
Adversaries may exploit a system or application vulnerability to bypass security features. Exploitation of a vulnerability occurs when an adversary takes advantage of a programming error in a program, service, or within the operating system software or kernel itself to execute adversary-controlled code. Vulnerabilities may exist in defensive security software that can be used to disable or circumvent them. Adversaries may have prior knowledge through reconnaissance that security software exists within an environment or they may perform checks during or shortly after the system is compromised for Security Software Discovery. There have also been examples of vulnerabilities in public cloud infrastructure and SaaS applications that may bypass defense boundaries, evade security logs, or deploy hidden infrastructure.
MITRE ATT&CK
- Tactic
- Defense Evasion
- Technique
- T1211 Exploitation for Defense Evasion
- Canonical reference
- https://attack.mitre.org/techniques/T1211/
KQL Detection Query
let SecurityProcesses = dynamic([
"MsMpEng.exe", "MsSense.exe", "SenseCncProxy.exe", "SenseIR.exe",
"csagent.exe", "CSFalconService.exe", "CSFalconContainer.exe",
"SentinelAgent.exe", "SentinelServiceHost.exe", "SentinelStaticEngine.exe",
"CylanceSvc.exe", "CylanceUI.exe",
"cb.exe", "CbDefense.exe", "CbDefenseService.exe",
"mbam.exe", "MBAMService.exe",
"sophosssp.exe", "SophosSafestore.exe", "SAVService.exe",
"avp.exe", "avpui.exe",
"avgnt.exe", "avguard.exe",
"SEDService.exe", "SpybotSD.exe",
"aswBoot.exe", "AvastSvc.exe"
]);
let ExploitChildProcesses = dynamic([
"cmd.exe", "powershell.exe", "pwsh.exe", "wscript.exe", "cscript.exe",
"mshta.exe", "rundll32.exe", "regsvr32.exe", "certutil.exe",
"bitsadmin.exe", "msiexec.exe", "csc.exe", "msbuild.exe",
"wmic.exe", "net.exe", "net1.exe", "sc.exe"
]);
// Signal 1: Security software spawning suspicious child processes (post-exploitation execution)
let ExploitedSecurityProcess = DeviceProcessEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName has_any (SecurityProcesses)
| where FileName has_any (ExploitChildProcesses)
| extend DetectionSignal = "SecuritySoftwareSpawnedSuspiciousChild"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine, DetectionSignal;
// Signal 2: Security processes accessing other processes with PROCESS_ALL_ACCESS or PROCESS_VM_WRITE
// (OpenProcess calls against security tools — precursor to exploitation)
let SecurityProcessAccess = DeviceEvents
| where Timestamp > ago(24h)
| where ActionType == "ProcessAccessed"
| where FileName has_any (SecurityProcesses)
| where InitiatingProcessFileName !has_any (SecurityProcesses)
| where InitiatingProcessFileName !in~ ("System", "svchost.exe", "lsass.exe", "csrss.exe", "wininit.exe", "services.exe", "smss.exe")
| extend DetectionSignal = "SuspiciousAccessToSecurityProcess"
| project Timestamp, DeviceName, AccountName,
FileName, InitiatingProcessFileName, InitiatingProcessCommandLine, DetectionSignal;
// Signal 3: Security service unexpectedly stopping (possible crash-based exploitation)
let SecurityServiceStop = DeviceEvents
| where Timestamp > ago(24h)
| where ActionType == "ServiceInstalled" or ActionType == "ServiceDeleted"
| where AdditionalFields has_any (SecurityProcesses)
| extend DetectionSignal = "SecurityServiceModifiedOrStopped"
| project Timestamp, DeviceName, AccountName,
AdditionalFields, InitiatingProcessFileName, InitiatingProcessCommandLine, DetectionSignal;
// Union all signals
union ExploitedSecurityProcess, SecurityProcessAccess, SecurityServiceStop
| sort by Timestamp desc Detects exploitation of defensive security software via three correlated signals: (1) security processes spawning unexpected child processes such as cmd.exe or PowerShell, which may indicate code execution achieved through a vulnerability in the security software; (2) non-system processes opening handles to security software processes with suspicious access rights, which may precede exploitation; (3) unexpected modification or deletion of security service registrations. Uses DeviceProcessEvents and DeviceEvents tables from Microsoft Defender for Endpoint.
Data Sources
Required Tables
False Positives & Tuning
- Security software updates may spawn cmd.exe or PowerShell as part of self-update or installer routines
- Endpoint management platforms (SCCM, Intune, BigFix) may access security software processes during health checks or remediation
- Legitimate security tools performing process inspection (SysInternals, vulnerability scanners) may open handles to security processes
- Vendor-provided diagnostic or support tools for the security product itself may trigger process access alerts
- Windows Error Reporting (WerFault.exe) opens handles to crashed processes including security software during crash dump collection
Other platforms for T1211
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Simulate Security Process Spawning Command Shell
Expected signal: Sysmon Event ID 1: Process Create with Image=cmd.exe, ParentImage=powershell.exe (or the process running the test). Security Event ID 4688 if command line auditing is enabled. The detection signal 'SecuritySoftwareSpawnedSuspiciousChild' may not fire unless the initiating process name matches the security process list — use this test to validate the detection logic by temporarily adding 'powershell.exe' to the SecurityProcesses list in a test environment.
- Test 2Open Handle to Windows Defender Process (ProcessAccess Simulation)
Expected signal: Sysmon Event ID 10 (ProcessAccess): SourceImage=powershell.exe, TargetImage=C:\ProgramData\Microsoft\Windows Defender\Platform\<version>\MsMpEng.exe, GrantedAccess=0x0400. Note: Windows Defender is Protected Process Light (PPL) — the OpenProcess call may be denied, but Sysmon still logs the attempt with CallTrace data showing the call stack.
- Test 3Security Service State Query and Stop Simulation (Non-Destructive)
Expected signal: Sysmon Event ID 1: Process Create for cmd.exe with CommandLine containing 'sc query WinDefend' and 'sc query Sense'. Security Event ID 4688 (if enabled). Sysmon Event ID 1 for wmic.exe with CommandLine containing 'service where name'. These are the same reconnaissance commands used by threat actors (including APT28 tooling) to identify security software before exploitation.
- Test 4Exploit Artifact Simulation — Security Service Crash via WerFault
Expected signal: Sysmon Event ID 1: Process Create for werfault.exe with command line containing '-p 0'. Application Event Log queries via wevtutil generate additional Sysmon Event ID 1 entries for wevtutil.exe. The WerFault invocation with PID 0 will fail but the process creation telemetry is generated and matches patterns seen when security software is exploited and crashes.
References (9)
- https://attack.mitre.org/techniques/T1211/
- https://www.bleepingcomputer.com/news/security/hackers-exploited-salesforce-zero-day-in-facebook-phishing-attack/
- https://securitylabs.datadoghq.com/articles/bypass-cloudtrail-aws-service-catalog-and-other/
- https://www.bleepingcomputer.com/news/security/ghosttoken-gcp-flaw-let-attackers-backdoor-google-accounts/
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceevents-table
- https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1211/T1211.md
- https://www.bitdefender.com/blog/labs/apt28-targets-ongoing-conflict-ukraine/
- https://learn.microsoft.com/en-us/windows/win32/procthread/process-security-and-access-rights
Unlock Pro Content
Get the full detection package for T1211 including response playbook, investigation guide, and atomic red team tests.