Common Linux Privesc

Room Link: https://tryhackme.com/room/commonlinuxprivescarrow-up-right

Enumeration

Download LinEnum Script

Kali

wget https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh

Login to host

Kali

ssh user3@$VICTIM
Password: password

The target's hostname

There are 8 users

4 shells

Some users can write to passwd file

Abusing SUID/GUID Files

Victim

Running the shell script in user3 home directory gives us root access right away.

Victim

Exploiting Writeable /etc/passwd

Victim

Victim

Escaping Vi Editor

Victim

Victim

Victim

Exploiting Crontab

Victim

Kali

Kali

Victim

Add our payload we made in Kali to the script

Victim

Wait for the script to run and catch the shell on Kali.

Exploiting PATH Variable

Victim

The script in user5 home directory is just doing the command ls.

Victim

We now create a script called ls that gives us a bash shell.

Victim

Before we change the path we can see ls goes to /bin/ls

Now after running the below command ls is now directed to our script.

Victim

Now the script in user5s directory acts differently, we now have a root shell.

Victim

Run the following to reset the path variable.

Victim

Last updated