TryHackMe - Linux Privilege Escalation: Kernel Exploits
This article discusses the solution for TryHackMe's Linux Privilege Escalation Kernel Exploits tasks so proceed with caution.
I would suggest that you try to solve it on your own as you will learn a lot in the process of attempting. Try to give it your all until you feel that you are really hopelessly stuck.
Privilege Escalation Kernel Exploits Solution
Notes
Kernel manages communication between components.
Kernel exploit usually leads to root privileges
Steps:
kernel version
search if kernel version has an exploit
Be careful as exploit may lead to irreversible damage. Check the scope of the project.
What is the content of the flag1.txt file?
Identify kernel version by executing the following command:
uname -r
We have determined that the kernel version is
3.13.0-24-generic
. Now let's search the net for exploit we can use. We have found an exploit in Exploit DBLet's find folders which our current user has permission to write to:
find / -writable -type d 2>/dev/null
or
find / -perm -222 -type d 2>/dev/null
or
find / -perm -o w -type d 2>/dev/null
- Let's
cd /tmp
as our current user has permission to write in that folder.
Let' create a exploit file
nano exploit.c
and paste the code we found in Exploit DB.Run the following commands to spawn a root terminal:
gcc exploit.c -o exploit
./exploit
- Now to get the
flag1.txt
file.
cat /home/matt/flag1.txt
Answer: THM-28392872729920
Until next time. Keep learning.
Stay stoked and code. :)
I hope you can voluntarily Buy Me A Coffee if you found this article useful and give additional support for me to continue sharing more content for the community. :)
Thank you very much. :)
Subscribe to my newsletter
Read articles from Niccolo Lampa directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Niccolo Lampa
Niccolo Lampa
Full stack developer who loves to code, hack and surf.