Lxd
Theory
A member of the local lxd
group can instantly escalate the privileges to root on the host operating system. This is irrespective of whether that user has been granted sudo rights and does not require them to enter their password. The vulnerability exists even with the LXD
snap package.
LXD is a root process that carries out actions for anyone with write access to the LXD
UNIX socket. It often does not attempt to match the privileges of the calling user. There are multiple methods to exploit this.
Practice
We can build an Alpine image using lxd-alpine-builder and start it using the flag security.privileged=true
, forcing the container to interact as root with the host filesystem.
On the host, build an image as follow
Then, we can upload to the vulnerable server the tar.gz file
On the vulnerable server, import the new image
Now we can create the container
Execute the container
References
Last updated