spencerdodd / kernelpop

kernel privilege escalation enumeration and exploitation framework
687 stars 130 forks source link

Function process_kernel_version unable to handle Linux kali 4.13.0-kali1-amd64 (Kali Linux) #1

Closed webpwnized closed 7 years ago

webpwnized commented 7 years ago

I think the issue is here:

File "/opt/kernelpop/src/kernelpop.py", line 163, in process_kernel_version k_release = int(kernel_version.split("-")[2])

Please note that for the string "4.13.0-kali1-amd64", the kernel_version.split("-")[2] is "kali1" which cannot be cast to an int.

Please see commands ran below:

root@kali:/opt# git clone https://github.com/spencerdodd/kernelpop.git Cloning into 'kernelpop'... remote: Counting objects: 468, done. remote: Compressing objects: 100% (164/164), done. remote: Total 468 (delta 305), reused 465 (delta 302), pack-reused 0 Receiving objects: 100% (468/468), 5.62 MiB | 2.51 MiB/s, done. Resolving deltas: 100% (305/305), done.

root@kali:/opt# cd kernelpop/

root@kali:/opt/kernelpop# ls constants.py exploits img kernelpop.py playground README.md src test

root@kali:/opt/kernelpop# python3 kernelpop.py

##########################

welcome to kernelpop

let's pop some kernels

##########################

[+] underlying os identified as a linux variant Traceback (most recent call last): File "kernelpop.py", line 17, in main() File "kernelpop.py", line 7, in main kernelpop() File "/opt/kernelpop/src/kernelpop.py", line 362, in kernelpop kernel_v = get_kernel_version() File "/opt/kernelpop/src/kernelpop.py", line 207, in get_kernel_version return Kernel(kernel_version["normal"]) File "/opt/kernelpop/src/kernelpop.py", line 15, in init self.release, self.architecture, self.uname = self.process_kernel_version(kernel_version, uname=uname) File "/opt/kernelpop/src/kernelpop.py", line 163, in process_kernel_version k_release = int(kernel_version.split("-")[2]) ValueError: invalid literal for int() with base 10: 'kali1' root@kali:/opt/kernelpop# uname -a Linux kali 4.13.0-kali1-amd64 #1 SMP Debian 4.13.4-2kali1 (2017-10-16) x86_64 GNU/Linux

root@kali:/opt/kernelpop#

spencerdodd commented 7 years ago

The release version being parsed was incorrect. That should be fixed in commit https://github.com/spencerdodd/kernelpop/commit/e0480353bbd922be02e00bd1fdd8a24c1b3bc130

That fixed the issue for me on kali 4.9, but should apply to all Kali distributions. Thanks for the feedback!