Microsoft Build Engine Started by an Office Application
An instance of MSBuild, the Microsoft Build Engine, was started by Excel or Word. This is unusual behavior for the Build Engine and could have been caused by an Excel or Word document executing a malicious script payload.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/03/25"
3integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
4maturity = "production"
5updated_date = "2024/10/31"
6min_stack_version = "8.14.0"
7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
8
9[rule]
10author = ["Elastic"]
11description = """
12An instance of MSBuild, the Microsoft Build Engine, was started by Excel or Word. This is unusual behavior for the Build
13Engine and could have been caused by an Excel or Word document executing a malicious script payload.
14"""
15false_positives = [
16 """
17 The Build Engine is commonly used by Windows developers but use by non-engineers is unusual. It is quite unusual for
18 this program to be started by an Office application like Word or Excel.
19 """,
20]
21from = "now-9m"
22index = [
23 "winlogbeat-*",
24 "logs-endpoint.events.process-*",
25 "logs-windows.forwarded*",
26 "logs-windows.sysmon_operational-*",
27 "endgame-*",
28 "logs-system.security*",
29 "logs-m365_defender.event-*",
30 "logs-sentinel_one_cloud_funnel.*",
31 "logs-crowdstrike.fdr*",
32]
33language = "eql"
34license = "Elastic License v2"
35name = "Microsoft Build Engine Started by an Office Application"
36note = """## Triage and analysis
37
38### Investigating Microsoft Build Engine Started by an Office Application
39
40Microsoft Office (MS Office) is a suite of applications designed to help with productivity and completing common tasks on a computer. You can create and edit documents containing text and images, work with data in spreadsheets and databases, and create presentations and posters. As it is some of the most-used software across companies, MS Office is frequently targeted for initial access. It also has a wide variety of capabilities that attackers can take advantage of.
41
42The Microsoft Build Engine is a platform for building applications. This engine, also known as MSBuild, provides an XML schema for a project file that controls how the build platform processes and builds software, and can be abused to proxy execution of code.
43
44This rule looks for the `Msbuild.exe` utility spawned by MS Office programs. This is generally the result of the execution of malicious documents.
45
46#### Possible investigation steps
47
48- 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.
49- Investigate abnormal behaviors observed by the subject process, such as network connections, registry or file modifications, and any spawned child processes.
50- Investigate other alerts associated with the user/host during the past 48 hours.
51- Retrieve MS Office documents received and opened by the user that could cause this behavior. Common locations include, but are not limited to, the Downloads and Document folders and the folder configured at the email client.
52- Determine if the collected files are malicious:
53 - Use a private sandboxed malware analysis system to perform analysis.
54 - Observe and collect information about the following activities:
55 - Attempts to contact external domains and addresses.
56 - File and registry access, modification, and creation activities.
57 - Service creation and launch activities.
58 - Scheduled task creation.
59 - Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
60 - Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
61
62### False positive analysis
63
64- This activity is unlikely to happen legitimately. Benign true positives (B-TPs) can be added as exceptions if necessary.
65
66### Response and remediation
67
68- Initiate the incident response process based on the outcome of the triage.
69- Isolate the involved host to prevent further post-compromise behavior.
70- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
71- If the triage identified malware, search the environment for additional compromised hosts.
72 - Implement temporary network rules, procedures, and segmentation to contain the malware.
73 - Stop suspicious processes.
74 - Immediately block the identified indicators of compromise (IoCs).
75 - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
76- Remove and block malicious artifacts identified during triage.
77- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
78- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
79 - If the malicious file was delivered via phishing:
80 - Block the email sender from sending future emails.
81 - Block the malicious web pages.
82 - Remove emails from the sender from mailboxes.
83 - Consider improvements to the security awareness program.
84- 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).
85"""
86references = ["https://blog.talosintelligence.com/2020/02/building-bypass-with-msbuild.html"]
87risk_score = 73
88rule_id = "c5dc3223-13a2-44a2-946c-e9dc0aa0449c"
89severity = "high"
90tags = [
91 "Domain: Endpoint",
92 "OS: Windows",
93 "Use Case: Threat Detection",
94 "Tactic: Defense Evasion",
95 "Tactic: Execution",
96 "Resources: Investigation Guide",
97 "Data Source: Elastic Endgame",
98 "Data Source: Elastic Defend",
99 "Data Source: System",
100 "Data Source: Microsoft Defender for Endpoint",
101 "Data Source: Sysmon",
102 "Data Source: SentinelOne",
103 "Data Source: Crowdstrike",
104]
105timestamp_override = "event.ingested"
106type = "eql"
107
108query = '''
109process where host.os.type == "windows" and event.type == "start" and
110 process.name : "MSBuild.exe" and
111 process.parent.name : ("eqnedt32.exe",
112 "excel.exe",
113 "fltldr.exe",
114 "msaccess.exe",
115 "mspub.exe",
116 "outlook.exe",
117 "powerpnt.exe",
118 "winword.exe" )
119'''
120
121
122[[rule.threat]]
123framework = "MITRE ATT&CK"
124[[rule.threat.technique]]
125id = "T1127"
126name = "Trusted Developer Utilities Proxy Execution"
127reference = "https://attack.mitre.org/techniques/T1127/"
128[[rule.threat.technique.subtechnique]]
129id = "T1127.001"
130name = "MSBuild"
131reference = "https://attack.mitre.org/techniques/T1127/001/"
132
133
134
135[rule.threat.tactic]
136id = "TA0005"
137name = "Defense Evasion"
138reference = "https://attack.mitre.org/tactics/TA0005/"
139[[rule.threat]]
140framework = "MITRE ATT&CK"
141
142[rule.threat.tactic]
143id = "TA0002"
144name = "Execution"
145reference = "https://attack.mitre.org/tactics/TA0002/"
Triage and analysis
Investigating Microsoft Build Engine Started by an Office Application
Microsoft Office (MS Office) is a suite of applications designed to help with productivity and completing common tasks on a computer. You can create and edit documents containing text and images, work with data in spreadsheets and databases, and create presentations and posters. As it is some of the most-used software across companies, MS Office is frequently targeted for initial access. It also has a wide variety of capabilities that attackers can take advantage of.
The Microsoft Build Engine is a platform for building applications. This engine, also known as MSBuild, provides an XML schema for a project file that controls how the build platform processes and builds software, and can be abused to proxy execution of code.
This rule looks for the Msbuild.exe
utility spawned by MS Office programs. This is generally the result of the execution of malicious documents.
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 abnormal behaviors observed by the subject process, such as network connections, registry or file modifications, and any spawned child processes.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Retrieve MS Office documents received and opened by the user that could cause this behavior. Common locations include, but are not limited to, the Downloads and Document folders and the folder configured at the email client.
- Determine if the collected files are malicious:
- Use a private sandboxed malware analysis system to perform analysis.
- Observe and collect information about the following activities:
- Attempts to contact external domains and addresses.
- File and registry access, modification, and creation activities.
- Service creation and launch activities.
- Scheduled task creation.
- Observe and collect information about the following activities:
- Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
- Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
- Use a private sandboxed malware analysis system to perform analysis.
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.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- 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.
- If the malicious file was delivered via phishing:
- Block the email sender from sending future emails.
- Block the malicious web pages.
- Remove emails from the sender from mailboxes.
- Consider improvements to the security awareness program.
- If the malicious file was delivered via phishing:
- 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
- Control Panel Process with Unusual Arguments
- Enable Host Network Discovery via Netsh
- Microsoft Build Engine Started by a System Process
- Suspicious Zoom Child Process
- Disable Windows Firewall Rules via Netsh