Detection rule
CobaltStrike Service Installations - System
Overview
Detects known malicious service installs that appear in cases in which a Cobalt Strike beacon elevates privileges or lateral movement
- Rule id
5a105d34-05fc-401e-8553-272b45c1522d- ATT&CK techniques
- T1021.002 Remote Services: SMB/Windows Admin Shares, T1543.003 Create or Modify System Process: Windows Service, T1569.002 System Services: Service Execution
- Severity
- Critical
- Confidence
- Low
- Origin
- SigmaHQ (community)
- SigmaHQ status
test- Used in defense packs
- The Gentlemen, qilin, INC Ransom, Akira, safepay, Play, everest, nightspire, majinahanashi
Validation
- ExperimentalSyntax checked only. Not yet tested on events.
- Test-data validatedMatched positive test events and ignored near-miss events. Not yet run in a production SIEM.
- SIEM-validatedRun in a real SIEM, with a recorded result.
1 of 1 positive test events matched; 1 of 1 near-miss events were correctly ignored. Community rule reused unmodified from SigmaHQ. OffSet7 converted it and tested it on synthetic events.
Detection logic and queries
Queries are shown exactly as generated. Test them in your environment before you deploy them.
Sigma
Sigma (YAML) · 5a105d34-05fc-401e-8553-272b45c1522d
title: CobaltStrike Service Installations - System
id: 5a105d34-05fc-401e-8553-272b45c1522d
status: test
description: Detects known malicious service installs that appear in cases in which a Cobalt Strike beacon elevates privileges or lateral movement
references:
- https://www.sans.org/webcasts/119395
- https://www.crowdstrike.com/blog/getting-the-bacon-from-cobalt-strike-beacon/
- https://thedfirreport.com/2021/08/29/cobalt-strike-a-defenders-guide/
author: Florian Roth (Nextron Systems), Wojciech Lesicki
date: 2021-05-26
modified: 2022-11-27
tags:
- attack.persistence
- attack.execution
- attack.privilege-escalation
- attack.lateral-movement
- attack.t1021.002
- attack.t1543.003
- attack.t1569.002
logsource:
product: windows
service: system
detection:
selection_id:
Provider_Name: 'Service Control Manager'
EventID: 7045
selection1:
ImagePath|contains|all:
- 'ADMIN$'
- '.exe'
selection2:
ImagePath|contains|all:
- '%COMSPEC%'
- 'start'
- 'powershell'
selection3:
ImagePath|contains: 'powershell -nop -w hidden -encodedcommand'
selection4:
ImagePath|base64offset|contains: "IEX (New-Object Net.Webclient).DownloadString('http://127.0.0.1:"
condition: selection_id and (selection1 or selection2 or selection3 or selection4)
falsepositives:
- Unknown
level: criticalQRadar CRE
Design for the QRadar Rule Wizard. It is not importable and has not been tested in QRadar.
- Rule name
OffSet7: CobaltStrike Service Installations - System- Rule type
- Event rule (Local)
- Log source types
- Microsoft Windows Security Event Log DSM (System channel)
Building blocks
BB:OffSet7:CobaltStrike Service Installations System:selection_id(match)All test lines must match (AND).- custom property needed:
Provider_Nameis equal to (case-insensitive):Service Control ManagerNo QRadar property mapped for "Provider_Name": create a custom event property (regex or JSON) on the DSM first. Event IDis equal to (case-insensitive):7045
- custom property needed:
BB:OffSet7:CobaltStrike Service Installations System:selection1(match)All test lines must match (AND).Process Pathcontains:ADMIN$,.exe
BB:OffSet7:CobaltStrike Service Installations System:selection2(match)All test lines must match (AND).Process Pathcontains:%COMSPEC%,start,powershell
BB:OffSet7:CobaltStrike Service Installations System:selection3(match)All test lines must match (AND).Process Pathcontains:powershell -nop -w hidden -encodedcommand
BB:OffSet7:CobaltStrike Service Installations System:selection4(match)All test lines must match (AND).Process Pathcontains:IEX (New-Object Net.Webclient).DownloadString('http://127.0.0.1:
Main rule, option A (building blocks)
- when the event(s) were detected by one or more of these log source types:
Microsoft Windows Security Event Log DSM (System channel) - when an event matches the condition built from these building blocks:
BB:OffSet7:CobaltStrike Service Installations System:selection_id AND (BB:OffSet7:CobaltStrike Service Installations System:selection1 OR BB:OffSet7:CobaltStrike Service Installations System:selection2 OR BB:OffSet7:CobaltStrike Service Installations System:selection3 OR BB:OffSet7:CobaltStrike Service Installations System:selection4)
Main rule, option B (AQL filter test)
Not available: the AQL conversion failed for this rule.
Rule response
- Severity 9, credibility 6, relevance 7
- Ensure the detected event is part of an offense; index offense on Log Source (host) and annotate with the rule title and OffSet7 rule id
- Respond no more than once per 30 minutes per Log Source (tune per environment)
Limitations
- AQL conversion failed (field 'Provider_Name' is not supported); only the building-block design is available.
- QRadar AQL LIKE / CRE string tests are case-sensitive unless the property is lower-cased; the AQL option uses LOWER() where the backend applied it.
Splunk
Splunk SPLSearch
Search for Splunk with Windows/Sysmon field names. A scheduled search or ES correlation search also needs a schedule, time range, throttling and an adaptive response, set in your environment.
source="WinEventLog:System" Provider_Name="Service Control Manager" EventCode=7045 ((ImagePath="*ADMIN$*" ImagePath="*.exe*") OR (ImagePath="*%COMSPEC%*" ImagePath="*start*" ImagePath="*powershell*") OR ImagePath="*powershell -nop -w hidden -encodedcommand*" OR ImagePath="*SUVYIChOZXctT2JqZWN0IE5ldC5XZWJjbGllbnQpLkRvd25sb2FkU3RyaW5nKCdodHRwOi8vMTI3LjAuMC4xO*" OR ImagePath="*lFWCAoTmV3LU9iamVjdCBOZXQuV2ViY2xpZW50KS5Eb3dubG9hZFN0cmluZygnaHR0cDovLzEyNy4wLjAuMT*" OR ImagePath="*JRVggKE5ldy1PYmplY3QgTmV0LldlYmNsaWVudCkuRG93bmxvYWRTdHJpbmcoJ2h0dHA6Ly8xMjcuMC4wLjE6*")Splunk savedsearches.conf stanzaScheduled search template
Template stanza. Review schedule, alert actions and index/sourcetype for your environment before enabling.
[default]
dispatch.earliest_time = -30d
dispatch.latest_time = now
[CobaltStrike Service Installations - System]
description = Detects known malicious service installs that appear in cases in which a Cobalt Strike beacon elevates privileges or lateral movement
search = source="WinEventLog:System" Provider_Name="Service Control Manager" EventCode=7045 ((ImagePath="*ADMIN$*" ImagePath="*.exe*") OR (ImagePath="*%COMSPEC%*" ImagePath="*start*" ImagePath="*powershell*") OR ImagePath="*powershell -nop -w hidden -encodedcommand*" OR ImagePath="*SUVYIChOZXctT2JqZWN0IE5ldC5XZWJjbGllbnQpLkRvd25sb2FkU3RyaW5nKCdodHRwOi8vMTI3LjAuMC4xO*" OR ImagePath="*lFWCAoTmV3LU9iamVjdCBOZXQuV2ViY2xpZW50KS5Eb3dubG9hZFN0cmluZygnaHR0cDovLzEyNy4wLjAuMT*" OR ImagePath="*JRVggKE5ldy1PYmplY3QgTmV0LldlYmNsaWVudCkuRG93bmxvYWRTdHJpbmcoJ2h0dHA6Ly8xMjcuMC4wLjE6*")Elastic
Elastic Lucene (ECS)Hunting query
Lucene query over ECS fields (Winlogbeat/Elastic Agent Windows mappings). A detection rule also needs an index pattern, schedule and actions.
winlog.channel:System AND ((winlog.provider_name:"Service Control Manager" AND event.code:7045) AND ((winlog.event_data.ImagePath:*ADMIN$* AND winlog.event_data.ImagePath:*.exe*) OR (winlog.event_data.ImagePath:*%COMSPEC%* AND winlog.event_data.ImagePath:*start* AND winlog.event_data.ImagePath:*powershell*) OR winlog.event_data.ImagePath:*powershell\ \-nop\ \-w\ hidden\ \-encodedcommand* OR winlog.event_data.ImagePath:(*SUVYIChOZXctT2JqZWN0IE5ldC5XZWJjbGllbnQpLkRvd25sb2FkU3RyaW5nKCdodHRwOi8vMTI3LjAuMC4xO* OR *lFWCAoTmV3LU9iamVjdCBOZXQuV2ViY2xpZW50KS5Eb3dubG9hZFN0cmluZygnaHR0cDovLzEyNy4wLjAuMT* OR *JRVggKE5ldy1PYmplY3QgTmV0LldlYmNsaWVudCkuRG93bmxvYWRTdHJpbmcoJ2h0dHA6Ly8xMjcuMC4wLjE6*)))Elastic EQL (ECS)Hunting query
EQL query over ECS fields. Usable in an Elastic Security EQL rule after review; index pattern and schedule are set per environment.
any where winlog.channel:"System" and ((winlog.provider_name:"Service Control Manager" and event.code:"7045") and ((winlog.event_data.ImagePath:"*ADMIN$*" and winlog.event_data.ImagePath:"*.exe*") or (winlog.event_data.ImagePath:"*%COMSPEC%*" and winlog.event_data.ImagePath:"*start*" and winlog.event_data.ImagePath:"*powershell*") or winlog.event_data.ImagePath:"*powershell -nop -w hidden -encodedcommand*" or winlog.event_data.ImagePath like~ ("*SUVYIChOZXctT2JqZWN0IE5ldC5XZWJjbGllbnQpLkRvd25sb2FkU3RyaW5nKCdodHRwOi8vMTI3LjAuMC4xO*", "*lFWCAoTmV3LU9iamVjdCBOZXQuV2ViY2xpZW50KS5Eb3dubG9hZFN0cmluZygnaHR0cDovLzEyNy4wLjAuMT*", "*JRVggKE5ldy1PYmplY3QgTmV0LldlYmNsaWVudCkuRG93bmxvYWRTdHJpbmcoJ2h0dHA6Ly8xMjcuMC4wLjE6*")))Elastic ES|QL (ECS)Hunting query
ES|QL query over ECS fields; the FROM clause uses * and must be narrowed to your indices.
from * metadata _id, _index, _version | where winlog.channel=="System" and winlog.provider_name=="Service Control Manager" and event.code=="7045" and (winlog.event_data.ImagePath like "*ADMIN$*" and winlog.event_data.ImagePath like "*.exe*" or winlog.event_data.ImagePath like "*%COMSPEC%*" and winlog.event_data.ImagePath like "*start*" and winlog.event_data.ImagePath like "*powershell*" or winlog.event_data.ImagePath like "*powershell -nop -w hidden -encodedcommand*" or winlog.event_data.ImagePath like "*SUVYIChOZXctT2JqZWN0IE5ldC5XZWJjbGllbnQpLkRvd25sb2FkU3RyaW5nKCdodHRwOi8vMTI3LjAuMC4xO*" or winlog.event_data.ImagePath like "*lFWCAoTmV3LU9iamVjdCBOZXQuV2ViY2xpZW50KS5Eb3dubG9hZFN0cmluZygnaHR0cDovLzEyNy4wLjAuMT*" or winlog.event_data.ImagePath like "*JRVggKE5ldy1PYmplY3QgTmV0LldlYmNsaWVudCkuRG93bmxvYWRTdHJpbmcoJ2h0dHA6Ly8xMjcuMC4wLjE6*")No working conversion: Microsoft Sentinel KQL (ASIM) (No ASIM parser/table for this log source in the stock pipeline (see native draft on the Event table where one exists).); Microsoft Defender XDR KQL (Defender XDR advanced hunting has no Windows event-log channel tables (Security/System/Application).); IBM QRadar AQL (hunting query) (QRadar AQL backend has no property mapping for field "Provider_Name")
Required telemetry
- Log source
product: windows · service: system- Fields used
EventIDImagePathProvider_Name
False positives
- Unknown
Investigation and response
No OffSet7 investigation guidance has been written for this rule yet. Start from the false positives above and the ATT&CK technique pages.
References
Author and attribution
- Author
- Florian Roth (Nextron Systems), Wojciech Lesicki
- Source
- SigmaHQ ·
rules/windows/builtin/system/service_control_manager/win_system_cobaltstrike_service_installs.yml - Upstream commit
9688134317a2- Licence
- Detection Rule License (DRL) 1.1
Version history
- Version 1Imported from SigmaHQ
- OffSet7 build · SigmaHQ
9688134317a2