Windows Service Control Manager: Obfuscated Environment Variable PowerShell via cmd /c set -f
Alerts on Service Control Manager event 7045 where a service ImagePath uses cmd /c|/r with "set" and -f formatting.
- Product
- windows
- Service
- system
- Author
- Jonathan Cheong, oscd.community (SigmaHQ), DRL 1.1
- Published
- 2020-10-15
- Updated
- 2026-07-31
ATT&CK techniques
Execution → Defense EvasionRecon
Resource Dev
Initial Access
Execution
Persistence
Priv Esc
Defense Evasion
Cred Access
Discovery
Lateral Movement
Collection
C2
Exfiltration
Impact
What it detects
This rule flags Windows services that use the Service Control Manager (EventID 7045) to start a process whose ImagePath indicates an obfuscated cmd-based PowerShell launcher. Attackers often hide execution by combining cmd /c or /r with Environment Variable operations (set and format-style -f usage) to conceal commands from straightforward inspection. The detection relies on System telemetry from Service Control Manager, matching patterns in the ImagePath field for cmd execution and the presence of obfuscation-related string fragments.
Reporting behind it
Changelog
v2- v2Candidate ingested via manual entry.2026-07-31
- v1No changelog recorded for this version.2026-07-30
Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.
title: "Windows Service Control Manager: Obfuscated Environment Variable PowerShell via cmd /c set -f"
id: 069fbc6b-c17b-4f4a-abee-eb91ce26252d
status: test
description: This rule flags Windows services that use the Service Control Manager (EventID 7045) to start a process whose ImagePath indicates an obfuscated cmd-based PowerShell launcher. Attackers often hide execution by combining cmd /c or /r with Environment Variable operations (set and format-style -f usage) to conceal commands from straightforward inspection. The detection relies on System telemetry from Service Control Manager, matching patterns in the ImagePath field for cmd execution and the presence of obfuscation-related string fragments.
references:
- https://github.com/SigmaHQ/sigma/issues/1009
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/builtin/system/service_control_manager/win_system_invoke_obfuscation_var_services.yml
author: Jonathan Cheong, oscd.community, Huntrule Team
date: 2020-10-15
modified: 2022-11-29
tags:
- attack.stealth
- attack.t1027
- attack.execution
- attack.t1059.001
logsource:
product: windows
service: system
detection:
selection:
Provider_Name: Service Control Manager
EventID: 7045
ImagePath|contains|all:
- cmd
- '"set'
- -f
ImagePath|contains:
- /c
- /r
condition: selection
falsepositives:
- Unknown
level: high
license: DRL-1.1
related:
- id: 8ca7004b-e620-4ecb-870e-86129b5b8e75
type: derived