Skip to content

Commit 32c294f

Browse files
committed
chore(rules): Eliminate false positives
Make the rules less noisy by adding various conditions to prevent false positives. Also, reformat some rules for better readability.
1 parent 3601b32 commit 32c294f

9 files changed

+48
-40
lines changed

rules/credential_access_potential_sam_hive_dumping.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,12 @@ references:
1919
condition: >
2020
sequence
2121
maxspan 10m
22-
|spawn_process
23-
and
24-
not
25-
(ps.exe imatches
26-
(
27-
'?:\\Program Files\\*.exe',
28-
'?:\\Program Files (x86)\\*.exe'
29-
)
30-
or
22+
|spawn_process and not (ps.exe imatches
23+
(
24+
'?:\\Program Files\\*.exe',
25+
'?:\\Program Files (x86)\\*.exe'
26+
)
27+
or
3128
(ps.exe imatches 'C:\\Windows\\System32\\svchost.exe' and ps.args iin ('-k', 'DcomLaunch'))
3229
)
3330
| by ps.child.uuid

rules/defense_evasion_dotnet_assembly_loaded_by_unmanaged_process.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: .NET assembly loaded by unmanaged process
22
id: 34be8bd1-1143-4fa8-bed4-ae2566b1394a
3-
version: 1.0.0
3+
version: 1.0.1
44
description: |
55
Identifies the loading of the .NET assembly by an unmanaged process. Adversaries can load the CLR runtime
66
inside unmanaged process and execute the assembly via the ICLRRuntimeHost::ExecuteInDefaultAppDomain method.
@@ -27,6 +27,12 @@ condition: >
2727
'?:\\Program Files\\WindowsPowerShell\\Modules\\*\\*.dll',
2828
'?:\\Windows\\Microsoft.NET\\assembly\\*\\*.dll'
2929
)
30+
and
31+
not
32+
ps.exe imatches
33+
(
34+
'?:\\Program Files\\WindowsApps\\*\\CrossDeviceService.exe'
35+
)
3036
3137
output: >
3238
.NET assembly %image.name loaded by unmanaged process %ps.exe

rules/defense_evasion_hidden_registry_key_creation.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Hidden registry key creation
22
id: 65deda38-9b1d-42a0-9f40-a68903e81b49
3-
version: 1.0.0
3+
version: 1.0.1
44
description: |
55
Identifies the creation of a hidden registry key. Adversaries can utilize the
66
native NtSetValueKey API to create a hidden registry key and conceal payloads
@@ -19,6 +19,14 @@ condition: >
1919
set_value and kevt.pid != 4 and registry.key.name endswith '\\'
2020
and
2121
thread.callstack.symbols not imatches ('KernelBase.dll!RegSetValue*', 'KernelBase.dll!RegLoadAppKey*', 'KernelBase.dll!GetFileAttributes*')
22+
and
23+
not
24+
ps.exe imatches
25+
(
26+
'?:\\Program Files (x86)\\Microsoft\\EdgeUpdate\\MicrosoftEdgeUpdate.exe',
27+
'?:\\Program Files\\Microsoft\\EdgeUpdate\\MicrosoftEdgeUpdate.exe',
28+
'?:\\Windows\\System32\\sppsvc.exe'
29+
)
2230
2331
output: >
2432
Hidden registry key %registry.key.name created by process %ps.exe

rules/defense_evasion_potential_process_hollowing_injection.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Potential Process Hollowing
22
id: 2a3fbae8-5e8c-4b71-b9da-56c3958c0d53
3-
version: 1.1.0
3+
version: 1.1.1
44
description: |
55
Adversaries may inject malicious code into suspended and hollowed processes in order to
66
evade process-based defenses. Process hollowing is a method of executing arbitrary code
@@ -29,7 +29,12 @@ references:
2929
condition: >
3030
sequence
3131
maxspan 2m
32-
|spawn_process| by ps.child.uuid
32+
|spawn_process and not ps.sid in ('S-1-5-18', 'S-1-5-19', 'S-1-5-20') and not ps.exe imatches
33+
(
34+
'?:\\Program Files\\*',
35+
'?:\\Program Files (x86)\\*'
36+
)
37+
| by ps.child.uuid
3338
|unmap_view_of_section and file.view.size > 20000 and file.view.protection != 'READONLY' and (length(file.name) = 0 or not ext(file.name) = '.dll')| by ps.uuid
3439
|load_executable| by ps.uuid
3540
action:

