You can find the machine there > KB-VULN
Summary
This machine is an easy one, from source code enumeration we can detect a username and ssh brute force with it. After gaining a low-privilege shell we can exploit motd daemon and change root password. Let’s pwn it!
Enumeration/Reconnaissance
Let’s start as always with nmap.
1 |
|
Let’s start the enumeration on port 21 since we have to anonymous allowed, we can see a .bash_history
file let’s download it.
1 |
|
At the time is useless, maybe we can use it later.
1 |
|
Shell as sysadmin
Let’s move on, port 80 source code gives us a username probably system one because i can’t find a way to use it on web.
1 |
|
Let’s try to ssh brute force with it, using rockyou.txt. & here we go!
1 |
|
1 |
|
Shell as root
Before we found something interesting from FTP, the /etc/update-motd.d/
& 00-header
. MOTD(Message Of The Day daemon) is the welcome message that show to a user upon the terminal login. Modifying the /etc/motd
file you can change the welcome message. But for better configuration you can use the scripts located in the /etc/update-motd.d
directory.
So we can add a command that change root password and the next time we login, the MOTD will execute it. (MOTD is running as root)
1 |
|
Now we can simply login and root password will change.
1 |
|
Let’s read the flags.
1 |
|
For the readers
I think this box has a second privilege escalation way, based on LXD group. You can try it yourself.
Fun box, i enjoyed this privilege escalation a lot.