ISSETUGID(2)

✨ ISSETUGID(2) ✨

okay bestie, this is the manual page for issetugid from the System Calls Manual (that's section 2, the syscall girlies πŸ’…). Buckle up, it's short but it's important.


🌸 NAME 🌸

issetugid β€” is current process tainted by uid or gid changes πŸ‘€


πŸŽ€ LIBRARY πŸŽ€

Standard C Library (libc, -lc)


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <unistd.h>

int
issetugid(void);

πŸ’– DESCRIPTION πŸ’–

so the issetugid() system call returns 1 if the process environment or memory address space is considered β€œtainted”, and returns 0 otherwise. that's it. that's the whole vibe check. ✨

a process is tainted if it was created as a result of an execve(2) system call which had either of the setuid or setgid bits set (and extra privileges were given as a result), or if it has changed any of its real, effective or saved user or group ID's since it began execution. no cap.

this system call exists so that library routines (eg: libc, libtermcap) can reliably determine if it is safe to use information that was obtained from the user β€” in particular the results from getenv(3) should be viewed with suspicion if it is used to control operation. 🚨 like, do NOT trust that env var bestie, it might be lying to you.

a β€œtainted” status is inherited by child processes as a result of the fork(2) system call (or other library code that calls fork, such as popen(3)). the taint is giving generational trauma fr fr 😭

it is assumed that a program that clears all privileges as it prepares to execute another will also reset the environment, hence the β€œtainted” status will not be passed on. this is important for programs such as su(1) which begin setuid but need to be able to create an untainted process. main character energy honestly πŸ‘‘


😭 ERRORS 😭

the issetugid() system call is always successful, and no return value is reserved to indicate an error. it simply cannot flop. πŸ’€βœ¨


πŸ‘€ SEE ALSO πŸ‘€

the whole setuid setgid friend group, obsessed 🫢


🌈 HISTORY 🌈

the issetugid() system call first appeared in OpenBSD 2.0 and was also implemented in FreeBSD 3.0. iconic behavior, truly ahead of its time πŸ’…


and that's the whole page bestie!! this one came from the Debian crew, dated August 25, 1996 β€” so like, a vintage queen πŸŽ€ stay untainted, love u, bye!! πŸ’œπŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from