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"
 5updated_date = "2024/05/21"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10An instance of MSBuild, the Microsoft Build Engine, started a PowerShell script or the Visual C# Command Line Compiler.
11This technique is sometimes used to deploy a malicious payload using the Build Engine.
12"""
13false_positives = [
14    """
15    The Build Engine is commonly used by Windows developers but use by non-engineers is unusual. If a build system
16    triggers this rule it can be exempted by process, user or host name.
17    """,
18]
19from = "now-9m"
20index = ["winlogbeat-*", "logs-endpoint.events.process-*", "logs-windows.*", "logs-system.security*"]
21language = "kuery"
22license = "Elastic License v2"
23name = "Microsoft Build Engine Started an Unusual Process"
24references = ["https://blog.talosintelligence.com/2020/02/building-bypass-with-msbuild.html"]
25risk_score = 21
26rule_id = "9d110cb3-5f4b-4c9a-b9f5-53f0a1707ae6"
27setup = """## Setup
28
29If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
30events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
31Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
32`event.ingested` to @timestamp.
33For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
34"""
35severity = "low"
36tags = [
37    "Domain: Endpoint",
38    "OS: Windows",
39    "Use Case: Threat Detection",
40    "Tactic: Defense Evasion",
41    "Tactic: Execution",
42    "Data Source: Elastic Defend",
43]
44timestamp_override = "event.ingested"
45type = "new_terms"
46
47query = '''
48host.os.type:windows and event.category:process and event.type:start and process.parent.name:("MSBuild.exe" or "msbuild.exe") and
49process.name:("csc.exe" or "iexplore.exe" or "powershell.exe")
50'''
51
52
53[[rule.threat]]
54framework = "MITRE ATT&CK"
55[[rule.threat.technique]]
56id = "T1027"
57name = "Obfuscated Files or Information"
58reference = "https://attack.mitre.org/techniques/T1027/"
59[[rule.threat.technique.subtechnique]]
60id = "T1027.004"
61name = "Compile After Delivery"
62reference = "https://attack.mitre.org/techniques/T1027/004/"
63
64
65[[rule.threat.technique]]
66id = "T1127"
67name = "Trusted Developer Utilities Proxy Execution"
68reference = "https://attack.mitre.org/techniques/T1127/"
69[[rule.threat.technique.subtechnique]]
70id = "T1127.001"
71name = "MSBuild"
72reference = "https://attack.mitre.org/techniques/T1127/001/"
73
74
75
76[rule.threat.tactic]
77id = "TA0005"
78name = "Defense Evasion"
79reference = "https://attack.mitre.org/tactics/TA0005/"
80
81[rule.new_terms]
82field = "new_terms_fields"
83value = ["host.id", "user.name"]
84[[rule.new_terms.history_window_start]]
85field = "history_window_start"
86value = "now-14d"

References

Related rules

to-top