Skip to content

Commit 2c722eb

Browse files
committed
refactor(rules): Rearrange conditions for lazy file info evaluation
1 parent 310a64d commit 2c722eb

11 files changed

+50
-24
lines changed

rules/credential_access_lsass_memory_dumping.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: LSASS memory dumping via legitimate or offensive tools
22
id: 335795af-246b-483e-8657-09a30c102e63
3-
version: 1.2.0
3+
version: 1.2.1
44
description: |
55
Detects an attempt to dump the LSAAS memory to the disk by employing legitimate
66
tools such as procdump, Task Manager, Process Explorer or built-in Windows tools
@@ -32,7 +32,16 @@ condition: >
3232
'?:\\ProgramData\\Microsoft\\Windows Defender\\*\\MsMpEng.exe'
3333
)
3434
|
35-
|create_file and (file.extension iin ('.dmp', '.mdmp', '.dump') or is_minidump(file.path))|
35+
|create_new_file and
36+
file.path not imatches
37+
(
38+
'?:\\$WinREAgent\\Scratch\\*',
39+
'?:\\Windows\\WinSxS\\*',
40+
'?:\\Windows\\CbsTemp\\*',
41+
'?:\\Windows\\SoftwareDistribution\\*'
42+
) and
43+
(file.extension iin ('.dmp', '.mdmp', '.dump') or is_minidump(file.path))
44+
|
3645
3746
output: >
3847
Detected an attempt by `%1.ps.name` process to access and read

rules/credential_access_lsass_process_clone_creation_via_reflection.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: LSASS process clone creation via reflection
22
id: cdf3810a-4832-446a-ac9d-d108cf2e313c
3-
version: 1.0.3
3+
version: 1.0.4
44
description: |
55
Identifies the creation of an LSASS clone process via RtlCreateProcessReflection API function.
66
Adversaries can use this technique to dump credentials material from the LSASS fork and evade
@@ -20,7 +20,7 @@ references:
2020
- https://s3cur3th1ssh1t.github.io/Reflective-Dump-Tools/
2121

2222
condition: >
23-
spawn_process and
23+
spawn_process and
2424
ps.name ~= 'lsass.exe' and ps.parent.name ~= 'lsass.exe' and
2525
thread.callstack.symbols imatches ('ntdll.dll!RtlCloneUserProcess', 'ntdll.dll!RtlCreateProcessReflection')
2626
action:

rules/defense_evasion_dll_sideloading_via_copied_binary.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: DLL Side-Loading via a copied binary
22
id: 80798e2c-6c37-472b-936c-1d2d6b95ff3c
3-
version: 1.0.6
3+
version: 1.0.7
44
description: |
55
Identifies when a binary is copied to a directory and shortly followed
66
by the loading of an unsigned DLL from the same directory. Adversaries may
@@ -21,8 +21,9 @@ condition: >
2121
sequence
2222
maxspan 8m
2323
|create_file and
24-
file.is_exec and ps.sid not in ('S-1-5-18', 'S-1-5-19', 'S-1-5-20') and
25-
thread.callstack.symbols imatches ('*CopyFile*', '*MoveFile*')
24+
ps.sid not in ('S-1-5-18', 'S-1-5-19', 'S-1-5-20') and
25+
thread.callstack.symbols imatches ('*CopyFile*', '*MoveFile*') and
26+
(file.extension ~= '.exe' or file.is_exec)
2627
| by file.path
2728
|(load_dll) and
2829
dir(image.path) ~= dir(ps.exe) and

rules/defense_evasion_dll_sideloading_via_microsoft_office_dropped_file.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: DLL Side-Loading via Microsoft Office dropped file
22
id: d808175d-c4f8-459d-b17f-ca9a88890c04
3-
version: 1.0.4
3+
version: 1.0.5
44
description: |
55
Identifies Microsoft Office process creating a DLL or other variant of an executable object which
66
is later loaded by a trusted binary. Adversaries may exploit this behavior by delivering malicious
@@ -20,8 +20,8 @@ condition: >
2020
sequence
2121
maxspan 6m
2222
|create_file and
23-
(file.extension iin ('.dll', '.cpl', '.ocx') or file.is_dll) and
24-
ps.name iin msoffice_binaries
23+
ps.name iin msoffice_binaries and
24+
(file.extension iin ('.dll', '.cpl', '.ocx') or file.is_dll)
2525
| by file.path
2626
|(load_unsigned_or_untrusted_dll) and
2727
ps.name not iin msoffice_binaries and ps.signature.trusted = true and

rules/defense_evasion_dotnet_assembly_loaded_by_unmanaged_process.yml

Lines changed: 8 additions & 4 deletions
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.10
3+
version: 1.0.11
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.
@@ -17,14 +17,18 @@ references:
1717

