Getting root

#include <stdio.h>
#include <string.h>

int main()
{
    setuid(0);
    seteuid(0);
    setgid(0);
    setegid(0);
    system("/bin/bash");
    return(0);
}
  • Save as foo.c
  • Compile gcc foo.c -o foo
  • sudo chmod u+s foo
  • ./foo
  • id

 

 

132 total views, 2 views today