Linux Kernel Hijacking Part 2
commit_creds(struct cred*)
replaces the currently active credentialsstruct cred *prepare_kernel_cred(struct task_struct *referenced_task_struct)
commit_creds(prepare_kernel_cred(0))
Every process contains virtual memory which includes:
Physical Memory 0x0000000000 - 0xffffffff
Physical Memory is all memory for the entire system and its exact location.
Virtual Memory is an allocated chunk of memory on the physical system for the process. It has its own addressing.
Physical Memory 0x0000000000 - 0xffffffff
Physical Memory is all memory for the entire system and its exact location.
Virtual Memory is an allocated chunk of memory on the physical system for the process. It has its own addressing.
From pwn.college
Other Control Registers exist, setting processor options, and lots of other craziness.
For the interested: https://wiki.osdev.org/CPU_Registers_x86mm_struct
within it called mm
active_mm
the task struct: https://elixir.bootlin.com/linux/latest/source/include/linux/sched.h#L632
the flags: https://elixir.bootlin.com/linux/latest/source/arch/x86/include/asm/thread_info.h#L85
current_task_struct->thread_info.flags &= ~(1 << TIF_SECCOMP),
we can break out of seccomp!
What do we need to do:
Access current->thread_info.flags via the gs register
Clear the TIF_SECCOMP flag.
Profit
Caveat: our children will still be seccomped (that's stored elsewhere).