1818
condition: >
1919
(load_unsigned_or_untrusted_module) and
20-
ps.exe != '' and ps.pe.is_dotnet = false and
21-
(dll.pe.is_dotnet or thread.callstack.modules imatches ('*clr.dll')) and
2220
dll.path not imatches
2321
(
2422
'?:\\Windows\\assembly\\*\\*.ni.dll',
2523
'?:\\Program Files\\WindowsPowerShell\\Modules\\*\\*.dll',
26-
'?:\\Windows\\Microsoft.NET\\assembly\\*\\*.dll'
24+
'?:\\Windows\\Microsoft.NET\\assembly\\*\\*.dll',
25+
'?:\\$WinREAgent\\Scratch\\*',
26+
'?:\\Windows\\WinSxS\\*',
27+
'?:\\Windows\\CbsTemp\\*',
28+
'?:\\Windows\\SoftwareDistribution\\*'
2729
) and
30+
ps.exe != '' and ps.pe.is_dotnet = false and
31+
(dll.pe.is_dotnet or thread.callstack.modules imatches ('*clr.dll')) and
2832
ps.exe not imatches
2933
(
3034
'?:\\Program Files\\WindowsApps\\*\\CrossDeviceService.exe',

rules/initial_access_execution_via_microsoft_office_process.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Execution via Microsoft Office process
22
id: a10ebe66-1b55-4005-a374-840f1e2933a3
3-
version: 1.0.3
3+
version: 1.0.4
44
description:
55
Identifies the execution of the file dropped by Microsoft Office process.
66
labels:
@@ -17,7 +17,7 @@ labels:
1717
condition: >
1818
sequence
1919
maxspan 1h
20-
|create_file and (file.extension iin executable_extensions or file.is_exec) and ps.name iin msoffice_binaries| by file.path
20+
|create_file and ps.name iin msoffice_binaries and (file.extension iin executable_extensions or file.is_exec)| by file.path
2121
|spawn_process and ps.parent.name iin msoffice_binaries| by ps.exe
2222
2323
min-engine-version: 3.0.0

rules/initial_access_suspicious_dll_loaded_by_microsoft_office_process.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Suspicious DLL loaded by Microsoft Office process
22
id: 5868518c-2a83-4b26-ad4b-f14f0b85e744
3-
version: 1.0.4
3+
version: 1.0.5
44
description:
55
Identifies loading of recently dropped DLL by Microsoft Office process.
66
labels:
@@ -18,7 +18,8 @@ condition: >
1818
sequence
1919
maxspan 1h
2020
|create_file and
21-
(file.extension iin module_extensions or file.is_dll) and ps.name iin msoffice_binaries and
21+
ps.name iin msoffice_binaries and
22+
(file.extension iin module_extensions or file.is_dll) and
2223
file.path not imatches '?:\\Program Files\\Microsoft Office\\Root\\Office*\\*.dll'
2324
| by file.name
2425
|load_module and ps.name iin msoffice_binaries| by module.name

rules/macros/macros.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
- macro: create_file
2626
expr: evt.name = 'CreateFile' and file.operation != 'OPEN' and file.status = 'Success'
2727

28+
- macro: create_new_file
29+
expr: evt.name = 'CreateFile' and file.operation = 'CREATE' and file.status = 'Success'
30+
2831
- macro: rename_file
2932
expr: evt.name = 'RenameFile'
3033

rules/persistence_suspicious_microsoft_office_template.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Suspicious Microsoft Office template
22
id: c4be3b30-9d23-4a33-b974-fb12e17487a2
3-
version: 1.0.4
3+
version: 1.0.5
44
description: |
55
Detects when attackers drop macro-enabled files in specific
66
folders to trigger their execution every time the victim user
@@ -20,6 +20,7 @@ references:
2020

2121
condition: >
2222
create_file and
23+
ps.name not iin msoffice_binaries and
2324
file.path imatches
2425
(
2526
'?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Word\\Startup\\*',
@@ -28,7 +29,6 @@ condition: >
2829
'?:\\Users\\*\\AppData\\Roaming\\Microsoft\\AddIns\\*',
2930
'?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Outlook\\*.otm'
3031
) and
31-
ps.name not iin msoffice_binaries and
3232
ps.exe not imatches
3333
(
3434
'?:\\Program Files\\*.exe',

rules/persistence_unusual_file_written_in_startup_folder.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Unusual file written in Startup folder
22
id: c5ffe15c-d94f-416b-bec7-c47f89843267
3-
version: 1.0.4
3+
version: 1.0.5
44
description: |
55
Identifies suspicious files written to the startup folder that would
66
allow adversaries to maintain persistence on the endpoint.
@@ -17,8 +17,8 @@ labels:
1717

1818
condition: >
1919
create_file and
20-
(file.extension in ('.vbs', '.js', '.jar', '.exe', '.dll', '.com', '.ps1', '.hta', '.cmd', '.vbe') or (file.is_exec or file.is_dll)) and
2120
file.path imatches startup_locations and
21+
(file.extension in ('.vbs', '.js', '.jar', '.exe', '.dll', '.com', '.ps1', '.hta', '.cmd', '.vbe') or (file.is_exec or file.is_dll)) and
2222
ps.exe not imatches
2323
(
2424
'?:\\Windows\\System32\\wuauclt.exe',

0 commit comments

Comments
 (0)