Friendly
Description
Friendly is a beginner machine created by RiJaba1

Friendly
Walk through
Enumeration
Port Enumeration
Basic PORT enumeration with NMAP
Note: in my case $TARGET is 192.168.1.81
The reported ports are
Now lets enumerate the services running on each port with
Port 21
We can se a anonymous profile enable Let's connect it with anonymous credentials anonymous as the user and a blank password
List the files with ls Just exist the index file on the current directory, I try to change the directory but nothing happens Download the index.html an take a look inside After read the file just look like a normal index default file
Exploitation
Lets try putting inside the TARGET machine a malicious file such a PHP Reverse Shell You can create your own Reverse Shell here
Select PHP PentestMonkey Put your ATTACKER IP in the IP field and your listener PORT I go to use 1234

Copy the code in some php file and open a ftp to TARGET using anonymous user again Using put command you can transfer files from ATTACKER to TARGET for more info about ftp commands visit this site

If you list the files again you can see your php file

Try to execute it from the web page Don't forget open your listener before

If everything goes good you should have a shell on your listener

User flag
Navigate to /home/RiJaba1/ and you can see the user flag there typing ls and then with cat the file

Post-Explotation
Privilege Escalation
Start with the basics Use sudo -l to list the executable sudo bins

Here we can see a sudo permissions to vim without password Vim have the ability of execute shell commands, if we execute vim with sudo and then execute commands from Vim, this commands will be execute with sudo permissions more info about it here
Let's exploit it
Open Vim with sudo typing
When you open your Vim you go to see something like this

Here type :! /bin/bash to get a shell

And Done, confirm your privileges with whoami

Root flag
Search the root flag in all directorys
And There are

CONGRATULATIONS
References
https://www.revshells.com/
https://phoenixnap.com/kb/linux-ftp
https://www.rockyourcode.com/til-how-to-execute-an-external-command-in-vim-and-reload-the-file/
Last updated