Skip to content

Commit 68c956b

Browse files
committed
feat(rules): Add Thread context manipulation from exception handler rule
Identifies attempts to manipulate thread context from inside the exception handler. Attackers can hijack execution as part of stealthy process injection or patchless AMSI bypass techniques.
1 parent 9635329 commit 68c956b

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Thread context manipulation from exception handler
2+
id: 9e52cd07-b07a-4f2b-b326-cad8524401c8
3+
version: 1.0.0
4+
description: |
5+
Identifies attempts to manipulate thread context from inside the exception handler.
6+
Attackers can hijack execution as part of stealthy process injection or patchless
7+
AMSI bypass techniques.
8+
labels:
9+
tactic.id: TA0005
10+
tactic.name: Defense Evasion
11+
tactic.ref: https://attack.mitre.org/tactics/TA0005/
12+
technique.id: T1055
13+
technique.name: Process Injection
14+
technique.ref: https://attack.mitre.org/techniques/T1055/
15+
references:
16+
- https://www.crowdstrike.com/en-us/blog/crowdstrike-investigates-threat-of-patchless-amsi-bypass-attacks/
17+
18+
condition: >
19+
((set_thread_context) or (set_thread_context_failed)) and
20+
thread.callstack.symbols imatches ('ntdll.dll!KiUserExceptionDispatcher') and
21+
ps.exe not imatches
22+
(
23+
'?:\\Windows\\System32\\wermgr.exe',
24+
'?:\\Windows\\System32\\WerFault.exe',
25+
'?:\\Windows\\System32\\taskhostw.exe',
26+
'?:\\ProgramData\\Microsoft\\Windows Defender\\*\\MsMpEng.exe',
27+
'?:\\ProgramData\\Microsoft\\Windows Defender\\*\\NisSrv.exe'
28+
)
29+
30+
severity: high
31+
32+
min-engine-version: 3.0.0

rules/macros/macros.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@
7373
- macro: set_thread_context
7474
expr: evt.name = 'SetThreadContext' and evt.arg[status] = 'Success'
7575

76+
- macro: set_thread_context_failed
77+
expr: evt.name = 'SetThreadContext' and evt.arg[status] != 'Success'
78+
7679
- macro: virtual_alloc
7780
expr: evt.name = 'VirtualAlloc'
7881

0 commit comments

Comments
 (0)