Skip to content

Commit

Permalink
adding rules to detect .NET reflection techniques (mandiant#690)
Browse files Browse the repository at this point in the history
* adding rules to detect .NET reflection techniques
  • Loading branch information
mike-hunhoff authored Feb 7, 2023
1 parent cad482b commit 34bff73
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions nursery/generate-method-via-reflection-in-dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
rule:
meta:
name: generate method via reflection in .NET
namespace: load-code/dotnet
authors:
- [email protected]
description: https://github.com/bohops/DynamicDotNet/blob/main/assembly_loader/DynamicAssemblyLoader.cs
scope: function
features:
- or:
- api: System.Reflection.Emit.DynamicMethod::ctor
- api: System.Reflection.Emit.DynamicMethod::GetILGenerator
- api: System.Reflection.Emit.ILGenerator::Emit
- api: System.Reflection.Emit.ILGenerator::EmitCall
- api: System.Reflection.Emit.ILGenerator::EmitCalli
- api: System.Reflection.Emit.ILGenerator::EmitWriteLine
15 changes: 15 additions & 0 deletions nursery/unmanaged-call-via-dynamic-pinvoke-in-dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
rule:
meta:
name: unmanaged call via dynamic PInvoke in .NET
namespace: runtime/dotnet
authors:
- [email protected]
description: https://github.com/bohops/DynamicDotNet/blob/main/dynamic_pinvoke/dynamic_pinvoke_definepinvokemethod_shellcode_runner.cs
scope: function
features:
- and:
- or:
- api: System.Reflection.Emit.ModuleBuilder::DefinePInvokeMethod
- api: System.Reflection.Emit.TypeBuilder::DefinePInvokeMethod
- optional:
- api: System.Reflection.MethodBase::Invoke
1 change: 1 addition & 0 deletions nursery/unmanaged-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ rule:
features:
- or:
- characteristic: unmanaged call
- match: unmanaged call via dynamic PInvoke in .NET
- api: System.Runtime.InteropServices.Marshal::GetDelegateForFunctionPointer

0 comments on commit 34bff73

Please sign in to comment.