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", "system"]
 4maturity = "production"
 5min_stack_comments = "Multiple field support in the New Terms rule type was added in Elastic 8.6"
 6min_stack_version = "8.6.0"
 7updated_date = "2024/03/28"
 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.process-*", "logs-windows.*", "logs-system.security*"]
23language = "kuery"
24license = "Elastic License v2"
25name = "Microsoft Build Engine Started an Unusual Process"
26references = ["https://blog.talosintelligence.com/2020/02/building-bypass-with-msbuild.html"]
27risk_score = 21
28rule_id = "9d110cb3-5f4b-4c9a-b9f5-53f0a1707ae6"
29setup = """## Setup
30
31If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
32events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
33Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
34`event.ingested` to @timestamp.
35For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
36"""
37severity = "low"
38tags = ["Domain: Endpoint",
39        "OS: Windows",
40        "Use Case: Threat Detection",
41        "Tactic: Defense Evasion",
42        "Tactic: Execution",
43        "Data Source: Elastic Defend"
44        ]
45
46timestamp_override = "event.ingested"
47type = "new_terms"
48
49query = '''
50host.os.type:windows and event.category:process and event.type:start and process.parent.name:("MSBuild.exe" or "msbuild.exe") and
51process.name:("csc.exe" or "iexplore.exe" or "powershell.exe")
52'''
53
54[[rule.threat]]
55framework = "MITRE ATT&CK"
56
57[[rule.threat.technique]]
58id = "T1027"
59name = "Obfuscated Files or Information"
60reference = "https://attack.mitre.org/techniques/T1027/"
61
62[[rule.threat.technique.subtechnique]]
63id = "T1027.004"
64name = "Compile After Delivery"
65reference = "https://attack.mitre.org/techniques/T1027/004/"
66
67[[rule.threat.technique]]
68id = "T1127"
69name = "Trusted Developer Utilities Proxy Execution"
70reference = "https://attack.mitre.org/techniques/T1127/"
71[[rule.threat.technique.subtechnique]]
72id = "T1127.001"
73name = "MSBuild"
74reference = "https://attack.mitre.org/techniques/T1127/001/"
75
76
77
78[rule.threat.tactic]
79id = "TA0005"
80name = "Defense Evasion"
81reference = "https://attack.mitre.org/tactics/TA0005/"
82
83[rule.new_terms]
84field = "new_terms_fields"
85value = ["host.id", "user.name"]
86
87[[rule.new_terms.history_window_start]]
88field = "history_window_start"
89value = "now-14d"

References

Related rules

to-top