We use cookies to ensure you get the best user experience. For more information see our cookie policy.
Linux PrivEsc Arena
Students will learn how to escalate privileges using a very vulnerable Linux VM. SSH is open. Your credentials are TCM:Hacker123
Task 1: [Optional] Connecting to the TryHackMe network
You can either use the browser-based terminal (which appears when you deploy the machine), or you can connect to TryHackMe's network (via OpenVPN) and SSH in directly. If you've not done this before, first complete the OpenVPN room and learn how to connect.
10. In command prompt type: /usr/local/bin/suid-so
11. In command prompt type: id
Answer the questions below
Click 'Completed' once you have successfully elevated the machine
Task 12: Privilege Escalation - SUID (Symlinks)
Detection
Linux VM
1. In command prompt type: dpkg -l | grep nginx
2. From the output, notice that the installed nginx version is below 1.6.2-5+deb8u3.
Exploitation
Linux VM – Terminal 1
1. For this exploit, it is required that the user be www-data. To simulate this escalate to root by typing: su root
2. The root password is password123
3. Once escalated to root, in command prompt type: su -l www-data
4. In command prompt type: /home/user/tools/nginx/nginxed-root.sh /var/log/nginx/error.log
5. At this stage, the system waits for logrotate to execute. In order to speed up the process, this will be simulated by connecting to the Linux VM via a different terminal.
Linux VM – Terminal 2
1. Once logged in, type: su root
2. The root password is password123
3. As root, type the following: invoke-rc.d nginx rotate >/dev/null 2>&1
4. Switch back to the previous terminal.
Linux VM – Terminal 1
1. From the output, notice that the exploit continued its execution.
2. In command prompt type: id
Answer the questions below
What CVE is being exploited in this task?
What binary is SUID enabled and assists in the attack?
Students will learn how to escalate privileges using a very vulnerable Linux VM. SSH is open. Your credentials are TCM:Hacker123
medium
75 min
35,700
To access material, start machines and answer questions login.
You can either use the browser-based terminal (which appears when you deploy the machine), or you can connect to TryHackMe's network (via OpenVPN) and in directly. If you've not done this before, first complete the OpenVPN room and learn how to connect.
Answer the questions below
Read the above.
Set up your virtual environment
To successfully complete this room, you'll need to set up your virtual environment. This involves starting both your AttackBox (if you're not using your VPN) and Lab Machines, ensuring you're equipped with the necessary tools and access to tackle the challenges ahead.
Attacker machine
Status:Off
Lab machine
Status:Off
This room will teach you a variety of privilege escalation tactics, including kernel exploits, sudo attacks, SUID attacks, scheduled task attacks, and more. This lab was built utilizing Sagi Shahar's privesc workshop (https://github.com/sagishahar/lpeworkshop) and utilized as part of The Cyber Mentor's Linux Privilege Escalation Udemy course (://udemy.com/course/linux-privilege-escalation-for-beginners).
All tools needed to complete this course are in the user folder (/home/user/tools).
Let's first connect to the machine. is open on port 22. Your credentials are:
username: TCM password: Hacker123
Answer the questions below
Deploy the machine and log into the user account via SSH (or use the browser-based terminal).
10. In command prompt type: /usr/local/bin/suid-so
11. In command prompt type: id
Answer the questions below
Click 'Completed' once you have successfully elevated the machine
Detection
1. In command prompt type: dpkg -l | grep nginx
2. From the output, notice that the installed nginx version is below 1.6.2-5+deb8u3.
Exploitation
Linux VM – Terminal 1
1. For this exploit, it is required that the user be www-data. To simulate this escalate to root by typing: su root
2. The root password is password123
3. Once escalated to root, in command prompt type: su -l www-data
4. In command prompt type: /home/user/tools/nginx/nginxed-root.sh /var/log/nginx/error.log
5. At this stage, the system waits for logrotate to execute. In order to speed up the process, this will be simulated by connecting to the Linux VM via a different terminal.
Linux VM – Terminal 2
1. Once logged in, type: su root
2. The root password is password123
3. As root, type the following: invoke-rc.d nginx rotate >/dev/null 2>&1
4. Switch back to the previous terminal.
Linux VM – Terminal 1
1. From the output, notice that the exploit continued its execution.
2. In command prompt type: id
Answer the questions below
What CVE is being exploited in this task?
What binary is SUID enabled and assists in the attack?
Detection
1. In command prompt type: find / -type f -perm -04000 -ls 2>/dev/null
2. From the output, make note of all the SUID binaries.
3. In command prompt type: strings /usr/local/bin/suid-env
4. From the output, notice the functions used by the binary.