Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
- #include <sys/types.h>
- #define BUFSIZE 148
- #define FLAGSIZE 128
- void vuln(char *buf){
- gets(buf);
- puts(buf);
- }
- int main(int argc, char **argv){
- setvbuf(stdout, NULL, _IONBF, 0);
- // Set the gid to the effective gid
- // this prevents /bin/sh from dropping the privileges
- gid_t gid = getegid();
- setresgid(gid, gid, gid);
- char buf[BUFSIZE];
- puts("Enter a string!");
- vuln(buf);
- puts("Thanks! Executing now...");
- ((void (*)())buf)();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement