一个自动化脚本,可从 exploitdb 下载 Linux 内核的潜在漏洞利用程序,并自动编译它们
此脚本因 Hackademics 而起,对于那个内核版本存在着大量可能的漏洞利用程序,作为一名 OSCP 新手学员,我无法找到正确的漏洞利用程序,而且我也懒得一个一个地测试它们。所以我希望这个脚本将来能帮助我。
首先,它通过 searchsploit 在本地目录中搜索来自 exploitdb 的 Linux 权限提升漏洞利用程序。
传入内核版本作为第一个参数,它会列出潜在的漏洞利用程序,并询问你是否想从本地目录复制它们。
之后,它会询问你是否想编译下载的 C 文件。
然后,它会询问你是否想对该目录进行打包(tar ball)。
最后,它会显示已下载文件的摘要。
脚本环境:Kali 3.18.0 kali2
在 Kali 4.0 中的测试结果对脚本来说是失败的,需要重新设计架构,也许 Python 更适合做这种自动化,需要再想想。
16年3月25日 更新为这个概念的 Python 版本,更能适应不同的 Kali 环境,并且在代码修改方面也更简单。
16年4月30日 在几乎完成 OSCP 中的所有环境后,我不得不承认在实验室期间我根本没有使用过这个脚本。在实验室中我学到的一件事是,不要盲目运行漏洞利用程序,因为漏洞利用程序可能导致系统崩溃,或者以你无法想象的方式留下脚印等。始终进行更多的枚举,并收集所有可用的信息来进行权限提升。不要在不了解漏洞利用程序作用的情况下盲目运行它。
root@workstation:~/utilities# ./auto_priv_exploit.sh
[*] Usage: ./auto_priv_exploit.sh VERSION_OF_KERNEL
root@workstation:~/utilities# ls
auto_priv_exploit.sh
root@workstation:~/utilities# ./auto_priv_exploit.sh 2.6
[*] Possible Exploit
Linux Kernel 2.4.x / 2.6.x - uselib() Local Privilege Escalation Exploit | /linux/local/895.c
Linux Kernel 2.4 / 2.6 - bluez Local Root Privilege Escalation Exploit (3) | /linux/local/926.c
Postfix <= 2.6-20080814 - (symlink) Local Privilege Escalation Exploit | /linux/local/6337.sh
Linux Kernel < 2.6.29 - exit_notify() Local Privilege Escalation Exploit | /linux/local/8369.sh
Linux Kernel 2.6 - UDEV Local Privilege Escalation Exploit | /linux/local/8478.sh
Linux Kernel 2.6 UDEV < 141 - Local Privilege Escalation Exploit | /linux/local/8572.c
Linux Kernel 2.6.x - ptrace_attach Local Privilege Escalation Exploit | /linux/local/8673.c
Linux Kernel <= 2.6.34-rc3 ReiserFS xattr - Privilege Escalation | /linux/local/12130.py
Linux Kernel < 2.6.36-rc1 CAN BCM - Privilege Escalation Exploit | /linux/local/14814.c
Linux Kernel < 2.6.36-rc4-git2 - x86_64 ia32syscall Emulation Privilege Escalation | /linux/local/15023.c
Linux Kernel <= 2.6.36-rc8 - RDS Protocol Local Privilege Escalation | /linux/local/15285.c
Linux Kernel <= 2.6.37 - Local Privilege Escalation | /linux/local/15704.c
Linux Kernel < 2.6.37-rc2 - ACPI custom_method Privilege Escalation | /linux/local/15774.c
Linux Kernel 2.6.34 - CAP_SYS_ADMIN x86 - Local Privilege Escalation Exploit | /linux/local/15916.c
Linux Kernel < 2.6.34 - CAP_SYS_ADMIN x86 & x64 - Local Privilege Escalation Exploit (2) | /linux/local/15944.c
Linux Kernel < 2.6.36.2 - Econet Privilege Escalation Exploit | /linux/local/17787.c
Linux Kernel 2.6.17 - Sys_Tee Local Privilege Escalation Vulnerability | /linux/local/29714.txt
Linux Kernel 2.6.x - Ptrace Local Privilege Escalation Vulnerability | /linux/local/30604.c
Linux Kernel 2.6.x - 'pipe.c' Local Privilege Escalation Vulnerability (1) | /linux/local/33321.c
Linux Kernel 2.6.x - pipe.c Local Privilege Escalation Vulnerability (2) | /linux/local/33322.c
Linux Kernel 2.6.x - Ext4 - 'move extents' ioctl Local Privilege Escalation Vulnerability | /linux/local/33395.txt
Linux Kernel 2.6.x - 'fasync_helper()' Local Privilege Escalation Vulnerability | /linux/local/33523.c
[*] Do you wish to download all the exploit script to current directory and compile if possible?
1) Yes
2) No
#? 1
[*] The base directory is /usr/share/exploitdb/platforms
[*] Do you wish to compile all the exploit script written in C?
1) Yes
2) No
#? 1
**************************************************
[*] Successfully Compiled 9 executable located in linux_2.6
[*] Do you want to make a tar ball of the linux_2.6? (For convinient file transfer)
1) Yes
2) No
#? 1
[*] Auto Privilege Exploit Summary
C file in /root/utilities/linux_2.6 has 16 files
Python file in /root/utilities/linux_2.6 has 1 files
Perl file in /root/utilities/linux_2.6 has 0 files
Ruby file in /root/utilities/linux_2.6 has 0 files
TXT file in /root/utilities/linux_2.6 has 2 files