Potential In-Memory Execution Using Reflection.Assembly


Description

Detects usage of "Reflection.Assembly" load functions to dynamically load assemblies in memory

Query · sigma

selection:
  ScriptBlockText|contains: '[Reflection.Assembly]::load'
filter_optional_sqlserver:
  Path|startswith:
  - C:\Program Files (x86)\Microsoft SQL Server\
  - C:\Program Files\Microsoft SQL Server\
  Path|endswith: \Tools\PowerShell\Modules\SQLPS\SqlPsPostScript.ps1
  ScriptBlockText|contains: 'SQLSERVER: { Set-Location'
condition: selection and not 1 of filter_optional_*

Known false positives

  • Legitimate use of the library
Raw source Potential In-Memory Execution Using Reflection.Assembly · Sigma
Esc
Published by SigmaHQ/sigma ↗, licensed under Detection Rule License 1.1 ↗. Reproduced here unmodified.
title: Potential In-Memory Execution Using Reflection.Assembly
id: ddcd88cb-7f62-4ce5-86f9-1704190feb0a
status: test
description: Detects usage of "Reflection.Assembly" load functions to dynamically load assemblies in memory
references:
    - https://speakerdeck.com/heirhabarov/hunting-for-powershell-abuse?slide=50
author: frack113
date: 2022-12-25
modified: 2026-10-19
tags:
    - attack.stealth
    - attack.t1620
logsource:
    product: windows
    category: ps_script
    definition: Script Block Logging must be enable
detection:
    selection:
        ScriptBlockText|contains: '[Reflection.Assembly]::load'
    filter_optional_sqlserver:
        Path|startswith:
            - 'C:\Program Files (x86)\Microsoft SQL Server\'
            - 'C:\Program Files\Microsoft SQL Server\'
        Path|endswith: '\Tools\PowerShell\Modules\SQLPS\SqlPsPostScript.ps1'
        ScriptBlockText|contains: 'SQLSERVER: { Set-Location'
    condition: selection and not 1 of filter_optional_*
falsepositives:
    - Legitimate use of the library
level: medium
regression_tests_path: regression_data/rules/windows/powershell/powershell_script/posh_ps_dotnet_assembly_from_file/info.yml

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.