Unusual Parent-Child Relationship

Identifies Windows programs run from unexpected parent processes. This could indicate masquerading or other strange activity on a system.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2020/02/18"
  3integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
  4maturity = "production"
  5updated_date = "2026/09/18"
  6[transform]
  7[[transform.osquery]]
  8label = "Osquery - Retrieve DNS Cache"
  9query = "SELECT * FROM dns_cache"
 10
 11[[transform.osquery]]
 12label = "Osquery - Retrieve All Services"
 13query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
 14
 15[[transform.osquery]]
 16label = "Osquery - Retrieve Services Running on User Accounts"
 17query = """
 18SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
 19NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
 20user_account == null)
 21"""
 22
 23[[transform.osquery]]
 24label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
 25query = """
 26SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
 27services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
 28authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
 29"""
 30
 31
 32[rule]
 33author = ["Elastic"]
 34description = """
 35Identifies Windows programs run from unexpected parent processes. This could indicate masquerading or other strange
 36activity on a system.
 37"""
 38from = "now-9m"
 39index = [
 40    "endgame-*",
 41    "logs-crowdstrike.fdr*",
 42    "logs-endpoint.events.process-*",
 43    "logs-m365_defender.event-*",
 44    "logs-sentinel_one_cloud_funnel.*",
 45    "logs-system.security*",
 46    "logs-windows.forwarded*",
 47    "logs-windows.sysmon_operational-*",
 48    "winlogbeat-*",
 49]
 50language = "eql"
 51license = "Elastic License v2"
 52name = "Unusual Parent-Child Relationship"
 53note = """## Triage and analysis
 54
 55### Investigating Unusual Parent-Child Relationship
 56
 57Windows internal/system processes have some characteristics that can be used to spot suspicious activities. One of these characteristics is parent-child relationships. These relationships can be used to baseline the typical behavior of the system and then alert on occurrences that don't comply with the baseline.
 58
 59This rule uses this information to spot suspicious parent and child processes.
 60
 61> **Note**:
 62> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/current/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
 63
 64#### Possible investigation steps
 65
 66- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
 67- Investigate other alerts associated with the user/host during the past 48 hours.
 68- Investigate any abnormal behavior by the subject process such as network connections, registry or file modifications, and any spawned child processes.
 69- Examine the host for derived artifacts that indicate suspicious activities:
 70  - Analyze the process executable using a private sandboxed analysis system.
 71  - Observe and collect information about the following activities in both the sandbox and the alert subject host:
 72    - Attempts to contact external domains and addresses.
 73      - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
 74      - Examine the DNS cache for suspicious or anomalous entries.
 75        - $osquery_0
 76    - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
 77    - Examine the host services for suspicious or anomalous entries.
 78      - $osquery_1
 79      - $osquery_2
 80      - $osquery_3
 81  - Retrieve the files' SHA-256 hash values using the PowerShell `Get-FileHash` cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
 82- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.
 83
 84
 85### False positive analysis
 86
 87- This activity is unlikely to happen legitimately. Benign true positives (B-TPs) can be added as exceptions if necessary.
 88
 89### Response and remediation
 90
 91- Initiate the incident response process based on the outcome of the triage.
 92- Isolate the involved host to prevent further post-compromise behavior.
 93- If the triage identified malware, search the environment for additional compromised hosts.
 94  - Implement temporary network rules, procedures, and segmentation to contain the malware.
 95  - Stop suspicious processes.
 96  - Immediately block the identified indicators of compromise (IoCs).
 97  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
 98- Remove and block malicious artifacts identified during triage.
 99- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
100- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
101- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
102"""
103
104setup = """## Setup
105
106This 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.
107
108Setup instructions: https://ela.st/install-elastic-defend
109
110### Additional data sources
111
112This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
113
114- [CrowdStrike](https://ela.st/crowdstrike-integration)
115- [Microsoft Defender XDR](https://ela.st/m365-defender)
116- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
117- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
118- [Windows Process Creation Logs](https://ela.st/audit-process-creation)
119"""
120
121references = [
122    "https://github.com/sbousseaden/Slides/blob/master/Hunting%20MindMaps/PNG/Windows%20Processes%20TH.map.png",
123    "https://www.andreafortuna.org/2017/06/15/standard-windows-processes-a-brief-reference/",
124    "https://www.elastic.co/security-labs/elastic-security-labs-steps-through-the-r77-rootkit",
125]
126risk_score = 47
127rule_id = "35df0dd8-092d-4a83-88c1-5151a804f31b"
128severity = "medium"
129tags = [
130    "Domain: Endpoint",
131    "OS: Windows",
132    "Use Case: Threat Detection",
133    "Tactic: Privilege Escalation",
134    "Resources: Investigation Guide",
135    "Data Source: Elastic Endgame",
136    "Data Source: Elastic Defend",
137    "Data Source: Windows Security Event Logs",
138    "Data Source: Microsoft Defender XDR",
139    "Data Source: Sysmon",
140    "Data Source: SentinelOne",
141    "Data Source: Crowdstrike",
142    "Noise: Medium",
143    "Performance: Normal",
144    "Rule Type: Event Correlation (EQL)",
145    "Platform: Windows",
146    "Resources: Osquery",
147]
148timestamp_override = "event.ingested"
149type = "eql"
150
151query = '''
152process where host.os.type == "windows" and event.type == "start" and
153process.parent.name != null and process.parent.executable like ("?:\\*", "\\Device\\*") and
154 (
155   /* suspicious parent processes */
156   (process.name:"autochk.exe" and not process.parent.name:"smss.exe") or
157   (process.name:("fontdrvhost.exe", "dwm.exe") and not process.parent.name:("wininit.exe", "winlogon.exe", "dwm.exe")) or
158   (process.name:("consent.exe", "RuntimeBroker.exe", "TiWorker.exe") and not process.parent.name:("svchost.exe", "Workplace Container Helper.exe")) or
159   (process.name:"SearchIndexer.exe" and not process.parent.name:"services.exe") or
160   (process.name:"SearchProtocolHost.exe" and not process.parent.name:("SearchIndexer.exe", "dllhost.exe")) or
161   (process.name:"dllhost.exe" and not process.parent.name:("services.exe", "svchost.exe")) or
162   (process.name:"smss.exe" and not process.parent.name:"System") or
163   (process.name:"csrss.exe" and not process.parent.name:("smss.exe", "svchost.exe")) or
164   (process.name:"wininit.exe" and not process.parent.name:"smss.exe") or
165   (process.name:"winlogon.exe" and not process.parent.name:"smss.exe") or
166   (process.name:("lsass.exe", "LsaIso.exe") and not process.parent.name:"wininit.exe") or
167   (process.name:"LogonUI.exe" and not process.parent.name:("wininit.exe", "winlogon.exe")) or
168   (process.name:"services.exe" and not process.parent.name:"wininit.exe") or
169   (process.name:"svchost.exe" and not process.parent.name:("MsMpEng.exe", "services.exe")) or
170   (process.name:"spoolsv.exe" and not process.parent.name:("services.exe", "Workplace Starter.exe")) or
171   (process.name:"taskhost.exe" and not process.parent.name:("services.exe", "svchost.exe", "ngentask.exe")) or
172   (process.name:"taskhostw.exe" and not process.parent.name:("services.exe", "svchost.exe")) or
173   (process.name:"userinit.exe" and not process.parent.name:("dwm.exe", "winlogon.exe", "KUsrInit.exe")) or
174   (process.name:("wmiprvse.exe", "wsmprovhost.exe", "winrshost.exe") and not process.parent.name:"svchost.exe") or
175   /* suspicious child processes */
176   (process.parent.name:("SearchProtocolHost.exe", "taskhost.exe", "csrss.exe") and not process.name:("werfault.exe", "wermgr.exe", "WerFaultSecure.exe", "conhost.exe", "ngentask.exe", "SearchProtocolHost.exe")) or
177   (process.parent.name:"autochk.exe" and not process.name:("chkdsk.exe", "doskey.exe", "WerFault.exe")) or
178   (process.parent.name:"smss.exe" and not process.name:("autochk.exe", "csrss.exe", "wininit.exe", "winlogon.exe", "setupcl.exe", "WerFault.exe", "wpbbin.exe", "PvsVmBoot.exe", "SophosNA.exe", "omnissa-ic-nga.exe", "vmware-svi-nga.exe", "icarus_rvrt.exe", "poqexec.exe", "QcSkExt*.exe")) or
179   (process.parent.name:"wermgr.exe" and not process.name:("WerFaultSecure.exe", "WerFault.exe") and
180     not (process.name:"rundll32.exe" and process.command_line : "*WerConCpl.dll*LaunchErcApp*")) or
181   (process.parent.name:"conhost.exe" and not process.name:("mscorsvw.exe", "wermgr.exe", "WerFault.exe", "WerFaultSecure.exe"))
182  ) and
183 /* exclude self-spawns */
184 not startswith~(process.parent.name, process.name)
185'''
186
187
188[[rule.threat]]
189framework = "MITRE ATT&CK"
190
191[[rule.threat.technique]]
192id = "T1055"
193name = "Process Injection"
194reference = "https://attack.mitre.org/techniques/T1055/"
195
196[[rule.threat.technique.subtechnique]]
197id = "T1055.012"
198name = "Process Hollowing"
199reference = "https://attack.mitre.org/techniques/T1055/012/"
200
201[rule.threat.tactic]
202id = "TA0004"
203name = "Privilege Escalation"
204reference = "https://attack.mitre.org/tactics/TA0004/"
205
206[[rule.threat]]
207framework = "MITRE ATT&CK"
208
209[[rule.threat.technique]]
210id = "T1036"
211name = "Masquerading"
212reference = "https://attack.mitre.org/techniques/T1036/"
213
214[[rule.threat.technique.subtechnique]]
215id = "T1036.009"
216name = "Break Process Trees"
217reference = "https://attack.mitre.org/techniques/T1036/009/"
218
219[[rule.threat.technique]]
220id = "T1134"
221name = "Access Token Manipulation"
222reference = "https://attack.mitre.org/techniques/T1134/"
223
224[[rule.threat.technique.subtechnique]]
225id = "T1134.004"
226name = "Parent PID Spoofing"
227reference = "https://attack.mitre.org/techniques/T1134/004/"
228
229[rule.threat.tactic]
230id = "TA0005"
231name = "Defense Evasion"
232reference = "https://attack.mitre.org/tactics/TA0005/"

