Sigma rule: Potential WinAPI Calls Via CommandLine

A detection rule from the SigmaHQ repository, shown as its author published it. Dataset version ref-19288f9f7515, updated 2025-03-06T00:00:00.000Z.

Rule

Title
Potential WinAPI Calls Via CommandLine
Status
test
Level
high
Author
Nasreddine Bencherchali (Nextron Systems)
Date
2022-09-06
Modified
2025-03-06
File
rules/windows/process_creation/proc_creation_win_susp_inline_win_api_access.yml
Commit
ccbb0369507f796db0b0ae6854c8a2be471b9d84

Detects the use of WinAPI Functions via the commandline. As seen used by threat actors via the tool winapiexec

Log source

product
windows
category
process_creation

Detection

selection:
    CommandLine|contains:
        - 'AddSecurityPackage'
        - 'AdjustTokenPrivileges'
        - 'Advapi32'
        - 'CloseHandle'
        - 'CreateProcessWithToken'
        - 'CreatePseudoConsole'
        - 'CreateRemoteThread'
        - 'CreateThread'
        - 'CreateUserThread'
        - 'DangerousGetHandle'
        - 'DuplicateTokenEx'
        - 'EnumerateSecurityPackages'
        - 'FreeHGlobal'
        - 'FreeLibrary'
        - 'GetDelegateForFunctionPointer'
        - 'GetLogonSessionData'
        - 'GetModuleHandle'
        - 'GetProcAddress'
        - 'GetProcessHandle'
        - 'GetTokenInformation'
        - 'ImpersonateLoggedOnUser'
        - 'kernel32'
        - 'LoadLibrary'
        - 'memcpy'
        - 'MiniDumpWriteDump'
        # - 'msvcrt'
        - 'ntdll'
        - 'OpenDesktop'
        - 'OpenProcess'
        - 'OpenProcessToken'
        - 'OpenThreadToken'
        - 'OpenWindowStation'
        - 'PtrToString'
        - 'QueueUserApc'
        - 'ReadProcessMemory'
        - 'RevertToSelf'
        - 'RtlCreateUserThread'
        - 'secur32'
        - 'SetThreadToken'
        # - 'user32'
        - 'VirtualAlloc'
        - 'VirtualFree'
        - 'VirtualProtect'
        - 'WaitForSingleObject'
        - 'WriteInt32'
        - 'WriteProcessMemory'
        - 'ZeroFreeGlobalAllocUnicode'
filter_optional_mpcmdrun:
    Image|endswith: '\MpCmdRun.exe'
    CommandLine|contains: 'GetLoadLibraryWAddress32'
filter_optional_compatTelRunner:
    ParentImage|endswith: '\CompatTelRunner.exe'
    CommandLine|contains:
        - 'FreeHGlobal'
        - 'PtrToString'
        - 'kernel32'
        - 'CloseHandle'
condition: selection and not 1 of filter_optional_*

False positives (as the rule lists them)

  • Some legitimate action or applications may use these functions. Investigate further to determine the legitimacy of the activity.

Tags

  • attack.execution
  • attack.t1106

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/windows/process_creation/proc_creation_win_susp_inline_win_api_access.yml

Sources and licences

  • SigmaHQ

    "Potential WinAPI Calls Via CommandLine" by Nasreddine Bencherchali (Nextron Systems) (SigmaHQ). Rule: https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/windows/process_creation/proc_creation_win_susp_inline_win_api_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: Potential WinAPI Calls Via CommandLine",
entity page, dataset version ref-19288f9f7515, updated 2025-03-06T00:00:00.000Z,
https://ransomware-tracker.com/detections/sigma/ba3f5c1b-6272-4119-9dbd-0bc8d21c2702 (accessed 2026-11-03).
Underlying source: SigmaHQ rule ba3f5c1b-6272-4119-9dbd-0bc8d21c2702, 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.