Windows Security 4697: Obfuscated command uses rundll32 with shell32.dll

Alerts on EventID 4697 service command lines containing rundll32 with shell32.dll/shellexec_rundll and obfuscation-like script fragments.

FreeReviewedSigma · High · v2
Product
windows
Service
security
Author
Nikita Nazarov, oscd.community (SigmaHQ), DRL 1.1
Published
2020-10-09
Updated
2026-07-31
title: "Windows Security 4697: Obfuscated command uses rundll32 with shell32.dll"
id: 97206b77-2044-4435-8625-8cf96eda4949
related:
  - id: 641a4bfb-c017-44f7-800c-2aee0184ce9b
    type: derived
  - id: cd0f7229-d16f-42de-8fe3-fba365fbcb3a
    type: derived
status: test
description: This rule flags Windows Security audit events (EventID 4697) where the registered service command line contains an obfuscation pattern along with rundll32 usage of shell32.dll and related rundll export strings. Attackers may use this execution path to hide their true intent while launching script-related commands. It relies on the Security log capturing the service installation details, specifically the ServiceFileName content.
references:
  - https://github.com/SigmaHQ/sigma/issues/1009
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/builtin/security/win_security_invoke_obfuscation_via_use_rundll32_services_security.yml
author: Nikita Nazarov, oscd.community, Huntrule Team
date: 2020-10-09
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:
      - "&&"
      - rundll32
      - shell32.dll
      - shellexec_rundll
    ServiceFileName|contains:
      - value
      - invoke
      - comspec
      - iex
  condition: selection
falsepositives:
  - Unknown
level: high
license: DRL-1.1