- Find ftp and ssh service are open through nmap
- get user creds from ftp and login via ssh
- and a very simple sudo priv esc
Base Setup
The first thing to do would be install docker which you can install from here and then pull an Ubuntu latest image from docker to work with.sudo
Setting up FTP server
Without setting the root directory for the ftp it’ll just show empty when you connect to it. We need to make aftpuser and also make a directory in /var for the ftp server and give it appropriate permissions.
vsftpd.conf file to allow anon login and also set the root directory.
/etc/vsftpd.conf
Setting up SSH
Setting the sudo Privesc
For privilege escalation I thought of letting the user runcat and ls meaning he can list and read the files in the root directory.
To do this we have to edit the sudoers file, run the below command as root
/etc/sudoers
/root directory and then we just have add appropriate permissions to the user and root flags and we are good to go
Sanity Check
Don’t forget to restart all the services before doing the sanity checkPushing to docker hub
After all this the one thing we need to do is make your docker container available to the whole world wide web. To do this we have to commit your docker container. Exit your container after making all the changes and testing it.Making docker-compose file
The docker-compose file for this image is very simple- We’ll be pulling the image from docker hub
- adding the additional capability to it
--cap-add=NET_ADMIN - run a command to restart the services
ufw,vsftpdandssh - add a tails command to keep the container from exiting in detached mode
docker-compose.yaml
.yaml file make sure to take the container down before running it again
