
Note: The code in this repo is to demo the isolation of secure pod sandbox technologies such as kata containers and does not intend to attack any platforms.
echo 0 > /proc/sys/kernel/kptr_restrict
cat /proc/kallsyms
(gdb) p &(((struct task_struct *)0)->fs)
(gdb) p &(((struct task_struct *)0)->parent)
(gdb) p &(((struct fs_struct *)0)->root)
The waitid implementation in upstream kernels did not restrict the target destination to copy information results. This can allow local users to write to otherwise protected kernel memory, which can lead to privilege escalation.
The bug was introduced the 2017-05-21 and fixed 2017-10-09.
This CVE has already been fixed on later releases of 4.13 branch and newer mainline kernels. However, there may exist similar CVEs allows privilege escalation. The CVE itself is quite similar to famous dirty cow, CVE-2016-5195 actually.
CVE-2017-5123.c use this vulnerability change the value of /proc/sys/vm/mmap_min_addr. Then let Linux kernel call shellcode to get file access permission of host root.