setuids.bt(8)

πŸ“¦
version 0.27.0 Β· 3 versions
  • 0.27.0 Β· alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.14.0 Β· ubuntu jammy
  • 0.20.2 Β· ubuntu noble
, in alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ setuids.bt(8) β€” the setuid tracer πŸ’–

Okay so setuids.bt is the manual name for this tool, and it's giving privilege-escalation detective energy πŸ•΅οΈπŸŽ€. It traces setuid-family syscalls and uses bpftrace/eBPF to do it πŸ”₯. Main character energy, honestly.

🌸 NAME

setuids.bt β€” Trace setuid family of syscalls. Uses bpftrace/eBPF.

πŸ¦‹ SYNOPSIS

setuids.bt

πŸ’… DESCRIPTION

Okay bestie, this tool traces privilege escalation via setuid syscalls πŸ‘€. It's super useful for debugging, whitelist creation, and intrusion detection, so it's lowkey a whole vibe πŸ”βœ¨.

It works by tracing the setuid(2), setfsuid(2), and retresuid(2) syscalls using the syscall tracepoints 🧚. Literally those three, no cap.

⚠️ Since this uses BPF, only the root user can use this tool. Not you, not me, not anybody else without root πŸ’€.

πŸ“‹ REQUIREMENTS

You need CONFIG_BPF and bpftrace 🫢. No shortcuts, periodt.

πŸ“ EXAMPLES

Trace setuid syscalls:

# setuids.bt

🌈 FIELDS

  • PID β€” The calling process ID πŸ†”.
  • COMM β€” The calling process (thread) name 🧡.
  • UID β€” The UID of the caller πŸ‘€.
  • SYSCALL β€” The syscall name πŸ“ž.
  • ARGS β€” The arguments to the syscall 🧩.
  • (RET) β€” The return value for the syscall: 0 means success πŸŽ‰, other numbers indicate an error code πŸ™ˆ.

🫧 OVERHEAD

setuid calls are expected to be low frequency (<< 100/s), so the overhead of this tool is expected to be negligible 😌✨. Chill vibes only.

πŸ’œ SOURCE

This tool originated from the book "BPF Performance Tools", published by Addison Wesley (2019) πŸ“š:

http://www.brendangregg.com/bpf-performance-tools-book.html

See the book for more documentation on this tool πŸ€“.

This version is in the bpftrace repository:

https://github.com/bpftrace/bpftrace

Also look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool πŸ“πŸ«Ά.

πŸ–₯️ OS

Linux 🐧

πŸ§ͺ STABILITY

Unstable - in development 🚧. Handle with care, bestie.

πŸ‘‘ AUTHOR

Brendan Gregg πŸ‘‘πŸ’–

πŸ”— SEE ALSO

capable.bt(8) πŸ¦‹


Stay safe, stay root-only, and keep those setuid calls low-key 🌸. Source: setuids.bt, USER COMMANDS manual page, dated 2019-07-05 πŸ’…βœ¨