
$ cat /proc/sys/kernel/unprivileged_userns_clone
出力:
1
もしファイル "/proc/sys/kernel/unprivileged_userns_clone" が存在しない場合:
$ unshare -mU /bin/sh -c "sleep 5" & /bin/sh -c "sleep 1; cd /proc/$!/cwd; realpath .; kill -9 $!"
出力には、'/' の前に文字列 "(unreachable)" が含まれている必要があります:
[1] 12345
(unreachable)/home/user
オプションは環境変数で渡されます:
TRACE_DEBUG=1 - Value for printing debug information (Default: 0)
STACK_SIZE=100 - Size output data of stack (Default: 100)
実行方法:
$ make
$ cp /bin/umount .
$ LD_PRELOAD="$(realpath tool.so)" TRACE_DEBUG=1 STACK_SIZE=100 ./umount /root
https://www.halfdog.net/Security/2017/LibcRealpathBufferUnderflow/