Detection rules › Splunk
Microsoft Build Engine Suspicious Parent Process (Windows Event Log)
Adversaries may take advantage of trusted developer utilities to proxy execution of malicious payloads. There are many utilities used for software development related tasks that can be used to execute code in various forms to assist in development, debugging, and reverse engineering. These utilities may often be signed with legitimate certificates that allow them to execute on a system and proxy execution of malicious code through a trusted process that effectively bypasses application control solutions. This use case detects msbuild.exe spawned by a scripting interpreter (such as CMD, PowerShell, etc.).
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
References
- https://attack.mitre.org/techniques/T1127/
- https://attack.mitre.org/techniques/T1127/001/
- https://attack.mitre.org/techniques/T1059/
- https://attack.mitre.org/techniques/T1059/001/
- https://attack.mitre.org/techniques/T1059/003/
- https://attack.mitre.org/techniques/T1059/005/
- https://detection.fyi/elastic/detection-rules/windows/defense_evasion_execution_msbuild_started_by_script/?query=msbuild
Telemetry coverage
| Provider | Record / event type |
|---|---|
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule body
id: '32492.57744'
title: Microsoft Build Engine Suspicious Parent Process
description: Adversaries may take advantage of trusted developer utilities to proxy
execution of malicious payloads. There are many utilities used for software development
related tasks that can be used to execute code in various forms to assist in development,
debugging, and reverse engineering. These utilities may often be signed with legitimate
certificates that allow them to execute on a system and proxy execution of malicious
code through a trusted process that effectively bypasses application control solutions.
This use case detects msbuild.exe spawned by a scripting interpreter (such as CMD,
PowerShell, etc.).
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=4688) OR
"<EventID>4688<" OR Type=Process) ("msbuild.exe" OR TERM(msbuild)) ("cmd.exe" OR
"powershell.exe" OR "pwsh.exe" OR "powershell_ise.exe" OR "cscript.exe" OR "wscript.exe"
OR "mshta.exe") | regex process_name="(?i)msbuild\.exe"| regex parent_process_name="(?i)(cmd|powershell(_ise)?|pwsh|cscript|wscript|mshta)\.exe"
| table _time, host, user, process, process_*, parent_* | bin span=1s | stats values(*)
as * by _time, host '
techniques:
- execution:command and scripting interpreter:powershell
- defense-evasion:trusted developer utilities proxy execution:msbuild
- execution:command and scripting interpreter
- defense-evasion:trusted developer utilities proxy execution
- execution:command and scripting interpreter:visual basic
- execution:command and scripting interpreter:windows command shell
technique_id:
- T1059.001
- T1127.001
- T1059
- T1127
- T1059.005
- T1059.003
data_category:
- Windows event logs
references:
- https://attack.mitre.org/techniques/T1127/
- https://attack.mitre.org/techniques/T1127/001/
- https://attack.mitre.org/techniques/T1059/
- https://attack.mitre.org/techniques/T1059/001/
- https://attack.mitre.org/techniques/T1059/003/
- https://attack.mitre.org/techniques/T1059/005/
- https://detection.fyi/elastic/detection-rules/windows/defense_evasion_execution_msbuild_started_by_script/?query=msbuild
Stages and Predicates
Stage 1: search
`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=4688) OR "<EventID>4688<" OR Type=Process) ("msbuild.exe" OR TERM(msbuild)) ("cmd.exe" OR "powershell.exe" OR "pwsh.exe" OR "powershell_ise.exe" OR "cscript.exe" OR "wscript.exe" OR "mshta.exe")
Stage 2: regex
| regex process_name="(?i)msbuild\.exe"
Stage 3: regex
| regex parent_process_name="(?i)(cmd|powershell(_ise)?|pwsh|cscript|wscript|mshta)\.exe"
Stage 4: table
| table _time, host, user, process, process_*, parent_*
Stage 5: bucket
| bin span=1s
Stage 6: stats
| stats values(*) as * by _time, host
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
EventCode | eq |
| field:"EventID" kind:eq value:"4688" |
parent_process_name | regex_match |
| field:"parent_process_name" kind:regex_match |
process_name | regex_match |
| field:"process_name" kind:regex_match |
Search terms
These SPL tokens match against raw event text.
| Stage | Term |
|---|---|
| 1 | "<EventID>4688<" |
| 1 | "msbuild.exe" |
| 1 | msbuild |
| 1 | "cmd.exe" |
| 1 | "powershell.exe" |
| 1 | "pwsh.exe" |
| 1 | "powershell_ise.exe" |
| 1 | "cscript.exe" |
| 1 | "wscript.exe" |
| 1 | "mshta.exe" |