in reply to Re: Not understanding the code to drop privileges in perlsec
in thread Not understanding the code to drop privileges in perlsec
I think your claim that it's a no-op is wrong.
setuid() sets the effective user ID of the calling process. If the calling process is privileged (more precisely: if the process has the CAP_SETUID capability in its user namespace), the real UID and saved set-user-ID are also set.
Under Linux, setuid() is implemented like the POSIX version with the _POSIX_SAVED_IDS feature. This allows a set-user-ID (other than root) program to drop all of its user privileges, do some un-privileged work, and then reengage the original effective user ID in a secure manner.
It was suggested to the OP that they to trace the ids throughout the program when they posted the exact same question on StackOverflow. You should also adopt that recommendation!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Not understanding the code to drop privileges in perlsec
by Nocturnus (Scribe) on Feb 22, 2024 at 19:45 UTC | |
|
Re^3: Not understanding the code to drop privileges in perlsec
by Nocturnus (Scribe) on Feb 22, 2024 at 20:05 UTC |