LXD/LXC is Linux's native container technology, similar to Docker. Like Docker group membership, being in the lxd group is equivalent to root access - you can mount the host filesystem into a container you control.Related
Think of LXD like a more powerful version of Docker that's built into many Ubuntu systems. If you're in the lxd group, you can spin up a container, mount the entire host's root filesystem into it, and access everything as root. Game over.
lxd Group = Root
Just like Docker, the lxd group provides root-equivalent access. Any user in this group can trivially escalate to root by mounting the host filesystem. Always check "id" for lxd group membership.
Checking LXD Access
Ubuntu Default
LXD comes pre-installed on many Ubuntu systems. Users are sometimes added to the lxd group without understanding the security implications. Always check for this group!
Basic LXD Privilege Escalation
Exploitation Without Internet
If the target can't download images from the internet, you need to import a pre-built image. This is common in CTF environments.
Alternative: Pre-built Image
Import and Exploit
LXD Not Initialized
LXC (Without LXD)
Establishing Persistence
Docker vs LXD Comparison
Check Both Groups
Always check for membership in both docker AND lxd groups. They're both equally dangerous and provide the same escalation path.
LXD Exploitation Methodology
LXD Privilege Escalation Flow
1
Check Groupid | grep lxd
2
Check Imageslxc image list
3
Import ImageImport from internet or transfer
4
Create Containerlxc init with security.privileged=true
5
Add MountAdd disk device mapping / to /mnt/root
6
Access Hostlxc exec, access /mnt/root as root
Knowledge Check
Challenges
Key Takeaways
- lxd group membership = root equivalent access
- Create privileged container with security.privileged=true
- Mount host filesystem: disk source=/ path=/mnt/root
- For offline: build Alpine image and transfer
- Same concept as Docker group exploitation
- Always check for both docker and lxd group membership