...
| Code Block | ||
|---|---|---|
| ||
/* Drop superuser privileges in correct order */
if (setgid(getgid()) == -1) {
/* handle error condition */
}
if (setuid(getuid()) == -1) {
/* handle error condition */
}
/*
* Not possible to regain group privileges due to correct
* relinquishment order
*/
|
Risk Assessment
Failing to observe the correct revocation order while relinquishing privileges can result in unintended privilege escalation.
...