Microsoft Build Engine Started an Unusual Process
An instance of MSBuild, the Microsoft Build Engine, started a PowerShell script or the Visual C# Command Line Compiler. This technique is sometimes used to deploy a malicious payload using the Build Engine.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/03/25"
3integration = ["endpoint", "windows"]
4maturity = "production"
5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
6min_stack_version = "8.3.0"
7updated_date = "2023/02/22"
8
9[rule]
10author = ["Elastic"]
11description = """
12An instance of MSBuild, the Microsoft Build Engine, started a PowerShell script or the Visual C# Command Line Compiler.
13This technique is sometimes used to deploy a malicious payload using the Build Engine.
14"""
15false_positives = [
16 """
17 The Build Engine is commonly used by Windows developers but use by non-engineers is unusual. If a build system
18 triggers this rule it can be exempted by process, user or host name.
19 """,
20]
21from = "now-9m"
22index = ["winlogbeat-*", "logs-endpoint.events.*", "logs-windows.*", "endgame-*"]
23language = "eql"
24license = "Elastic License v2"
25name = "Microsoft Build Engine Started an Unusual Process"
26note = """## Setup
27
28If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define `event.ingested` and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate `event.ingested` to @timestamp for this rule to work.
29"""
30references = ["https://blog.talosintelligence.com/2020/02/building-bypass-with-msbuild.html"]
31risk_score = 21
32rule_id = "9d110cb3-5f4b-4c9a-b9f5-53f0a1707ae6"
33severity = "low"
34tags = ["Elastic", "Host", "Windows", "Threat Detection", "Defense Evasion", "Elastic Endgame"]
35timestamp_override = "event.ingested"
36type = "eql"
37
38query = '''
39process where host.os.type == "windows" and event.type == "start" and
40 process.parent.name : "MSBuild.exe" and
41 process.name : ("csc.exe", "iexplore.exe", "powershell.exe")
42'''
43
44
45[[rule.threat]]
46framework = "MITRE ATT&CK"
47[[rule.threat.technique]]
48id = "T1027"
49name = "Obfuscated Files or Information"
50reference = "https://attack.mitre.org/techniques/T1027/"
51[[rule.threat.technique.subtechnique]]
52id = "T1027.004"
53name = "Compile After Delivery"
54reference = "https://attack.mitre.org/techniques/T1027/004/"
55
56
57
58[rule.threat.tactic]
59id = "TA0005"
60name = "Defense Evasion"
61reference = "https://attack.mitre.org/tactics/TA0005/"
Setup
If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define event.ingested
and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate event.ingested
to @timestamp for this rule to work.