Suspicious .NET Code Compilation

Identifies executions of .NET compilers with suspicious parent processes, which can indicate an attacker's attempt to compile code after delivery in order to bypass security mechanisms.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2020/08/21"
 3integration = ["endpoint", "windows"]
 4maturity = "production"
 5updated_date = "2024/08/07"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10Identifies executions of .NET compilers with suspicious parent processes, which can indicate an attacker's attempt to
11compile code after delivery in order to bypass security mechanisms.
12"""
13from = "now-9m"
14index = [
15    "winlogbeat-*",
16    "logs-endpoint.events.process-*",
17    "logs-windows.*",
18    "endgame-*",
19    "logs-system.security*",
20]
21language = "eql"
22license = "Elastic License v2"
23name = "Suspicious .NET Code Compilation"
24risk_score = 47
25rule_id = "201200f1-a99b-43fb-88ed-f65a45c4972c"
26setup = """## Setup
27
28If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
29events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
30Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
31`event.ingested` to @timestamp.
32For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
33"""
34severity = "medium"
35tags = [
36    "Domain: Endpoint",
37    "OS: Windows",
38    "Use Case: Threat Detection",
39    "Tactic: Defense Evasion",
40    "Tactic: Execution",
41    "Data Source: Elastic Endgame",
42    "Data Source: Elastic Defend",
43    "Data Source: System",
44]
45timestamp_override = "event.ingested"
46type = "eql"
47
48query = '''
49process where host.os.type == "windows" and event.type == "start" and
50  process.name : ("csc.exe", "vbc.exe") and
51  process.parent.name : ("wscript.exe", "mshta.exe", "cscript.exe", "wmic.exe", "svchost.exe", "rundll32.exe", "cmstp.exe", "regsvr32.exe")
52'''
53
54
55[[rule.threat]]
56framework = "MITRE ATT&CK"
57[[rule.threat.technique]]
58id = "T1027"
59name = "Obfuscated Files or Information"
60reference = "https://attack.mitre.org/techniques/T1027/"
61[[rule.threat.technique.subtechnique]]
62id = "T1027.004"
63name = "Compile After Delivery"
64reference = "https://attack.mitre.org/techniques/T1027/004/"
65
66
67
68[rule.threat.tactic]
69id = "TA0005"
70name = "Defense Evasion"
71reference = "https://attack.mitre.org/tactics/TA0005/"
72[[rule.threat]]
73framework = "MITRE ATT&CK"
74[[rule.threat.technique]]
75id = "T1059"
76name = "Command and Scripting Interpreter"
77reference = "https://attack.mitre.org/techniques/T1059/"
78[[rule.threat.technique.subtechnique]]
79id = "T1059.005"
80name = "Visual Basic"
81reference = "https://attack.mitre.org/techniques/T1059/005/"
82
83
84
85[rule.threat.tactic]
86id = "TA0002"
87name = "Execution"
88reference = "https://attack.mitre.org/tactics/TA0002/"

Related rules

to-top