#include #include #include #include #include "dump_stack.h" /* * Goal: Get the program to run a shell. */ void vuln(char *str) { char buf[64]; strcpy(buf, str); dump_stack((void **) buf, 21, (void **) &str); } int main(int argc, char **argv) { if (argc != 2) { printf("Usage: buffer_overflow_shellcode [str]\n"); return 1; } uid_t euid = geteuid(); setresuid(euid, euid, euid); vuln(argv[1]); return 0; }