该仓库包含一个针对 CVE-2016-0728 的测试程序,这是 Linux 中一个导致释放后使用(use-after-free)的引用计数泄漏与溢出漏洞。
该漏洞由 Perception Point 发现并分析。本人与该团队无关联。
Welcome to the CVE-2016-0728 testbed
sizeof(struct msg_msg) == 0x30, sizeof(struct key) == 0xb8
PID: 27673, UID: (1000/1000)
Keyring: 1b66e5d6, "test-1a328d6e"
Usage: 1
Press a key: (f)ork (i)ncref (a)uto-incref (r)evoke (h)eap-spray (s)hell (q)uit
在我的测试系统上,通过以下方式可以获得 root shell:
revoke。execl("/bin/sh", "sh", NULL)我发现在运行时使用 watch -n0.1 cat /proc/keys 查看状态很有用。
该代码仅在 x86-64 上测试过,但应该也能在其他架构上运行,因为我并未使用魔数偏移,而是从 Linux 头文件中复制了结构体定义并使用了 sizeof(不过我硬编码了 prepare_kernel_cred 和 commit_creds 的地址)。