forked from elastic/detection-rules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefense_evasion_ms_office_suspicious_regmod.toml
132 lines (107 loc) · 6.02 KB
/
defense_evasion_ms_office_suspicious_regmod.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
[metadata]
creation_date = "2022/01/12"
maturity = "production"
updated_date = "2022/05/09"
[rule]
author = ["Elastic"]
description = """
Microsoft Office Products offer options for users and developers to control the security settings for running and using
Macros. Adversaries may abuse these security settings to modify the default behavior of the Office Application to trust
future macros and/or disable security warnings, which could increase their chances of establishing persistence.
"""
from = "now-9m"
index = ["winlogbeat-*", "logs-windows.*"]
language = "eql"
license = "Elastic License v2"
name = "MS Office Macro Security Registry Modifications"
note = """## Triage and analysis
### Investigating MS Office Macro Security Registry Modifications
Macros are small programs that are used to automate repetitive tasks in Microsoft Office applications.
Historically, macros have been used for a variety of reasons -- from automating part of a job, to
building entire processes and data flows. Macros are written in Visual Basic for Applications (VBA) and are saved as
part of Microsoft Office files.
Macros are often created for legitimate reasons, but they can also be written by attackers to gain access, harm a
system, or bypass other security controls such as application allow listing. In fact, exploitation from malicious macros
is one of the top ways that organizations are compromised today. These attacks are often conducted through phishing or
spear phishing campaigns.
Attackers can convince victims to modify Microsoft Office security settings, so their macros are trusted by default and
no warnings are displayed when they are executed. These settings include:
* *Trust access to the VBA project object model* - When enabled, Microsoft Office will trust all macros and run any code
without showing a security warning or requiring user permission.
* *VbaWarnings* - When set to 1, Microsoft Office will trust all macros and run any code without showing a security
warning or requiring user permission.
This rule looks for registry changes affecting the conditions above.
#### 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.
- Identify the user account that performed the action and whether it should perform this kind of action.
- Contact the user and check if the change was done manually.
- Verify whether malicious macros were executed after the registry change.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Retrieve recently executed Office documents and determine if they 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 tasks 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 should not happen legitimately. The security team should address any potential benign true
positives (B-TPs), as this configuration can put the user and the domain at risk.
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Reset the registry key value.
- 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.
- Explore using GPOs to manage security settings for Microsoft Office macros.
- 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.
- 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).
## Config
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.
"""
risk_score = 47
rule_id = "feeed87c-5e95-4339-aef1-47fd79bcfbe3"
severity = "medium"
tags = ["Elastic", "Host", "Windows", "Threat Detection", "Defense Evasion"]
timestamp_override = "event.ingested"
type = "eql"
query = '''
registry where event.type == "change" and
registry.path : (
"HKU\\S-1-5-21-*\\SOFTWARE\\Microsoft\\Office\\*\\Security\\AccessVBOM",
"HKU\\S-1-5-21-*\\SOFTWARE\\Microsoft\\Office\\*\\Security\\VbaWarnings"
) and
registry.data.strings == "0x00000001" and
process.name : ("cscript.exe", "wscript.exe", "mshta.exe", "mshta.exe", "winword.exe", "excel.exe")
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1112"
name = "Modify Registry"
reference = "https://attack.mitre.org/techniques/T1112/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1204"
name = "User Execution"
reference = "https://attack.mitre.org/techniques/T1204/"
[[rule.threat.technique.subtechnique]]
id = "T1204.002"
name = "Malicious File"
reference = "https://attack.mitre.org/techniques/T1204/002/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"