cronjob privileged escalation dpwwn: 1 Vulnhub Walkthrough 1
Today we are going to take another CTF challenge down. The credit for making this VM machine goes to “Debashish Pal” and it is a boot2root challenge where we have to root the machine and capture the flag to complete the challenge. You can download this VM here.
Security Level: Beginner
Let’s start of by scanning the network and identifying the host IP address. We can see our host IP is 192.168.1.101 by using Netdiscover.
Then, as usual, we used our favourite tool Nmap for port enumeration. We found that port 22, 80 and 3306 are open.
Once we logged in, we got the database names, there we saw a database of ssh, we checked for its tables and found one user credentials mistic:testP@$$swordmistic
And in the crontab, the same file is scheduled for execution with root privileges.
So what we did is we created a reverse netcat payload using msfvenom with listener ip as our kali and listener port 1234.
Then we copied the same payload inside the logrot.sh binary using the echo command.
Security Level: Beginner
Penetrating Methodology:
- Scanning
- Netdiscover
- Nmap
- Enumeration
- Mysql
- Exploitation
- SSH
- Msfvenom
- Netcat
- Privilege Escalation
- Writable Script running on crontab
Walkthrough:
Scanning:Let’s start of by scanning the network and identifying the host IP address. We can see our host IP is 192.168.1.101 by using Netdiscover.
Then, as usual, we used our favourite tool Nmap for port enumeration. We found that port 22, 80 and 3306 are open.
Enumeration:
As we can see mysql service is running (3306) we tried our luck to access the mysql server with root user and blank password and to our surprise, we were able to login.Once we logged in, we got the database names, there we saw a database of ssh, we checked for its tables and found one user credentials mistic:testP@$$swordmistic
Exploitation:
We were able to ssh the target system using the above-found credentials. After logging in we found a file named logrot.sh. We looked inside the file and this is bash script which collects the logs.And in the crontab, the same file is scheduled for execution with root privileges.
So what we did is we created a reverse netcat payload using msfvenom with listener ip as our kali and listener port 1234.
Then we copied the same payload inside the logrot.sh binary using the echo command.