Group-Based Privilege Escalation on Linux
Group membership often grants indirect root access without any exploit. If you belong to certain privileged groups, you can read sensitive files, mount disks, escape containers, or hijack execution paths. Check groups immediately after getting a shell.
Prerequisites Check
List all groups for the current user:
uid=1001(user) gid=1001(user) groups=1001(user),24(cdrom),25(floppy),27(sudo),42(shadow),43(staff),6(disk),4(adm),999(docker)
High-risk groups to focus on: docker, lxd, lxc, disk, shadow, staff, adm, systemd-journal, video, render, sudo, wheel.
If you were recently added to a group but your session predates the change, use newgrp to activate it without re-login:
docker Group — Root via Socket
Members of the docker group can control the Docker daemon which runs as root. No container breakout needed — mount the host filesystem directly.
Confirm access:
If the socket exists and is accessible, mount the entire host filesystem and chroot into it:
You now have a root shell with full access to the host filesystem.
Alternative — nsenter (no image pull needed):
Alternative — if no image is available locally and no internet access:
root:$6$vL...:19000:0:99999:7:::
After getting root, establish persistence — see https://hackindex.io/platforms/linux/privilege-escalation/credential-hunting for finding SSH keys to maintain access.
lxd / lxc Group — Host Filesystem via Container
LXD group membership allows creating privileged containers that mount the host filesystem.
Prerequisite check — LXD must be initialized:
If LXD is not initialized, initialize it first (requires no root):
Build a minimal Alpine image on your attack box (required if no images exist):
Transfer the image to the target and import it:
Inside the container, /mnt/root is the full host filesystem:
shadow Group — Direct Hash Read
Members of the shadow group can read /etc/shadow directly without any exploit:
Crack the extracted hash — see https://hackindex.io/platforms/linux/privilege-escalation/passwd-shadow-manipulation for the full cracking workflow including yescrypt, SHA-512, and unshadow techniques.
disk Group — Raw Device Access
The disk group grants read/write access to block devices like /dev/sda. This allows reading the raw filesystem without mounting.
Find the root partition:
Option 1 — debugfs (fastest, no mounting needed):
Option 2 — dd to extract and mount:
Disk group also allows writing to raw devices — with sufficient knowledge you can modify filesystem data directly, though this is high-risk.
staff Group — PATH Hijacking
On Debian and Ubuntu, the staff group typically has write access to /usr/local/bin and /usr/local/sbin. These directories are in the default PATH and take precedence over /usr/bin.
Confirm write access:
Identify what commands root runs that exist in /usr/local/bin or that resolve there via PATH. Check cron jobs and running services:
Plant a malicious binary with the same name as one root calls:
Wait for root to execute it.
For the full PATH hijacking technique see https://hackindex.io/platforms/linux/privilege-escalation/writable-path-hijacking.
adm / systemd-journal Group — Log Access
These groups grant read access to system logs. Logs frequently contain credentials passed on the command line, service startup secrets, and API keys.
Services commonly log sensitive data: database connection strings, API keys in startup commands, passwords in failed authentication attempts (typos in the username field).
video / render Group — Screen Capture
Access to /dev/fb0 (framebuffer) allows dumping the current screen content, potentially capturing open terminals or entered passwords:
Useful when a privileged user is actively working in a graphical session and you need to capture credentials being entered.
sudo / wheel Group — Direct Escalation
Being in the sudo group on Ubuntu (or wheel on RHEL/CentOS) typically grants full sudo access:
If %sudo ALL=(ALL:ALL) ALL is present, run:
Supply your current user's password. For sudo misconfiguration exploitation see https://hackindex.io/platforms/linux/privilege-escalation/sudo-misconfiguration.
References
-
GTFOBins Dockergtfobins.github.io/gtfobins/docker (opens in new tab)
Container escape technique
-
Disk mounting behavior
-
journalctl documentationwww.freedesktop.org/software/systemd/man/journalctl.html (opens in new tab)
Log access and filtering
-
lxd-alpine-buildergithub.com/saghul/lxd-alpine-builder (opens in new tab)
Build minimal Alpine image for LXD container privilege escalation.
Was this helpful?
Your feedback helps improve this page.