Windows PowerShell ScriptBlock WinAPI Function Calls

Find PowerShell script blocks that reference WinAPI/native-call function names tied to process, memory, token, or thread operations.

FreeReviewedSigma · Medium · v5
Product
windows
Category
ps_script
Author
Nikita Nazarov, oscd.community, Nasreddine Bencherchali (Nextron Systems) (SigmaHQ), DRL 1.1
Published
2023-07-21
Updated
2026-07-31

ATT&CK techniques

Execution
  1. Recon

  2. Resource Dev

  3. Initial Access

  4. Persistence

  5. Priv Esc

  6. Defense Evasion

  7. Cred Access

  8. Discovery

  9. Lateral Movement

  10. Collection

  11. C2

  12. Exfiltration

  13. Impact

What it detects

This rule flags PowerShell script content that contains references to specific WinAPI and related API functions. Attackers may use direct Windows API calls within PowerShell to perform process, memory, token, thread, and module operations while bypassing expectations based on typical PowerShell function patterns. It relies on Script Block Logging telemetry to capture the script block text and matches it against a defined set of function name substrings.

Related detections9 linkedT1059.001 — drag to rearrange
PowerShell Scripts Calling WinAPI DLLs on Windows
PowerShell Script Block WinAPI Calls Indicative of Injection or Token Abuse (Windows)
Suspicious Script Interpreter Spawned by Explorer via ClickFix Run Dialog (via process_creation)
Suspicious PowerShell Download Cradle via ClickFix Fake CAPTCHA (via process_creation)
Suspicious PowerShell EncodedCommand Spawned From Command Shell via Process Creation
Suspicious Script Download via Curl and PowerShell by Dohdoor
Malicious Mass Hyper-V Virtual Machine Shutdown via PowerShell by Kraken Ransomware
Suspicious PowerShell WebClient DownloadFile of Archive Payload (UAT-7237)
Suspicious SharePoint Worker Process Spawning Command Interpreter via ToolShell
Windows PowerShell ScriptBlock WinAPI Function Calls
Pivot detection · T1059.001 · 9 related

Changelog

v5
  1. v5
    Candidate ingested via manual entry.2026-07-31
  2. v4
    Candidate ingested via manual entry.2026-07-31
  3. v3
    Candidate ingested via manual entry.2026-07-31
  4. v2
    Candidate ingested via manual entry.2026-07-31
  5. v1
    No changelog recorded for this version.2026-07-30

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