setuid program

PHOTO EMBED

Thu Aug 03 2023 08:47:34 GMT+0000 (Coordinated Universal Time)

Saved by @ronin_78 #c++

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char *argv[])
{
        char *cat="/bin/cat";
    if(argc<2)
        {
                printf("Please type a file name.\n");
                return 1;
        }
     char *command =malloc(strlen(cat) + strlen(argv[1]) + 2);
        sprintf(command,"%s %s", cat,argv[1]);
        system((command));
        return 0;
}
content_copyCOPY