Detection rules › Elastic

UAC Bypass via Service Creation

Time window
1m
Sequence by
Target.process.Ext.authentication_id, process.Ext.authentication_id, user.effective.id, user.id
Source
github.com/elastic/protections-artifacts

Identifies attempts to bypass User Account Control (UAC) by creating a system Service via a network logon from the loopback address. Attackers may attempt to bypass UAC or Administrator Protection feature to execute with elevated permissions.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies attempts to bypass User Account Control (UAC) by creating a system Service via a network logon from the
loopback address. Attackers may attempt to bypass UAC or Administrator Protection feature to execute with elevated
permissions.
"""
id = "7ade264a-785c-48ec-8e07-a26a04033faa"
license = "Elastic License v2"
name = "UAC Bypass via Service Creation"
os_list = ["windows"]
reference = [
    "https://splintercod3.blogspot.com/p/bypassing-uac-with-sspi-datagram.html",
    "https://www.tiraniddo.dev/2022/03/bypassing-uac-in-most-complex-way.html",
]
version = "1.0.3"

query = '''
sequence with maxspan=1m
 [authentication where event.action == "log_on" and user.id == "S-1-0-0" and
  process.Ext.token.elevation == false and process.Ext.session_info.logon_type == "Network" and user.effective.id != "S-1-5-18" and
  /* network logon from loopback address */
  (
   source.ip == null or
   cidrmatch(source.ip,  "127.0.0.0/8", "::1") or
   startswith~(user.effective.domain, winlog.event_data.WorkstationName)
   )
  ] by user.effective.id, Target.process.Ext.authentication_id
 [any where event.category in ("configuration", "iam") and
  event.action in ("service-installed", "service-install") and process.pid == 0 and
  user.id != "S-1-5-18" and winlog.event_data.ServiceAccount == "LocalSystem"] by user.id, process.Ext.authentication_id
'''

min_endpoint_version = "8.18.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[threat.technique.subtechnique]]
id = "T1548.002"
name = "Bypass User Account Control"
reference = "https://attack.mitre.org/techniques/T1548/002/"



[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

[internal]
min_endpoint_version = "8.18.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1m, correlated by Target.process.Ext.authentication_id, process.Ext.authentication_id, user.effective.id, user.id.

Stage 1: authentication

[authentication where event.action == "log_on" and user.id == "S-1-0-0" and
  process.Ext.token.elevation == false and process.Ext.session_info.logon_type == "Network" and user.effective.id != "S-1-5-18" and
  (
   source.ip == null or
   cidrmatch(source.ip,  "127.0.0.0/8", "::1") or
   startswith~(user.effective.domain, winlog.event_data.WorkstationName)
   )
  ] by user.effective.id, Target.process.Ext.authentication_id

Stage 2: any

[any where event.category in ("configuration", "iam") and
  event.action in ("service-installed", "service-install") and process.pid == 0 and
  user.id != "S-1-5-18" and winlog.event_data.ServiceAccount == "LocalSystem"] by user.id, process.Ext.authentication_id

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • log_on corpus 8 (elastic 8)
field:"EventType" kind:eq value:"log_on"
event.actionin
  • service-install
  • service-installed corpus 3 (elastic 3)
field:"EventType" kind:in
event.categoryin
  • configuration corpus 13 (elastic 13)
  • iam corpus 8 (elastic 8)
field:"event.category" kind:in
process.Ext.session_info.logon_typeeq
  • Network corpus 4 (elastic 4)
field:"process.Ext.session_info.logon_type" kind:eq value:"Network"
process.Ext.token.elevationeq
  • false transforms: boolean
field:"process.Ext.token.elevation" kind:eq value:"false"
process.pideq
  • 0 transforms: number corpus 3 (elastic 2, sigma 1)
field:"process_id" kind:eq value:"0"
source.ipcidr_match
  • 127.0.0.0/8 corpus 12 (kusto 7, elastic 5)
  • ::1 corpus 5 (elastic 5)
field:"src_ip" kind:cidr_match
source.ipis_null
  • (no value, null check)
field:"src_ip" kind:is_null
user.effective.domainstarts_with
  • winlog.event_data.WorkstationName (field reference)
field:"user.effective.domain" kind:starts_with value:"winlog.event_data.WorkstationName"
user.effective.idne
  • S-1-5-18
field:"user.effective.id" kind:ne value:"S-1-5-18"
user.ideq
  • S-1-0-0
field:"user.id" kind:eq value:"S-1-0-0"
user.idne
  • S-1-5-18 corpus 36 (elastic 36)
field:"user.id" kind:ne value:"S-1-5-18"
winlog.event_data.ServiceAccounteq
  • LocalSystem corpus 2 (elastic 2)
field:"ServiceAccount" kind:eq value:"LocalSystem"