Skip to content

Commit c4deeca

Browse files
committed
refactor(rules): Simplify and harden Process execution from hollowed memory section rule
1 parent a8d625f commit c4deeca

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed
Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
name: Process execution from hollowed memory section
22
id: 2a3fbae8-5e8c-4b71-b9da-56c3958c0d53
3-
version: 2.0.0
3+
version: 2.1.0
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
77
in the address space of a separate live process.
8-
9-
Process hollowing is commonly performed by creating a process in a suspended state then
10-
unmapping/hollowing its memory, which can then be replaced with malicious code. A victim
11-
process can be created with native Windows API calls such as CreateProcess, which includes
12-
a flag to suspend the processes primary thread. At this point the process can be unmapped
13-
using APIs calls such as ZwUnmapViewOfSection or NtUnmapViewOfSection before being written
14-
to, realigned to the injected code, and resumed via VirtualAllocEx, WriteProcessMemory,
15-
SetThreadContext, then ResumeThread/ResumeProcess respectively.
168
labels:
179
tactic.id: TA0005
1810
tactic.name: Defense Evasion
@@ -28,27 +20,28 @@ references:
2820

2921
condition: >
3022
sequence
31-
maxspan 2m
32-
|spawn_process and
33-
ps.parent.sid not in ('S-1-5-18', 'S-1-5-19', 'S-1-5-20') and
34-
ps.parent.exe not imatches
35-
(
36-
'?:\\Program Files\\*.exe',
37-
'?:\\Program Files (x86)\\*.exe'
38-
)
39-
| as e1
23+
maxspan 40s
4024
|unmap_view_of_section and
41-
ps.uuid = $e1.ps.uuid and
42-
file.view.size > 20000 and file.view.protection != 'READONLY'
43-
| as e2
25+
evt.pid != 4 and ps.sid not in ('S-1-5-18', 'S-1-5-19', 'S-1-5-20') and
26+
file.view.size > 20000 and file.view.protection != 'READONLY' and
27+
(file.name = '' or file.extension != '.dll') and
28+
ps.parent.exe not imatches
29+
(
30+
'?:\\Windows\\System32\\dwm.exe',
31+
'?:\\Windows\\System32\\svchost.exe',
32+
'?:\\Windows\\System32\\services.exe',
33+
'?:\\Windows\\Microsoft.NET\\Framework*\\ngen.exe',
34+
'?:\\Windows\\Microsoft.NET\\Framework*\\mscorsvw.exe'
35+
)
36+
| by ps.uuid, file.view.base
4437
|load_executable and
45-
ps.uuid = $e2.ps.uuid and image.base.address = $e2.file.view.base
46-
|
38+
image.path not imatches '?:\\Windows\\SoftwareDistribution\\Download\\*\\Package_for_RollupFix*\\*.exe'
39+
| by ps.uuid, image.base.address
4740
action:
4841
- name: kill
4942

5043
output: >
51-
Process %3.ps.exe executed from hollowed memory section
44+
Process %2.ps.exe executed from hollowed memory section
5245
severity: high
5346

5447
min-engine-version: 3.0.0

0 commit comments

Comments
 (0)