Windows Security Event 4697: Obfuscated PowerShell Invocation Through Stdin
Alerts on Service creation events where the service command line includes stdin-style PowerShell obfuscation indicators.
- Product
- windows
- Service
- security
- Author
- Nikita Nazarov, oscd.community (SigmaHQ), DRL 1.1
- Published
- 2020-10-12
- 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 service installation events (Event ID 4697) where the service file command line appears to include PowerShell invocation patterns combined with standard input style input placeholders. Attackers often use obfuscated PowerShell to evade detection while executing payloads, and abusing stdin can help deliver encoded or hidden commands. The detection relies on telemetry from the Windows Security log (System Security Extension auditing for EID 4697) capturing the service file name/command line string.
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 Security Event 4697: Obfuscated PowerShell Invocation Through Stdin"
id: b6273dd9-0629-400a-9b5c-c9244d90212d
related:
- id: 487c7524-f892-4054-b263-8a0ace63fc25
type: derived
- id: 80b708f3-d034-40e4-a6c8-d23b7a7db3d1
type: derived
status: test
description: This rule flags Windows service installation events (Event ID 4697) where the service file command line appears to include PowerShell invocation patterns combined with standard input style input placeholders. Attackers often use obfuscated PowerShell to evade detection while executing payloads, and abusing stdin can help deliver encoded or hidden commands. The detection relies on telemetry from the Windows Security log (System Security Extension auditing for EID 4697) capturing the service file name/command line string.
references:
- https://github.com/SigmaHQ/sigma/issues/1009
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/builtin/security/win_security_invoke_obfuscation_via_stdin_services_security.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: security
definition: The 'System Security Extension' audit subcategory need to be enabled to log the EID 4697
detection:
selection:
EventID: 4697
ServiceFileName|contains|all:
- set
- "&&"
ServiceFileName|contains:
- environment
- invoke
- ${input)
condition: selection
falsepositives:
- Unknown
level: high
license: DRL-1.1