
Linux 커널의 잠재적 익스플로잇을 exploitdb에서 다운로드하고 자동으로 컴파일하는 자동화 스크립트
리눅스 커널의 잠재적 취약점을 ExploitDB에서 다운로드하고 자동으로 컴파일하는 자동화 스크립트입니다.
이 스크립트는 Hackademics 때문에 만들어졌습니다. 해당 커널 버전에 대해 너무 많은 가능한 익스플로잇이 존재하고, OSCP 초보자로서 올바른 익스플로잇을 찾을 수 없었으며, 하나하나 테스트하기에도 너무 게을렀습니다. 그래서 이 스크립트가 미래에 도움이 되길 바랍니다.
먼저, searchsploit을 이용해 로컬 디렉토리의 exploitdb에서 리눅스 권한 상승 익스플로잇을 검색합니다.
첫 번째 파라미터로 커널 버전을 입력하면 잠재적 익스플로잇을 나열하고, 로컬 디렉토리에서 복사할 것인지 묻습니다.
그 후, 다운로드한 C 파일을 컴파일할 것인지 묻습니다.
그런 다음, 디렉토리를 tar 볼로 만들 것인지 묻습니다.
그리고 다운로드한 파일의 요약을 보여줍니다.
스크립트 환경: Kali 3.18.0 kali2
Kali 4.0에서의 테스트 결과는 이 스크립트에 부정적이었습니다. 아키텍처를 재설계해야 하며, 파이썬이 이 자동화에 더 적합할 수 있습니다. 다시 생각해봐야 합니다.
16 Mar 25 이 아이디어의 파이썬 버전으로 업데이트되었습니다. 다양한 Kali 환경에 더 적응하기 쉬우며, 이 방식으로 코드를 변경하기도 더 쉽습니다.
16 Apr 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