SUID
SGID
GTFOBINS
AUDITD
DetectionBlue TeamSOCOctober 12, 2026•9 min read

Detecting SUID and SGID Abuse on Linux: Enumeration, Creation and Execution

A setuid binary runs with its owner’s privileges. Any one that can start a shell, read arbitrary files or write them is a root path, and the setuid bit is easy to inventory.

Scroll

The setuid and setgid bits let a program run as its owner or group, and attackers abuse them in two ways: finding an existing SUID binary that can be coerced into a shell (T1548.001), or setting the bit on a binary they control to keep root access. Both leave clear traces if you audit for them: the enumeration, the chmod, and the execution where effective and real identity differ.

Signals at a Glance

SignalWhereATT&CK
find with -perm 4000, -perm -u=s or -perm 2000 across the filesystemauditd execve, EDRT1548.001
chmod, fchmod or fchmodat setting the 04000 bitauditd syscall rulesT1548.001
New entry in the SUID inventoryosquery suid_bin diffT1548.001
Process running with euid 0 started by a non-root audit userauditd execve with uid compareT1548.001
Shell started with -p by a GTFOBins SUID binaryauditd, EDRT1548.001

Watching Creation and Execution

Two audit rules cover most of the behaviour. The first records any call that sets the setuid bit (04000 is 0x800 in the mode argument). The second records execution where the effective user is root but the real user is not, which is what a working SUID escalation looks like:

# /etc/audit/rules.d/suid.rules
-a always,exit -F arch=b64 -S chmod,fchmod -F a1&0x800 -k suid_set
-a always,exit -F arch=b64 -S fchmodat -F a2&0x800 -k suid_set
-a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid_exec
-w /usr/bin/find -p x -k suid_enum
# tune/validate: setuid_exec fires for sudo, su, passwd and ping; baseline those before alerting.

Inventory, Diff and Shell Flags

An inventory makes the unusual visible. Take a baseline of SUID files per host class, then alert on additions and on any binary in a GTFOBins-listed set that carries the bit. In osquery:

-- osquery: SUID inventory with differential scheduling (alert on added rows)
SELECT s.path, s.username, s.groupname, s.permissions, h.sha256
FROM suid_bin s
JOIN hash h ON h.path = s.path;
-- tune/validate: schedule as a differential query and review additions by hash.
title: Shell Started with Privilege-Preserving Flag
logsource:
  product: linux
  category: process_creation
detection:
  selection:
    Image|endswith:
      - '/bash'
      - '/sh'
      - '/dash'
      - '/zsh'
    CommandLine|contains: ' -p'
  condition: selection
level: medium
# tune/validate: legitimate use is rare; correlate with parent binaries such as find, env or python.
Vetted sources

Use GTFOBins for the SUID abuse catalogue, the SigmaHQ Linux process-creation rules, the Neo23x0 auditd configuration for the setuid execve pattern, and Atomic Red Team T1548.001 for validation. Baseline your own environment — package updates change SUID files legitimately.

Build Detections That Fire

Mjolnir Security helps blue teams turn threat intelligence into high-fidelity detections across endpoint, network, identity and cloud telemetry.

Detection EngineeringManaged Detection & ResponseThreat HuntingIncident ResponsePurple Teaming
  • Detection Engineering We build and tune detections mapped to ATT&CK from your own telemetry.
  • Threat Hunting as a Service Hypothesis-driven hunts for the behaviours on this page.
  • 24/7 Incident Response Containment when a detection fires. Call +1 833 403 5875.
Written by: Mjolnir Threat Research (MTAC)  |  Published: October 12, 2026  |  Last reviewed: October 12, 2026