#include #include #include #include void vuln(const char *pCommand){ char command[10]; strncpy(command, "/bin/", 5); command[5] = '\0'; strcat(command, pCommand); printf("Command: %s\n", command); if (getuid() == 0){ system(command); } else{ if (!strcmp("/bin/date", command)){ system("/bin/date"); } else{ printf("Not allowed\n"); } } } int main(int argc, char **argv){ if (argc < 2){ printf("Usage: ./ret2plt \n"); exit(1); } vuln(argv[1]); return 0; }