Detection rules › Sigma

macOS Setuid/Setgid Privilege Escalation

Status
experimental
Severity
high
Log source
product macos, service endpointsecurity
Author
Eric Brown - Nebulock, Inc.
Source
github.com/Nebulock-Inc/macos-coresigma

Detects setuid or setgid operations that transition to root (UID 0) from non-root users, which may indicate privilege escalation attempts. These syscalls allow processes to change their effective user ID or group ID, often used by attackers to gain elevated privileges. High-fidelity detection focuses on transitions to root from non-privileged users.

MITRE ATT&CK coverage

Rule body yaml

title: macOS Setuid/Setgid Privilege Escalation
id: 0f3109b3-d7e5-4c8a-a082-d8f0fa7be7a1
status: experimental
description: 'Detects setuid or setgid operations that transition to root (UID 0) from
  non-root users, which may indicate privilege escalation attempts.

  These syscalls allow processes to change their effective user ID or group ID, often

  used by attackers to gain elevated privileges. High-fidelity detection focuses on

  transitions to root from non-privileged users.

  '
author: Eric Brown - Nebulock, Inc.
date: 2025/10/31
modified: 2025/10/31
references:
- https://attack.mitre.org/techniques/T1548/001/
- https://attack.mitre.org/techniques/T1068/
logsource:
  product: macos
  service: endpointsecurity
detection:
  selection_setuid:
    esf.event_type: 24
    event.action: setuid
  selection_setgid:
    esf.event_type: 25
    event.action: setgid
  selection_to_root:
    TargetUserId: 0
  selection_root_source:
    UserId: 0
  condition: (selection_setuid or selection_setgid) and selection_to_root and not selection_root_source
falsepositives:
- Legitimate system utilities and services
- Software installation and updates
- Authorized administrative tools
fields:
- event_type
- event_name
- ProcessId
- User
- UserId
- TargetUser
- TargetUserId
tags:
- attack.privilege_escalation
- attack.t1548.001
- attack.t1068
level: high

Stages and Predicates

Stage 0: condition

(selection_setuid or selection_setgid) and selection_to_root and not selection_root_source

Stage 1: selection_setuid

selection_setuid:
  esf.event_type: 24
  event.action: setuid

Stage 2: selection_setgid

selection_setgid:
  esf.event_type: 25
  event.action: setgid

Stage 3: selection_to_root

selection_to_root:
  TargetUserId: 0

Stage 4: not selection_root_source

selection_root_source:
  UserId: 0

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
UserIdeq0

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
TargetUserIdeq
  • 0
esf.event_typeeq
  • 24
  • 25
event.actioneq
  • setgid
  • setuid