Windows System Service Creation of Obfuscated PowerShell IEX (Invoke-Obfuscation)

Flags Windows service creations whose ImagePath contains obfuscated PowerShell IEX invocation strings.

FreeReviewedSigma · High · v2
Product
windows
Service
system
Author
Daniel Bohannon (@Mandiant/@FireEye), oscd.community (SigmaHQ), DRL 1.1
Published
2019-11-08
Updated
2026-07-31
title: Windows System Service Creation of Obfuscated PowerShell IEX (Invoke-Obfuscation)
id: e444e4a5-e628-4f04-9eac-e361d63fb106
status: test
description: This rule identifies Windows service creation events (EventID 7045) whose ImagePath fields match patterns associated with obfuscated PowerShell IEX invocation generated by the Invoke-Obfuscation framework referenced in the rule. Obfuscated IEX usage matters because it can hide real PowerShell commands and payload logic while still executing them via a service context. The detection relies on System event telemetry containing the service ImagePath string and matches multiple regex patterns to those obfuscation constructs.
references:
  - https://github.com/danielbohannon/Invoke-Obfuscation/blob/f20e7f843edd0a3a7716736e9eddfa423395dd26/Out-ObfuscatedStringCommand.ps1#L873-L888
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/builtin/system/service_control_manager/win_system_invoke_obfuscation_obfuscated_iex_services.yml
author: Daniel Bohannon (@Mandiant/@FireEye), oscd.community, Huntrule Team
date: 2019-11-08
modified: 2022-11-27
tags:
  - attack.stealth
  - attack.t1027
logsource:
  product: windows
  service: system
detection:
  selection_eid:
    EventID: 7045
  selection_imagepath:
    - ImagePath|re: \$PSHome\[\s*\d{1,3}\s*\]\s*\+\s*\$PSHome\[
    - ImagePath|re: \$ShellId\[\s*\d{1,3}\s*\]\s*\+\s*\$ShellId\[
    - ImagePath|re: \$env:Public\[\s*\d{1,3}\s*\]\s*\+\s*\$env:Public\[
    - ImagePath|re: \$env:ComSpec\[(\s*\d{1,3}\s*,){2}
    - ImagePath|re: \\*mdr\*\W\s*\)\.Name
    - ImagePath|re: \$VerbosePreference\.ToString\(
    - ImagePath|re: \String\]\s*\$VerbosePreference
  condition: all of selection_*
falsepositives:
  - Unknown
level: high
license: DRL-1.1
related:
  - id: 51aa9387-1c53-4153-91cc-d73c59ae1ca9
    type: derived