Windows System: Service Control Manager runs command with obfuscated PowerShell keywords via set and stdin

Alerts on service creation where ImagePath includes obfuscation-like command chaining with environment/invoke/input strings.

FreeReviewedSigma · High · v2
Product
windows
Service
system
Author
Nikita Nazarov, oscd.community (SigmaHQ), DRL 1.1
Published
2020-10-12
Updated
2026-07-31
title: "Windows System: Service Control Manager runs command with obfuscated PowerShell keywords via set and stdin"
id: 835e04a3-3c28-48a5-8835-d540fe2f7927
status: test
description: This rule flags Windows Service Control Manager (Event ID 7045) instances where the configured ImagePath contains command chaining with multiple 'set' statements and includes keywords such as 'environment', 'invoke', and 'input', consistent with obfuscated PowerShell-style execution patterns delivered through stdin-like inputs. Attackers may use this technique to obscure script intent and reduce detection by embedding operations in environment/variable setup and chained command segments. The detection relies on System service creation telemetry, specifically the ImagePath field from Event ID 7045.
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_via_stdin_services.yml
author: Nikita Nazarov, oscd.community, Huntrule Team
date: 2020-10-12
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:
      - set
      - "&&"
    ImagePath|contains:
      - environment
      - invoke
      - input
  condition: selection
falsepositives:
  - Unknown
level: high
license: DRL-1.1
related:
  - id: 487c7524-f892-4054-b263-8a0ace63fc25
    type: derived