Skip to content

Commit 83c8046

Browse files
committed
fix(rules): Improve rules efficacy against FP
To improve rules efficacy against false positives, we ensure the process has a valid state by checking the process executable path. In `Hidden registry key creation` rule, add the exception for the `lsass.exe` process.
1 parent 9a14aa9 commit 83c8046

4 files changed

+9
-8
lines changed

rules/defense_evasion_appdomain_manager_injection_via_clr_search_order_hijacking.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: AppDomain Manager injection via CLR search order hijacking
22
id: 9319fafd-b7dc-4d85-b41a-54a8d4f1ab18
3-
version: 1.0.1
3+
version: 1.0.2
44
description: |
55
Adversaries may execute their own malicious payloads by hijacking how the .NET AppDomainManager loads assemblies.
66
The .NET framework uses the AppDomainManager class to create and manage one or more isolated runtime environments
@@ -25,7 +25,7 @@ references:
2525
- https://www.rapid7.com/blog/post/2023/05/05/appdomain-manager-injection-new-techniques-for-red-teams/
2626

2727
condition: >
28-
(load_unsigned_or_untrusted_module) and ((base(dir(image.path)) ~= base(image.path, false)) or (ps.envs[APPDOMAIN_MANAGER_ASM] istartswith image.name))
28+
(load_unsigned_or_untrusted_module) and ps.exe != '' and ((base(dir(image.path)) ~= base(image.path, false)) or (ps.envs[APPDOMAIN_MANAGER_ASM] istartswith image.name))
2929
and
3030
pe.is_dotnet and (image.is_dotnet or thread.callstack.symbols imatches ('clr.dll!ParseManifest*'))
3131

rules/defense_evasion_dotnet_assembly_loaded_by_unmanaged_process.yml

Lines changed: 2 additions & 2 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.2
3+
version: 1.0.3
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.
@@ -16,7 +16,7 @@ references:
1616
- https://www.ired.team/offensive-security/code-injection-process-injection/injecting-and-executing-.net-assemblies-to-unmanaged-process
1717

1818
condition: >
19-
(load_unsigned_or_untrusted_module) and pe.is_dotnet = false
19+
(load_unsigned_or_untrusted_module) and ps.exe != '' and pe.is_dotnet = false
2020
and
2121
(image.is_dotnet or thread.callstack.modules imatches ('*clr.dll'))
2222
and

rules/defense_evasion_hidden_registry_key_creation.yml

Lines changed: 3 additions & 2 deletions
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.1.1
3+
version: 1.1.2
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
@@ -29,7 +29,8 @@ condition: >
2929
'?:\\Program Files\\Microsoft\\EdgeUpdate\\MicrosoftEdgeUpdate.exe',
3030
'?:\\Windows\\System32\\sppsvc.exe',
3131
'?:\\Windows\\System32\\compattelrunner.exe',
32-
'?:\\Windows\\explorer.exe'
32+
'?:\\Windows\\explorer.exe',
33+
'?:\\Windows\\System32\\lsass.exe'
3334
)
3435
3536
output: >

rules/defense_evasion_potential_injection_via_dotnet_debugging.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Potential injection via .NET debugging
22
id: 193ebf2f-e365-4f57-a639-275b7cdf0319
3-
version: 1.0.0
3+
version: 1.0.1
44
description: |
55
Identifies creation of a process on behalf of the CLR debugging facility which may
66
be indicative of code injection. The CLR interface utilizes the OpenVirtualProcess
@@ -17,7 +17,7 @@ references:
1717
- https://learn.microsoft.com/en-us/dotnet/framework/unmanaged-api/debugging/iclrdebugging-openvirtualprocess-method
1818

1919
condition: >
20-
spawn_process and thread.callstack.symbols imatches ('mscordbi.dll!OpenVirtualProcess')
20+
spawn_process and ps.exe != '' and thread.callstack.symbols imatches ('mscordbi.dll!OpenVirtualProcess')
2121
and
2222
not
2323
ps.child.exe imatches

0 commit comments

Comments
 (0)