Persistence (TA0003)(external, opens in a new tab or window)
text code block:any where host.os.type == "windows" and ( ( event.code : "4697" and ( ( ( winlog.event_data.ServiceFileName : ( "*COMSPEC*", "*\\127.0.0.1*", "*Admin$*", "*powershell*", "*rundll32*", "*cmd.exe*", "*echo*", "*RemComSvc*", "*.bat*", "*.cmd*", "*certutil*", "*vssadmin*", "*certmgr*", "*bitsadmin*", "*\\Users\\*", "*\\Windows\\Tasks\\*", "*\\PerfLogs\\*", "*\\Windows\\Debug\\*", "*regsvr32*", "*msbuild*", "*winexesvc.exe*", "*DumpSvc.exe*", "*pwsh.exe*", "*PAExec*" ) or winlog.event_data.ServiceFileName regex~ """%systemroot%\\[a-z0-9]+\.exe""" ) and not winlog.event_data.ServiceFileName: ( "%SystemRoot%\\PSEXESVC.exe", "%SystemRoot%\\\\RemComSvc.exe", "%SystemRoot%\\pbpsdeploy.exe", "%SystemRoot%\\system32\\RemComSvc.exe", "\"C:\\Program Files\\Common Files\\Zoom\\Support\\CptService.exe*", "\"C:\\Program Files\\Common Files\\ZoomVDIPluginManagement\\Support\\CptService.exe*", "\"C:\\Program Files (x86)\\CheckPoint\\Endpoint Security\\EFR\\host\\cpsechost.exe\" service" ) ) or winlog.event_data.ServiceName : ( "mssecsvc2.0", "WCESERVICE*", "WCE SERVICE*", "pwdump*", "gsecdump*", "cachedump*" ) ) ) or ( event.code : "7045" and ( ( winlog.event_data.ImagePath : ( "*COMSPEC*", "*\\127.0.0.1*", "*Admin$*", "*powershell*", "*rundll32*", "*cmd.exe*", "*echo*", "*.bat*", "*.cmd*", "*certutil*", "*vssadmin*", "*certmgr*", "*bitsadmin*", "*\\Users\\*", "*\\Windows\\Tasks\\*", "*\\PerfLogs\\*", "*\\Windows\\Debug\\*", "*regsvr32*", "*msbuild*", "*winexesvc.exe*", "*DumpSvc.exe*", "*pwsh.exe*", "*PAExec*" ) and not winlog.event_data.ImagePath : ( "%SystemRoot%\\PSEXESVC.exe", "%SystemRoot%\\\\RemComSvc.exe", "%SystemRoot%\\pbpsdeploy.exe", "%SystemRoot%\\system32\\RemComSvc.exe", "\"C:\\Program Files\\Common Files\\Zoom\\Support\\CptService.exe*", "\"C:\\Program Files\\Common Files\\ZoomVDIPluginManagement\\Support\\CptService.exe*", "\"C:\\Program Files (x86)\\CheckPoint\\Endpoint Security\\EFR\\host\\cpsechost.exe\" service" ) ) or winlog.event_data.ServiceName : ( "mssecsvc2.0", "WCESERVICE*", "WCE SERVICE*", "pwdump*", "gsecdump*", "cachedump*" ) ) ) )
Install detection rules in Elastic Security
Detect Suspicious Service was Installed in the System in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).