Completed execve hijacking, as with special error cases that arise and that are documented in the code.

This commit is contained in:
h3xduck
2022-02-14 17:45:07 -05:00
parent 044c85f3ff
commit edbaf09c06
7 changed files with 2034 additions and 1619 deletions

View File

@@ -4,20 +4,42 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
char* buf = "A string";
int main(int argc, char* argv[]){
printf("Hello world from execve hijacker\n");
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
char* timestr = asctime(timeinfo);
for(int ii=0; ii<argc; ii++){
printf("Argument %i is %s\n", ii, argv[ii]);
}
int fd = open("/tmp/testcreated", O_RDWR | O_CREAT | O_TRUNC, 0666);
int fd = open("/tmp/execve_hijack", O_RDWR | O_CREAT | O_TRUNC, 0666);
int ii = 0;
while(*(timestr+ii)!='\0'){
write(fd, timestr+ii, 1);
ii++;
}
write(fd, "\t", 1);
ii = 0;
while(*(argv[0]+ii)!='\0'){
write(fd, argv[0]+ii, 1);
ii++;
}
write(fd, "\n", 1);
close(fd);
return 0;
}