Windows Security 4697 PowerShell obfuscated content using COMPRESS OBFUSCATION components
Alerts on service creation events where the ServiceFileName includes PowerShell obfuscation patterns tied to compression stream and ASCII encoding.
- Product
- windows
- Service
- security
- Author
- Timur Zinniatullin, oscd.community (SigmaHQ), DRL 1.1
- Published
- 2020-10-18
- 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 System Security audit events (EventID 4697) where the service binary name indicates PowerShell use of specific obfuscation-related .NET patterns. Attackers may compress and obfuscate PowerShell script content to hinder inspection and detection. The detection relies on Security log telemetry for EventID 4697 and matching string patterns within the logged ServiceFileName.
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 4697 PowerShell obfuscated content using COMPRESS OBFUSCATION components
id: 6aea9ee1-e2f0-4af2-9721-7ea9049c5aaa
related:
- id: 175997c5-803c-4b08-8bb0-70b099f47595
type: derived
- id: 7a922f1b-2635-4d6c-91ef-af228b198ad3
type: derived
status: test
description: This rule flags Windows System Security audit events (EventID 4697) where the service binary name indicates PowerShell use of specific obfuscation-related .NET patterns. Attackers may compress and obfuscate PowerShell script content to hinder inspection and detection. The detection relies on Security log telemetry for EventID 4697 and matching string patterns within the logged ServiceFileName.
references:
- https://github.com/SigmaHQ/sigma/issues/1009
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/builtin/security/win_security_invoke_obfuscation_via_compress_services_security.yml
author: Timur Zinniatullin, oscd.community, Huntrule Team
date: 2020-10-18
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:
- new-object
- text.encoding]::ascii
- readtoend
ServiceFileName|contains:
- system.io.compression.deflatestream
- system.io.streamreader
condition: selection
falsepositives:
- Unknown
level: medium
license: DRL-1.1