How to write a SUID program in C (and other languages)?

in1t5

New Member
Joined
May 13, 2020
Messages
13
Reaction score
4
Credits
121
Recently, I configured a vulnerable server (in a VM), with intended vulnerabilities to exploit to gain access to the system and escalate privileges. One way to get root access was to debug a SUID program written by me. Even if it worked, it was the jankiest way to do it (basically used "setuid(0)").

So now I'm curious. Do you know how to write a proper SUID program in C (and/or other languages)?
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Staff online

Members online


Top