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)?
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Members online


Top