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"]
  4maturity = "production"
  5updated_date = "2024/10/15"
  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]
 32language = "eql"
 33license = "Elastic License v2"
 34name = "Microsoft Build Engine Started by an Office Application"
 35note = """## Triage and analysis
 36
 37### Investigating Microsoft Build Engine Started by an Office Application
 38
 39Microsoft 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.
 40
 41The 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.
 42
 43This rule looks for the `Msbuild.exe` utility spawned by MS Office programs. This is generally the result of the execution of malicious documents.
 44
 45#### Possible investigation steps
 46
 47- 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.
 48- Investigate abnormal behaviors observed by the subject process, such as network connections, registry or file modifications, and any spawned child processes.
 49- Investigate other alerts associated with the user/host during the past 48 hours.
 50- 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.
 51- Determine if the collected files are malicious:
 52  - Use a private sandboxed malware analysis system to perform analysis.
 53    - Observe and collect information about the following activities:
 54      - Attempts to contact external domains and addresses.
 55      - File and registry access, modification, and creation activities.
 56      - Service creation and launch activities.
 57      - Scheduled task creation.
 58  - Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
 59    - Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
 60
 61### False positive analysis
 62
 63- This activity is unlikely to happen legitimately. Benign true positives (B-TPs) can be added as exceptions if necessary.
 64
 65### Response and remediation
 66
 67- Initiate the incident response process based on the outcome of the triage.
 68- Isolate the involved host to prevent further post-compromise behavior.
 69- 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.
 70- If the triage identified malware, search the environment for additional compromised hosts.
 71  - Implement temporary network rules, procedures, and segmentation to contain the malware.
 72  - Stop suspicious processes.
 73  - Immediately block the identified indicators of compromise (IoCs).
 74  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
 75- Remove and block malicious artifacts identified during triage.
 76- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 77- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 78  - If the malicious file was delivered via phishing:
 79    - Block the email sender from sending future emails.
 80    - Block the malicious web pages.
 81    - Remove emails from the sender from mailboxes.
 82    - Consider improvements to the security awareness program.
 83- 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).
 84"""
 85references = ["https://blog.talosintelligence.com/2020/02/building-bypass-with-msbuild.html"]
 86risk_score = 73
 87rule_id = "c5dc3223-13a2-44a2-946c-e9dc0aa0449c"
 88severity = "high"
 89tags = [
 90    "Domain: Endpoint",
 91    "OS: Windows",
 92    "Use Case: Threat Detection",
 93    "Tactic: Defense Evasion",
 94    "Tactic: Execution",
 95    "Resources: Investigation Guide",
 96    "Data Source: Elastic Endgame",
 97    "Data Source: Elastic Defend",
 98    "Data Source: System",
 99    "Data Source: Microsoft Defender for Endpoint",
100    "Data Source: Sysmon",
101    "Data Source: SentinelOne",
102]
103timestamp_override = "event.ingested"
104type = "eql"
105
106query = '''
107process where host.os.type == "windows" and event.type == "start" and
108  process.name : "MSBuild.exe" and
109  process.parent.name : ("eqnedt32.exe",
110                         "excel.exe",
111                         "fltldr.exe",
112                         "msaccess.exe",
113                         "mspub.exe",
114                         "outlook.exe",
115                         "powerpnt.exe",
116                         "winword.exe" )
117'''
118
119
120[[rule.threat]]
121framework = "MITRE ATT&CK"
122[[rule.threat.technique]]
123id = "T1127"
124name = "Trusted Developer Utilities Proxy Execution"
125reference = "https://attack.mitre.org/techniques/T1127/"
126[[rule.threat.technique.subtechnique]]
127id = "T1127.001"
128name = "MSBuild"
129reference = "https://attack.mitre.org/techniques/T1127/001/"
130
131
132
133[rule.threat.tactic]
134id = "TA0005"
135name = "Defense Evasion"
136reference = "https://attack.mitre.org/tactics/TA0005/"
137[[rule.threat]]
138framework = "MITRE ATT&CK"
139
140[rule.threat.tactic]
141id = "TA0002"
142name = "Execution"
143reference = "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.
    • 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.

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.
  • 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