Successfully added uprobes calculation and hooking at arbitrary function of execve_hijack.

This commit is contained in:
h3xduck
2022-03-03 05:53:51 -05:00
parent e64839f080
commit 0c88d5baa9
19 changed files with 1931 additions and 1817 deletions

View File

@@ -3,13 +3,10 @@ HEADERS = lib/RawTCP.h
EXTRA_CFLAGS= -I$(PWD)/lib
default:
make execve_hijack injection_ex
make execve_hijack injection_lib
injection_ex.o: injection_ex.c
clang -g -Wall -c injection_ex.c
injection_ex: injection_ex.o
clang -g -Wall -o injection_ex injection_ex.o -ldl
injection_lib: injection_lib.o
gcc -Wall -shared -fPIC -o injection_lib.so injection_lib.c -ldl
execve_hijack.o: execve_hijack.c $(HEADERS)
clang -c execve_hijack.c
@@ -20,5 +17,5 @@ execve_hijack: execve_hijack.o lib/libRawTCP_Lib.a
clean:
-rm -f execve_hijack.o
-rm -f execve_hijack
-rm -f injection_ex.o
-rm -f injection_ex
-rm -f injection_lib.o
-rm -f injection_lib.so

View File

@@ -71,7 +71,7 @@ int main(int argc, char* argv[], char *envp[]){
for(int ii=0; ii<argc; ii++){
printf("Argument %i is %s\n", ii, argv[ii]);
}
time_t rawtime;
struct tm * timeinfo;

View File

@@ -1,23 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <dlfcn.h>
#include <link.h>
int main(){
struct link_map *lm;
off_t offset = 0;
unsigned long long dlopenAddr;
lm = dlopen("libc.so.6", RTLD_LAZY);
if(lm==0){
perror("Error obtaining libc symbols");
return -1;
}
dlopenAddr = (unsigned long long)dlsym((void*)lm, "__libc_dlopen_mode");
printf("libdl: %lx\n", lm->l_addr);
printf("dlopen: %llx\n", dlopenAddr);
offset = dlopenAddr - lm->l_addr;
printf("Offset: %lx\n", offset);
return 0;
}

Binary file not shown.

View File

@@ -0,0 +1,7 @@
#include <stdio.h>
__attribute__((constructor))
static void init()
{
puts("It worked\n");
}

BIN
src/helpers/injection_lib.o Normal file

Binary file not shown.