You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which will set the image.entry to whatever we set in a static-linked binary, for example 0x0.
Basically, we can exec a static binary with header.e_entry setting to address lower than the kernel base 0x100000 and use TOARU_SYS_FUNC_MMAP in sys_sysfunc to map the whole kernel image into the user space. Then we just patch the sys_setuid's check and spawn another process to get root shell.
Glossing over the obvious error of using user-controlled data in a 'security' check, this check doesn't even make sense in the normal case - surely an entirely normal binary could have an entry point that is after some address that would be passed to a system call?
Since Misaka no longer extends the low kernel address space (and doesn't map anything from the kernel low in the aarch64 port), possibly a more sensible check is if the address is after the end of the low kernel mapping - or maybe I should get off my butt and get around to moving the x86-64 kernel to a higher-half mapping...
The PTR_INRANGE compared the input address within the range
(current_process->image.entry, 0x8000000000000000)
However, it could be bypassed using this:
toaruos/kernel/misc/elf64.c
Line 353 in a54a0cb
which will set the
image.entry
to whatever we set in a static-linked binary, for example0x0
.Basically, we can exec a static binary with
header.e_entry
setting to address lower than the kernel base0x100000
and useTOARU_SYS_FUNC_MMAP
insys_sysfunc
to map the whole kernel image into the user space. Then we just patch thesys_setuid
's check and spawn another process to get root shell.Here is a proof-of-concept that I used in hxp ctf 2024.
The text was updated successfully, but these errors were encountered: