Suspicious Microsoft Antimalware Service Execution

Identifies suspicious execution of the Microsoft Antimalware Service Executable (MsMpEng.exe) from non-standard paths or renamed instances. This may indicate an attempt to evade defenses through DLL side-loading or by masquerading as the antimalware process.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2021/07/07"
  3integration = ["endpoint", "windows", "m365_defender", "crowdstrike"]
  4maturity = "production"
  5updated_date = "2026/09/18"
  6
  7[rule]
  8author = ["Elastic", "Dennis Perto"]
  9description = """
 10Identifies suspicious execution of the Microsoft Antimalware Service Executable (MsMpEng.exe) from non-standard paths or
 11renamed instances. This may indicate an attempt to evade defenses through DLL side-loading or by masquerading as the
 12antimalware process.
 13"""
 14false_positives = ["Microsoft Antimalware Service Executable installed on non default installation path."]
 15from = "now-9m"
 16index = [
 17    "winlogbeat-*",
 18    "logs-endpoint.events.process-*",
 19    "logs-windows.sysmon_operational-*",
 20    "endgame-*",
 21    "logs-m365_defender.event-*",
 22    "logs-crowdstrike.fdr*",
 23]
 24language = "eql"
 25license = "Elastic License v2"
 26name = "Suspicious Microsoft Antimalware Service Execution"
 27references = [
 28    "https://news.sophos.com/en-us/2021/07/04/independence-day-revil-uses-supply-chain-exploit-to-attack-hundreds-of-businesses/",
 29]
 30risk_score = 73
 31rule_id = "053a0387-f3b5-4ba5-8245-8002cca2bd08"
 32severity = "high"
 33tags = [
 34    "Domain: Endpoint",
 35    "OS: Windows",
 36    "Use Case: Threat Detection",
 37    "Tactic: Defense Evasion",
 38    "Data Source: Elastic Endgame",
 39    "Data Source: Elastic Defend",
 40    "Data Source: Sysmon",
 41    "Data Source: Microsoft Defender XDR",
 42    "Data Source: Crowdstrike",
 43    "Resources: Investigation Guide",
 44    "Noise: High",
 45    "Performance: Normal",
 46    "Profile: Aggressive",
 47    "Rule Type: Event Correlation (EQL)",
 48    "Platform: Windows",
 49]
 50timestamp_override = "event.ingested"
 51type = "eql"
 52
 53query = '''
 54process where host.os.type == "windows" and event.type == "start" and
 55(
 56  (process.pe.original_file_name == "MsMpEng.exe" and not process.name : "MsMpEng.exe") or
 57  (
 58    process.name : "MsMpEng.exe" and
 59    not process.executable : (
 60            "?:\\ProgramData\\Microsoft\\Windows Defender\\*.exe",
 61            "?:\\Program Files\\Windows Defender\\*.exe",
 62            "?:\\Program Files (x86)\\Windows Defender\\*.exe",
 63            "?:\\Program Files\\Microsoft Security Client\\*.exe",
 64            "?:\\Program Files (x86)\\Microsoft Security Client\\*.exe",
 65
 66            /* Crowdstrike specific exclusion as it uses NT Object paths */
 67            "\\Device\\HarddiskVolume*\\ProgramData\\Microsoft\\Windows Defender\\*.exe",
 68            "\\Device\\HarddiskVolume*\\Program Files\\Windows Defender\\*.exe",
 69            "\\Device\\HarddiskVolume*\\Program Files (x86)\\Windows Defender\\*.exe",
 70            "\\Device\\HarddiskVolume*\\Program Files\\Microsoft Security Client\\*.exe",
 71            "\\Device\\HarddiskVolume*\\Program Files (x86)\\Microsoft Security Client\\*.exe"
 72    )
 73  )
 74)
 75'''
 76
 77note = """## Triage and analysis
 78
 79### Investigating Suspicious Microsoft Antimalware Service Execution
 80
 81#### Possible investigation steps
 82
 83- Which Defender identity anomaly did the alert capture?
 84  - Focus: `process.name`, `process.pe.original_file_name`, `process.executable`, `process.code_signature.subject_name`, and `process.code_signature.trusted`.
 85  - Implication: escalate when `process.pe.original_file_name` is "MsMpEng.exe" under renamed `process.name`, or `process.name` is "MsMpEng.exe" outside Defender/Microsoft Security Client paths, even with trusted Microsoft signing; lower suspicion only when exact path, signer, and name pattern fit controlled packaging, recovery, or malware-analysis copy.
 86- Does the path, file timing, and parent context look like staged Defender abuse?
 87  - Why: unusual-path Defender binaries can load same-folder DLLs through search-order behavior, so path and parent context separate masquerading or side-loading from controlled copies.
 88  - Focus: `process.executable`, `process.Ext.relative_file_creation_time`, `process.Ext.relative_file_name_modify_time`, `process.parent.executable`, and `process.parent.command_line`.
 89  - Implication: escalate when the binary is fresh, recently renamed, or launched from user-writable, temp, share, archive, agent working, or Windows staging paths by a script, archive tool, RMM agent, or dropper parent; path age and parent context support benign closure only if later side-loading and launcher checks do not contradict them.
 90- Does the user, token, and session context fit Defender service execution?
 91  - Focus: `user.id`, `user.name`, `process.Ext.session_info.logon_type`, and `process.Ext.token.integrity_level_name`.
 92  - Implication: escalate when the process runs under an interactive/domain user, a non-service logon, or a user-level token that does not fit antimalware service startup; SYSTEM or service context lowers only the session concern and does not clear the unusual path by itself.
 93- If file or library telemetry is available, is there same-directory staging or DLL side-loading evidence?
 94  - Focus: recover file and library events with `host.id` plus `process.entity_id` when present, or `host.id` plus `process.pid` and a tight alert window; inspect `file.path`, `dll.path`, `dll.name`, `dll.code_signature.trusted`, and `dll.Ext.relative_file_creation_time`. $investigate_0
 95  - Hint: missing file or library telemetry is unresolved, not benign; prioritize same-folder DLLs whose path, signer, or creation time does not fit the product layout, plus artifacts created before `process.executable` started.
 96  - Implication: escalate when the unusual Defender copy loads a recent, unsigned/untrusted same-folder DLL or the directory contains newly staged executables, DLLs, scripts, archives, or renamed files; complete recovery with only expected Microsoft components lowers side-loading concern.
 97- Does the process act as a launcher rather than a passive service component?
 98  - Focus: child process events where `process.parent.entity_id` matches suspicious `process.entity_id`, repeated starts from `process.executable` on `host.id`, and child `process.name`, `process.executable`, and `process.command_line`.
 99    - $investigate_1
100    - $investigate_2
101  - Implication: escalate when it starts shells, PowerShell, certutil, netsh, installers, encryption tooling, or other hands-on-keyboard utilities, or when repeated launches suggest staged execution; no child or repeat behavior lowers launcher concern but does not clear the path anomaly.
102- If local findings stay suspicious or unresolved, do related alerts show path reuse or host compromise?
103  - Focus: related alerts for `process.executable`, especially unusual-path Defender, masquerading, or side-loading detections.
104    - $investigate_3
105  - Hint: also review related alerts for `host.id` or `user.id`, especially staging, persistence, credential-access, ransomware, or other masquerading detections.
106    - $investigate_4
107    - $investigate_5
108  - Implication: broaden scope when the same path appears on unrelated hosts or the host has precursor or follow-on alerts; keep the case local only when related alerts show no reuse or follow-on activity and all local evidence is clean.
109
110- Escalate when Defender identity/path evidence plus one meaningful corroborator supports masquerading or DLL side-loading; close only when exact path, signer, parent, session, host/user scope, and optional outside confirmation tie to one controlled workflow with no contradictory telemetry; preserve artifacts and escalate when findings stay mixed or visibility is incomplete.
111
112### False positive analysis
113
114- A non-default Defender installation, controlled security packaging, recovery, or malware-analysis validation can stage Microsoft antimalware binaries outside default paths. Confirm the same workflow by matching exact `process.executable`, `process.hash.sha256` or `process.code_signature.thumbprint_sha256`, Microsoft `process.code_signature.subject_name`, `process.code_signature.trusted`, `process.parent.executable`, `process.parent.command_line`, `user.id`, `host.id`, and session pattern; without outside records, require recurrence across prior rule alerts without side-loading, launcher, or related-alert contradictions.
115- Treat production execution from temp, user-writable, share, archive, agent working, or Windows staging paths as an operational anti-pattern unless a controlled workflow proves why the copy exists. Do not close as benign when same-folder DLLs, child tooling, recent rename timing, or unrelated related alerts contradict it.
116- Build exceptions only from the minimum confirmed workflow pattern; avoid exceptions on `process.name`, `process.pe.original_file_name`, signer subject alone, or host alone.
117
118### Response and remediation
119
120- If confirmed benign, reverse any temporary containment and document the exact workflow: executable path, Microsoft signer or hash, parent process, session context, user/host scope, and any controlled packaging, recovery, or lab record that corroborated the telemetry. Create an exception only after the same narrow workflow pattern is stable across prior alerts.
121- If suspicious but unconfirmed, preserve the alert details, process tree, command line, binary copy and hash, parent context, directory listing, same-folder DLLs, and related-alert timeline before containment. Apply reversible containment first, such as execution prevention on the suspicious path or temporary host isolation when active launcher behavior or side-loading creates continuing risk and the host role can tolerate interruption.
122- If confirmed malicious, preserve process and artifact evidence first, including the suspicious Defender copy, same-folder DLLs, support files, launcher context, and related-alert timeline. Then isolate the host or apply an equivalent endpoint containment control, terminate only the suspicious non-default-path or renamed Defender instance, quarantine the suspicious executable and supporting files, remove launcher or persistence artifacts found during scoping, and restore the legitimate security product from known-good media if the masquerading copy replaced or shadowed a trusted component.
123- After containment, restrict execution from user-writable, temporary, share, archive, and agent working directories where feasible, retain process/file/library telemetry that affected this case, and document the confirmed benign workflow or malicious artifact set for future triage.
124"""
125
126setup = """## Setup
127
128This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
129
130Setup instructions: https://ela.st/install-elastic-defend
131
132### Additional data sources
133
134This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
135
136- [CrowdStrike](https://ela.st/crowdstrike-integration)
137- [Microsoft Defender XDR](https://ela.st/m365-defender)
138- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
139"""
140
141[rule.investigation_fields]
142field_names = [
143    "@timestamp",
144    "host.name",
145    "host.id",
146    "user.name",
147    "user.id",
148    "process.entity_id",
149    "process.pid",
150    "process.name",
151    "process.executable",
152    "process.command_line",
153    "process.pe.original_file_name",
154    "process.parent.executable",
155    "process.parent.command_line",
156    "process.code_signature.subject_name",
157    "process.code_signature.trusted",
158]
159
160[transform]
161
162[[transform.investigate]]
163label = "File and library events for the suspicious process"
164description = ""
165providers = [
166  [
167    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
168    { excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" },
169    { excluded = false, field = "event.category", queryType = "phrase", value = "file", valueType = "string" }
170  ],
171  [
172    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
173    { excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" },
174    { excluded = false, field = "event.category", queryType = "phrase", value = "library", valueType = "string" }
175  ]
176]
177relativeFrom = "now-1h"
178relativeTo = "now"
179
180[[transform.investigate]]
181label = "Child process events for the suspicious process"
182description = ""
183providers = [
184  [
185    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
186    { excluded = false, field = "process.parent.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" },
187    { excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" }
188  ]
189]
190relativeFrom = "now-1h"
191relativeTo = "now"
192
193[[transform.investigate]]
194label = "Process events for the suspicious executable path"
195description = ""
196providers = [
197  [
198    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
199    { excluded = false, field = "process.executable", queryType = "phrase", value = "{{process.executable}}", valueType = "string" },
200    { excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" }
201  ]
202]
203relativeFrom = "now-48h/h"
204relativeTo = "now"
205
206[[transform.investigate]]
207label = "Alerts associated with the suspicious executable path"
208description = ""
209providers = [
210  [
211    { excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
212    { excluded = false, field = "process.executable", queryType = "phrase", value = "{{process.executable}}", valueType = "string" }
213  ]
214]
215relativeFrom = "now-48h/h"
216relativeTo = "now"
217
218[[transform.investigate]]
219label = "Alerts associated with the host"
220description = ""
221providers = [
222  [
223    { excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
224    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
225  ]
226]
227relativeFrom = "now-48h/h"
228relativeTo = "now"
229
230[[transform.investigate]]
231label = "Alerts associated with the user"
232description = ""
233providers = [
234  [
235    { excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
236    { excluded = false, field = "user.id", queryType = "phrase", value = "{{user.id}}", valueType = "string" }
237  ]
238]
239relativeFrom = "now-48h/h"
240relativeTo = "now"
241
242[[rule.threat]]
243framework = "MITRE ATT&CK"
244
245[[rule.threat.technique]]
246id = "T1036"
247name = "Masquerading"
248reference = "https://attack.mitre.org/techniques/T1036/"
249
250[[rule.threat.technique.subtechnique]]
251id = "T1036.003"
252name = "Rename Legitimate Utilities"
253reference = "https://attack.mitre.org/techniques/T1036/003/"
254
255[[rule.threat.technique.subtechnique]]
256id = "T1036.005"
257name = "Match Legitimate Resource Name or Location"
258reference = "https://attack.mitre.org/techniques/T1036/005/"
259
260[[rule.threat.technique]]
261id = "T1574"
262name = "Hijack Execution Flow"
263reference = "https://attack.mitre.org/techniques/T1574/"
264
265[[rule.threat.technique.subtechnique]]
266id = "T1574.001"
267name = "DLL"
268reference = "https://attack.mitre.org/techniques/T1574/001/"
269
270[rule.threat.tactic]
271id = "TA0005"
272name = "Defense Evasion"
273reference = "https://attack.mitre.org/tactics/TA0005/"

Triage and analysis

Investigating Suspicious Microsoft Antimalware Service Execution

Possible investigation steps

  • Which Defender identity anomaly did the alert capture?

    • Focus: process.name, process.pe.original_file_name, process.executable, process.code_signature.subject_name, and process.code_signature.trusted.
    • Implication: escalate when process.pe.original_file_name is "MsMpEng.exe" under renamed process.name, or process.name is "MsMpEng.exe" outside Defender/Microsoft Security Client paths, even with trusted Microsoft signing; lower suspicion only when exact path, signer, and name pattern fit controlled packaging, recovery, or malware-analysis copy.
  • Does the path, file timing, and parent context look like staged Defender abuse?

    • Why: unusual-path Defender binaries can load same-folder DLLs through search-order behavior, so path and parent context separate masquerading or side-loading from controlled copies.
    • Focus: process.executable, process.Ext.relative_file_creation_time, process.Ext.relative_file_name_modify_time, process.parent.executable, and process.parent.command_line.
    • Implication: escalate when the binary is fresh, recently renamed, or launched from user-writable, temp, share, archive, agent working, or Windows staging paths by a script, archive tool, RMM agent, or dropper parent; path age and parent context support benign closure only if later side-loading and launcher checks do not contradict them.
  • Does the user, token, and session context fit Defender service execution?

    • Focus: user.id, user.name, process.Ext.session_info.logon_type, and process.Ext.token.integrity_level_name.
    • Implication: escalate when the process runs under an interactive/domain user, a non-service logon, or a user-level token that does not fit antimalware service startup; SYSTEM or service context lowers only the session concern and does not clear the unusual path by itself.
  • If file or library telemetry is available, is there same-directory staging or DLL side-loading evidence?

    • Focus: recover file and library events with host.id plus process.entity_id when present, or host.id plus process.pid and a tight alert window; inspect file.path, dll.path, dll.name, dll.code_signature.trusted, and dll.Ext.relative_file_creation_time. $investigate_0
    • Hint: missing file or library telemetry is unresolved, not benign; prioritize same-folder DLLs whose path, signer, or creation time does not fit the product layout, plus artifacts created before process.executable started.
    • Implication: escalate when the unusual Defender copy loads a recent, unsigned/untrusted same-folder DLL or the directory contains newly staged executables, DLLs, scripts, archives, or renamed files; complete recovery with only expected Microsoft components lowers side-loading concern.
  • Does the process act as a launcher rather than a passive service component?

    • Focus: child process events where process.parent.entity_id matches suspicious process.entity_id, repeated starts from process.executable on host.id, and child process.name, process.executable, and process.command_line.
      • $investigate_1
      • $investigate_2
    • Implication: escalate when it starts shells, PowerShell, certutil, netsh, installers, encryption tooling, or other hands-on-keyboard utilities, or when repeated launches suggest staged execution; no child or repeat behavior lowers launcher concern but does not clear the path anomaly.
  • If local findings stay suspicious or unresolved, do related alerts show path reuse or host compromise?

    • Focus: related alerts for process.executable, especially unusual-path Defender, masquerading, or side-loading detections.
      • $investigate_3
    • Hint: also review related alerts for host.id or user.id, especially staging, persistence, credential-access, ransomware, or other masquerading detections.
      • $investigate_4
      • $investigate_5
    • Implication: broaden scope when the same path appears on unrelated hosts or the host has precursor or follow-on alerts; keep the case local only when related alerts show no reuse or follow-on activity and all local evidence is clean.
  • Escalate when Defender identity/path evidence plus one meaningful corroborator supports masquerading or DLL side-loading; close only when exact path, signer, parent, session, host/user scope, and optional outside confirmation tie to one controlled workflow with no contradictory telemetry; preserve artifacts and escalate when findings stay mixed or visibility is incomplete.

False positive analysis

  • A non-default Defender installation, controlled security packaging, recovery, or malware-analysis validation can stage Microsoft antimalware binaries outside default paths. Confirm the same workflow by matching exact process.executable, process.hash.sha256 or process.code_signature.thumbprint_sha256, Microsoft process.code_signature.subject_name, process.code_signature.trusted, process.parent.executable, process.parent.command_line, user.id, host.id, and session pattern; without outside records, require recurrence across prior rule alerts without side-loading, launcher, or related-alert contradictions.
  • Treat production execution from temp, user-writable, share, archive, agent working, or Windows staging paths as an operational anti-pattern unless a controlled workflow proves why the copy exists. Do not close as benign when same-folder DLLs, child tooling, recent rename timing, or unrelated related alerts contradict it.
  • Build exceptions only from the minimum confirmed workflow pattern; avoid exceptions on process.name, process.pe.original_file_name, signer subject alone, or host alone.

Response and remediation

  • If confirmed benign, reverse any temporary containment and document the exact workflow: executable path, Microsoft signer or hash, parent process, session context, user/host scope, and any controlled packaging, recovery, or lab record that corroborated the telemetry. Create an exception only after the same narrow workflow pattern is stable across prior alerts.
  • If suspicious but unconfirmed, preserve the alert details, process tree, command line, binary copy and hash, parent context, directory listing, same-folder DLLs, and related-alert timeline before containment. Apply reversible containment first, such as execution prevention on the suspicious path or temporary host isolation when active launcher behavior or side-loading creates continuing risk and the host role can tolerate interruption.
  • If confirmed malicious, preserve process and artifact evidence first, including the suspicious Defender copy, same-folder DLLs, support files, launcher context, and related-alert timeline. Then isolate the host or apply an equivalent endpoint containment control, terminate only the suspicious non-default-path or renamed Defender instance, quarantine the suspicious executable and supporting files, remove launcher or persistence artifacts found during scoping, and restore the legitimate security product from known-good media if the masquerading copy replaced or shadowed a trusted component.
  • After containment, restrict execution from user-writable, temporary, share, archive, and agent working directories where feasible, retain process/file/library telemetry that affected this case, and document the confirmed benign workflow or malicious artifact set for future triage.

References

Related rules

to-top