Enumeration

Nmap

Initial Nmap scan revealed SSH, HTTP ports were open.

00 - nmap

Dirbuster

Applied directory brute forcing to Web application which revealed some endpoints.

01 - dirbuster

Then applied additional brute forcing to mantisbt directory which revealed config endpoint.

02 - config

Visiting the config endoint revealed a file named ‘a.txt’ which included database username and password.

03 - atxt

Exploitation

Adminer

I knew from the first directory brute force that adminer application was available. I logged in to the application using found DB credentials. Later, I ran an SQL query which revealed users.

04 - adminer

User Flag

Then using revealed credentials I got the user.

05 - user

Privilege Escalation

sudo -l

Sudoers file revealed that I could run shutdown as root user without password.

06 - shutdown

Linpeas

And linpeas revealed that ‘check-system’ file was writeable by me.

07 - check-system

Analyzing check-system

Moreover, checking with the ‘ps -ef’ command shows that ‘check-system’ command’s Parrent PID (PPID) is 1 and its start time is equals to the machine boot time. This means, the check-system process run right after the boot.

10

Or we can run ‘systemctl status check-system.service’, and if the service is valid we know that it is a system daemon.

11

Root

Then I simply updated check-system file to give SUID privileges to /bin/bash as root. Then rebooted using shutdown command.

08 - reboot

Then I exploited the SUID bit and got the root flag.

09 - root


<
Previous Post
TombWatcher - Hack The Box
>
Next Post
Seppuku - Proving Grounds Play