Linux Privilege Escalation via LXD & Hijacked UNIX Socket Credentials
A low-privileged user in the lxd group can abuse LXD's proxy device to relay UNIX socket connections with root credentials, allowing them to speak directly to systemd's private socket and execute commands as root. This enables full privilege escalation from a standard user account to root on the host.
shenaniganslabs.io
Published on shenaniganslabs.io
Linux systems running LXD are vulnerable to privilege escalation via multiple attack paths, two of which are published in my “lxdroot” GitHub repository. This blog will go into the details of what I think is a very interesting path - abusing relayed UNIX socket credentials to speak directly to systemd’s private…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
LXD's proxy device passes the credentials of the LXD service (root) rather than those of the calling user when connecting to a host socket, and systemd trusts those credentials.
Impact
A user in the lxd group can escalate to root on the host, for example by adding a sudoers entry via systemd, leading to full system compromise.
What the attacker needed
User in lxd group; LXD installed and running; ability to create containers
The fix
The LXD documentation was updated to warn that the lxd group grants root-equivalent access, but the underlying design flaw (passing root credentials) was not fixed in the text; the author suggests removing the lxd group or making LXD match permissions.
How it was found
- Create a low-privilege user and add them to the lxd group.
- As that user, run lxd init to configure LXD (no sudo needed).
- Launch a container (e.g., lxc launch ubuntu:18.04 falcor).
- Use lxc config device add to create a proxy device that connects a host socket to a socket inside the container.
- Use a second proxy device to tunnel the container socket back to the host.
- Connect to the host-side socket and send crafted messages to systemd's private socket, which are accepted as root.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
On Linux, some programs trust the identity of whoever is connecting to a special local socket (a way for programs on the same machine to talk). The LXD container manager lets members of a certain group create a kind of tunnel that forwards connections to a socket, but it does so with the identity of the root user instead of the actual user. This means a normal user can pretend to be root when talking to a powerful system service, and from there run commands as root.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.