PowerShell In-Memory Shellcode Execution via Memory Allocation APIs (via ps_script)

PremiumReviewedSigma · Medium · v1
Product
windows
Category
ps_script
Author
HuntRule
Published
2026-07-03
Updated
2026-08-28

ATT&CK techniques

Priv Esc → Defense Evasion
  1. Recon

  2. Resource Dev

  3. Initial Access

  4. Execution

  5. Persistence

  6. Cred Access

  7. Discovery

  8. Lateral Movement

  9. Collection

  10. C2

  11. Exfiltration

  12. Impact

What it detects

This rule detects a PowerShell script block that combines GlobalAlloc VirtualProtect and CreateThread calls to allocate executable memory and run shellcode, the in-memory loading behavior of the RokRAT search.dat loader read from the public directory. Adversaries leverage reflective shellcode execution to run their payload without touching disk as a file, making early detection critical for surfacing fileless code execution before RokRAT deploys.

Related detections9 linkedT1055 — drag to rearrange
Suspicious AppLaunch.exe Spawned As Injection Target (via process_creation)
Suspicious BugSleep Marker File in Public Directory
Suspicious CRAT Injection Named Pipe ChromeUpdatePipe (via pipe_created)
AsyncRAT Injector libPK.dll Written to Public Folder (via file_event)
FlawedGrace spawning threat injection target
In-Memory Ramnit Process Injection Target Spawned by WmiPrvSE in drIBAN Fraud Operation (via process_creation)
Malicious aspnet_compiler.exe Injection Host Spawned by PowerShell via process_creation
PowerShell Reflective Shellcode Loader via Dynamic API Delegates (via ps_script)
Obfuscated XE Group Reflective Loader via PowerShell Spawned by IIS Worker Process (via process_creation)
PowerShell In-Memory Shellcode Execution via Memory Allocation APIs (via ps_script)
Pivot detection · T1055 · 9 related

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.