Sigma rule: WinAPI Library Calls Via PowerShell Scripts

A detection rule from the SigmaHQ repository, shown as its author published it. Dataset version ref-f5c29ee133f0, updated 2023-07-21T00:00:00.000Z.

Rule

Title
WinAPI Library Calls Via PowerShell Scripts
Status
test
Level
medium
Author
Nikita Nazarov, oscd.community, Nasreddine Bencherchali (Nextron Systems)
Date
2023-07-21
File
rules-threat-hunting/windows/powershell/powershell_script/posh_ps_win_api_functions_access.yml
Commit
ccbb0369507f796db0b0ae6854c8a2be471b9d84

Detects calls to WinAPI libraries from PowerShell scripts. Attackers can often leverage these APIs to avoid detection based on typical PowerShell function calls. Use this rule as a basis to hunt for interesting scripts.

Log source

product
windows
category
ps_script
definition
Requirements: Script Block Logging must be enabled

Detection

selection:
    ScriptBlockText|contains:
        - 'Advapi32.dll'
        - 'kernel32.dll'
        - 'KernelBase.dll'
        - 'ntdll.dll'
        - 'secur32.dll'
        - 'user32.dll'
condition: selection

False positives (as the rule lists them)

  • Carbon PowerShell Module (https://github.com/webmd-health-services/Carbon)
  • Chocolatey scripts

Tags

  • attack.execution
  • attack.t1059.001
  • attack.t1106
  • detection.threat-hunting

MITRE ATT&CK ids this rule names

Related rules

References

Read on 2026-11-03T00:58:21.399Z under licence sigma-drl-1.1@d5f4c36a from https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules-threat-hunting/windows/powershell/powershell_script/posh_ps_win_api_functions_access.yml

Sources and licences

  • SigmaHQ

    "WinAPI Library Calls Via PowerShell Scripts" by Nikita Nazarov, oscd.community, Nasreddine Bencherchali (Nextron Systems) (SigmaHQ). Rule: https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules-threat-hunting/windows/powershell/powershell_script/posh_ps_win_api_functions_access.yml.
    Licensed under the Detection Rule License (DRL) 1.1: https://github.com/SigmaHQ/Detection-Rule-License

    Detection Rule License (DRL) 1.1

Cite this page

Dragons Eye Ransomware Tracker, "Sigma rule: WinAPI Library Calls Via PowerShell Scripts",
entity page, dataset version ref-f5c29ee133f0, updated 2023-07-21T00:00:00.000Z,
https://ransomware-tracker.com/detections/sigma/19d65a1c-8540-4140-8062-8eb00db0bba5 (accessed 2026-11-03).
Underlying source: SigmaHQ rule 19d65a1c-8540-4140-8062-8eb00db0bba5, commit ccbb0369507f796db0b0ae6854c8a2be471b9d84.

Pages change. The dataset version identifies the data, but no archive of old versions is kept, so this citation cannot be replayed later.