Potential WinAPI Calls Via CommandLine

Last updated on:

About the rule

Rule Type

Standard

Rule Description

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

Severity

Trouble

Rule Requirement

Criteria

Action1: actionname = "Process started" AND (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" OR COMMANDLINE contains "memcpy,MiniDumpWriteDump,ntdll,OpenDesktop,OpenProcess,OpenProcessToken,OpenThreadToken,OpenWindowStation,PtrToString,QueueUserApc,ReadProcessMemory,RevertToSelf,RtlCreateUserThread,secur32,SetThreadToken,VirtualAlloc,VirtualFree,VirtualProtect,WaitForSingleObject,WriteInt32,WriteProcessMemory,ZeroFreeGlobalAllocUnicode") AND ((PROCESSNAME notendswith "\MpCmdRun.exe" OR COMMANDLINE notcontains "GetLoadLibraryWAddress32") AND (PARENTPROCESSNAME notendswith "\CompatTelRunner.exe" OR COMMANDLINE notcontains "FreeHGlobal,PtrToString,kernel32,CloseHandle")) select Action1.HOSTNAME,Action1.MESSAGE,Action1.COMMANDLINE,Action1.FILE_NAME,Action1.PROCESSNAME,Action1.USERNAME,Action1.PARENTPROCESSNAME

Detection

Execution Mode

realtime

Log Sources

Windows

Author

Nasreddine Bencherchali (Nextron Systems)