Skip to content

Commit 1cc261d

Browse files
committed
perf(rules): Optimize allocation_size evaluation
Optimize the rule to defer the evaluation of the allocation_size only when the module paths are matched.
1 parent 07d593c commit 1cc261d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

rules/defense_evasion_process_creation_from_stomped_module.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Process creation from a stomped module
22
id: f85d1e80-49ec-4bbe-9bf5-7e2a3a8a7319
3-
version: 1.0.1
3+
version: 1.1.0
44
description: |
55
Identifies the creation of the process from the parent where the call stack
66
exhibits suspicious memory properties. The pattern is typical of stomped module
@@ -24,8 +24,9 @@ condition: >
2424
'?:\\Program Files\\*.exe',
2525
'?:\\Program Files(x86)\\*.exe'
2626
) and
27-
foreach(thread._callstack, $frame, $frame.module imatches ('?:\\Windows\\System32\\*.dll', '?:\\Windows\\SysWOW64\\*.dll') and $frame.allocation_size >= 10000) and
28-
not foreach(thread._callstack, $frame, $frame.module imatches
27+
foreach(thread._callstack, $frame,
28+
$frame.module imatches ('?:\\Windows\\System32\\*.dll', '?:\\Windows\\SysWOW64\\*.dll') and
29+
$frame.module not imatches
2930
(
3031
'?:\\Program Files\\*.dll',
3132
'?:\\Program Files (x86)\\*.dll',
@@ -44,7 +45,8 @@ condition: >
4445
'?:\\Windows\\System32\\spool\\drivers\\*',
4546
'?:\\Windows\\assembly\\NativeImages_*',
4647
'?:\\Windows\\System32\\DriverStore\\FileRepository\\*'
47-
))
48+
) and
49+
$frame.allocation_size >= 10000)
4850
action:
4951
- name: kill
5052

0 commit comments

Comments
 (0)