Triage and analysis

Investigating Unusual Parent-Child Relationship

Windows internal/system processes have some characteristics that can be used to spot suspicious activities. One of these characteristics is parent-child relationships. These relationships can be used to baseline the typical behavior of the system and then alert on occurrences that don't comply with the baseline.

This rule uses this information to spot suspicious parent and child processes.

Note: This investigation guide uses the Osquery Markdown Plugin introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.

Possible investigation steps

  • Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
  • Investigate other alerts associated with the user/host during the past 48 hours.
  • Investigate any abnormal behavior by the subject process such as network connections, registry or file modifications, and any spawned child processes.
  • Examine the host for derived artifacts that indicate suspicious activities:
    • Analyze the process executable using a private sandboxed analysis system.
    • Observe and collect information about the following activities in both the sandbox and the alert subject host:
      • Attempts to contact external domains and addresses.
        • Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' process.entity_id.
        • Examine the DNS cache for suspicious or anomalous entries.
          • $osquery_0
      • Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
      • Examine the host services for suspicious or anomalous entries.
        • $osquery_1
        • $osquery_2
        • $osquery_3
    • Retrieve the files' SHA-256 hash values using the PowerShell Get-FileHash cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
  • Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.

False positive analysis

  • This activity is unlikely to happen legitimately. Benign true positives (B-TPs) can be added as exceptions if necessary.

Response and remediation

  • Initiate the incident response process based on the outcome of the triage.
  • Isolate the involved host to prevent further post-compromise behavior.
  • If the triage identified malware, search the environment for additional compromised hosts.
    • Implement temporary network rules, procedures, and segmentation to contain the malware.
    • Stop suspicious processes.
    • Immediately block the identified indicators of compromise (IoCs).
    • Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
  • Remove and block malicious artifacts identified during triage.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
  • Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).

References

Related rules

to-top