rules/defense_evasion_potential_process_injection_via_tainted_memory_section.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ condition: >
2323
sequence
2424
maxspan 1m
2525
|map_view_of_section and file.view.protection = 'READWRITE' and kevt.pid != 4 and file.view.size >= 4096| as e1
26-
|map_view_of_section and file.view.protection = 'READONLY|EXECUTE' and file.key = $e1.file.key and kevt.pid != $e1.kevt.pid
27-
and
28-
not
29-
ps.exe imatches
26+
|map_view_of_section and file.view.protection = 'READONLY|EXECUTE' and file.key = $e1.file.key and kevt.pid != $e1.kevt.pid and not ps.exe imatches
3027
(
3128
'?:\\Program Files\\Mozilla Firefox\\firefox.exe',
3229
'?:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe'

rules/defense_evasion_potential_thread_execution_hijacking.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ condition: >
3030
sequence
3131
maxspan 2m
3232
by ps.uuid
33-
|open_remote_thread and thread.access.mask.names in ('ALL_ACCESS', 'SUSPEND_THREAD')
34-
and
35-
not
36-
ps.exe imatches
33+
|open_remote_thread and thread.access.mask.names in ('ALL_ACCESS', 'SUSPEND_THREAD') and not ps.exe imatches
3734
(
3835
'?:\\Program Files\\*',
3936
'?:\\Program Files (x86)\\*'

rules/defense_evasion_thread_context_set_from_unbacked_memory.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Thread context set from unbacked memory
22
id: f8219274-ee68-416b-8489-4d2e635c7844
3-
version: 1.0.0
3+
version: 1.0.1
44
description: |
55
Identifies manipulation of the thread context from unbacked memory region. This may be
66
indicative of process injection.
@@ -14,5 +14,13 @@ labels:
1414

1515
condition: >
1616
set_thread_context and thread.callstack.summary imatches ('ntdll.dll|kernelbase.dll|unbacked')
17+
and
18+
not
19+
ps.exe imatches
20+
(
21+
'?:\\Program Files\\Git\\mingw64\\bin\\git.exe',
22+
'?:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe',
23+
'?:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe'
24+
)
1725
1826
min-engine-version: 2.2.0

rules/defense_evasion_unsigned_dll_injection_via_remote_thread.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,12 @@ references:
2222
condition: >
2323
sequence
2424
maxspan 1m
25-
|create_remote_thread
26-
and
27-
not
28-
(ps.exe imatches
29-
(
30-
'?:\\Program Files\\*',
31-
'?:\\Program Files (x86)\\*'
32-
)
33-
or
25+
|create_remote_thread and not (ps.exe imatches
26+
(
27+
'?:\\Program Files\\*',
28+
'?:\\Program Files (x86)\\*'
29+
)
30+
or
3431
(ps.exe imatches 'C:\\Windows\\System32\\svchost.exe' and ps.args iin ('-k', 'DcomLaunch'))
3532
)
3633
| by thread.pid

rules/initial_access_macro_execution_via_script_interpreter.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,8 @@ condition: >
3131
(create_file)
3232
or
3333
(
34-
load_module
35-
and
36-
not
37-
image.name imatches
38-
(
39-
'?:\\Program Files\\*',
40-
'?:\\Program Files (x86)\\*'
41-
)
42-
)
34+
load_module and not image.name imatches ('?:\\Program Files\\*', '?:\\Program Files (x86)\\*')
35+
)
4336
)
4437
| by ps.uuid
4538

0 commit comments

Comments
 (0)