SecurityZines.com Join

Linux privesc, the zine class

Learn how a low user on a Linux host becomes root, and how to stop it. Ada asks interview questions as you read.

An attacker who gets a shell on a Linux host usually gets a low user first. Privilege escalation turns that user into root. Pentest, red team, cloud and security engineering interviews ask about it often. This class teaches it from the basics to senior-level detail.

Each drawing plays when you scroll to it. Tap a drawing to go one step at a time. Your answers stay in this browser only.

1Meet the cast

These six characters are in all Zine Classes. In this class, some of them have new jobs.

ZeeYou, the learner.
MalloryThe attacker. She has a low user shell.
AliceThe admin. She configures the host.
BrowsyA client program, for example the docker command.
ServoThe Linux host and its kernel.
AdaThe interviewer. She asks the questions.

2What is privilege escalation?

In plain wordsA hotel guest has a key to one room. The cleaner has a master key. The cleaner leaves the master key on a trolley in the hall. The guest did not break a lock. The guest found a key that the hotel left in the open.

Privilege escalation (privesc) occurs when a user gets more rights than the system gave them. On Linux, the target is usually root. Root can read every file, change every setting and delete the logs. Privesc on Linux often does not need a new bug. It uses a mistake in the configuration.

A bug in the upload page gave me a shell.
Mallory checks: sudo rules, SUID files, cron jobs, kernel version
+ 1 line in backup.sh: start my program
a Linux host
$ iduid=33(www-data)/etc/shadow: Permission denied
Every minute, root runs /opt/backup.sh.
-rwxrwxrwx root backup.sh
all users can write it
uid=0 (root)
Root? From a backup script?
  1. Mallory finds a bug in a web app on Servo. She gets a shell.
  2. The shell runs as the user www-data. This user cannot read /etc/shadow.
  3. Mallory looks for things that run as root and that she can change.
  4. She finds a cron job. Root runs /opt/backup.sh every minute. All users can write the file.
  5. Mallory adds one line to the script. The line starts her program.
  6. Cron runs the script as root. Mallory's program now runs as root.
  7. Alice made one file permission mistake. Because of it, a low user became root.

There are two directions. Vertical privesc goes up, for example from www-data to root. Horizontal privesc goes sideways, for example from www-data to the user alice. Attackers often go sideways first, then up.

In the scene, what gave Mallory root?

  1. A bug in the Linux kernel
  2. A script that root runs and that all users can write
  3. She guessed the root password
  4. The upload bug in the web app

The web bug gave a low user. The writable root script gave root. This is the most common pattern: a program runs as root and reads something that a low user controls.

3Why root is a number

The kernel does not know people. It knows user IDs (UIDs). Each process has an effective UID. The kernel checks this number when the process opens a file or changes a setting. Root is UID 0. For UID 0, the kernel skips most permission checks.

Some normal programs must run as root. For example, passwd must write /etc/shadow. So passwd has the SUID bit. When any user starts it, it runs with the UID of the file owner, root.

kernel: check the euid
Mallory's shell
euid=33
Open /etc/shadow? Denied.
passwd (SUID root)
started by Mallory, euid=0
Same person, new number. I check the number.
So: a root program that obeys user input gives root to the user.
  1. Servo's kernel checks one thing: the effective UID of the process.
  2. Mallory's shell has the effective UID 33.
  3. UID 33 cannot read /etc/shadow. The kernel says no.
  4. Mallory starts passwd. It has the SUID bit, so it runs with the effective UID 0.
  5. The real UID is still 33. For permission checks, the kernel uses the effective UID, which is 0.
  6. passwd is safe because it does only one job. A root program that runs user commands gives root to the user.

"Why is a SUID binary dangerous? passwd has SUID too."

A SUID binary runs with the UID of its owner, not the UID of the user who starts it. If root owns it, it runs as root. passwd is safe because it does one small job and checks its input. A SUID program that can start a shell, read any file or load a library gives those root powers to the user. Each SUID root file is attack surface.

4The paths to root

Most paths are in one of four groups. Learn the groups. Then you can check a host in a fixed order.

Misconfiguration

The admin gives too much power by mistake. Examples are a sudo rule for an editor and a SUID bit on a file that does not need it. A capability on an interpreter and a root script that all users can write are also examples. This is the most common group.

Credentials

The user finds a password or a key. Examples are a database password in a config file, a password in shell history, and an SSH private key that all users can read. People often use the same password for root.

Dangerous groups and services

Some groups give root-level access. The Docker documentation says: "The docker group grants root-level privileges to the user." A service that runs as root and takes requests from users is a similar risk.

The logs are root-only. I give www-data a sudo rule.
www-data ALL=(root) NOPASSWD: /usr/bin/less /var/log/app.log
less runs as root. Can less start other programs?
I open app.log as root.
less has a command that starts a shell. The shell is root.
root shell
fix: a log group, not sudo
  1. Alice wants the app user to read one log file. Only root can read it.
  2. Alice writes a sudo rule. www-data can run less on the log as root, with no password.
  3. Mallory has the www-data shell. She reads the rule with sudo -l.
  4. Mallory runs the allowed command. Servo starts less as root.
  5. less is a pager. Like many pagers and editors, it can start a shell. The shell gets the UID of less.
  6. Mallory has a root shell. Sudo did what the rule said.
  7. Fix: give read access to the log with a group. Do not give sudo rules for programs that can start other programs.

Kernel and system bugs

A bug in the kernel or in a root program gives root to any local user. Examples are Dirty COW, Dirty Pipe and PwnKit. Patches fix these. Kernel exploits can crash the host, so testers use them last.

Two more termsGTFOBins is a public list of normal Unix programs and how they bypass local restrictions. It has sections for sudo, SUID and capabilities. Living off the land means the attacker uses programs that are already on the host. No new tool means fewer alerts.

Classify each path to root.

  • A sudo rule lets the user run vim as root.
  • The root password is in ~/.bash_history.
  • The host runs an old kernel with Dirty Pipe.
  • python3 has the capability cap_setuid.
  • A world-readable .env file has the database admin password.
  • pkexec is not patched for PwnKit.

Ask three questions. Did the admin give too much power? Then it is a misconfiguration. Did you find a secret? Then it is credentials. Does a patch fix it? Then it is a bug.

5Where root hides

Each tab shows one place to check. You see the audit command, what a bad result looks like, why it is bad and the fix. Run these checks only on systems that you have permission to test.

So I look for a root program that reads something I can change?
Yes. Root runs it, you control it. Every tab below is that one idea.

Checksudo -l

User www-data may run the following commands:
    (root) NOPASSWD: /usr/bin/vim /etc/app.conf

WhyVim can run shell commands. The shell runs as root. The file name in the rule does not limit what vim can do.

FixUse sudoedit /etc/app.conf. Allow only exact commands that cannot start other programs.

Checkfind / -perm -4000 -type f 2>/dev/null

-rwsr-xr-x 1 root root /usr/bin/passwd
-rwsr-xr-x 1 root root /usr/local/bin/backup-tool

WhyThe s means SUID. A custom SUID tool often runs other commands or reads any file.

FixRemove the bit with chmod u-s. Compare the list with a known-good baseline.

Checkgetcap -r / 2>/dev/null

/usr/bin/ping cap_net_raw=ep
/usr/bin/python3.11 cap_setuid=ep

Whycap_setuid lets the program change its UID to 0. An interpreter runs any code, so any user gets root.

FixRemove it with setcap -r. Give the narrowest capability to the smallest program.

Checkcat /etc/crontab; ls -l /etc/cron.d; systemctl list-timers

* * * * * root /opt/backup.sh
-rwxrwxrwx 1 root root /opt/backup.sh

WhyRoot runs the script. Any user can change the script.

FixMake the script and its directory owned by root, mode 755 or stricter.

CheckRead each root script. Look for commands without a full path.

PATH=/home/dev/bin:/usr/bin:/bin
tar czf /backup/www.tgz /var/www

WhyRoot runs the first tar that it finds in PATH. The user dev can put a program named tar in /home/dev/bin.

FixUse full paths such as /usr/bin/tar. Set a fixed root PATH with only root-owned directories.

Checkls -l /etc/passwd /etc/shadow /etc/sudoers

-rw-rw-rw- 1 root root /etc/passwd
-rw-r----- 1 root shadow /etc/shadow

WhyA user who can write /etc/passwd can add an account with UID 0.

FixSet /etc/passwd to 644. Set /etc/shadow to 640 or stricter. Alert on changes to these files.

Checkid

uid=1001(dev) gid=1001(dev) groups=1001(dev),999(docker)

WhyThe Docker daemon runs as root. A member of the docker group can ask it to mount the host disk. The lxd and disk groups have similar risks.

FixTreat these groups as root. Use rootless Docker or Podman for users who are not admins.

Checkcat /etc/exports

/srv/share *(rw,no_root_squash)

WhyRoot on a client stays root on the share. That client can put a SUID root file on the share. A user on the server then runs it.

FixKeep root_squash. It is the default. Mount shares with nosuid.

getcap shows /usr/bin/ping cap_net_raw=ep. Is this a privesc path?

  1. Yes. Every capability gives root.
  2. Yes, because ping can change its UID
  3. Usually no. It only allows raw network sockets, and ping does not run user code.
  4. No, because the kernel ignores file capabilities

Some distributions give ping this capability so it does not need SUID. The risk is the capability and the program together. cap_setuid, cap_dac_override or cap_sys_admin on an interpreter or a shell is dangerous.

A root cron job runs /opt/clean.sh. The script is root-owned, mode 755. The directory /opt has mode 777. Is the job safe?

  1. No. A user can rename or delete the script and put a new clean.sh in its place.
  2. Yes. Only root can write the file.
  3. Yes. Cron refuses scripts in writable directories.
  4. Only after a reboot

Write permission on a directory lets a user add, delete and rename the files in it. Check the file and every directory above it. The sticky bit, as on /tmp, stops users from renaming the files of other users. Do not keep root scripts in such a directory.

6Root runs it, you control it

Each path has two parts. Something runs with root power. Something that the user controls goes into it. Remove one of the two parts and the path is closed.

Root runs it
  • SUID root files
  • sudo rules
  • root cron jobs and systemd timers
  • root services and daemons
  • file capabilities
  • the kernel
The user controls
  • arguments and options
  • environment: PATH, LD_PRELOAD
  • files and directories it reads
  • file names (wildcards)
  • requests to a socket
  • system calls
Safe swaps
  • sudoedit, not an editor
  • exact commands with full paths
  • env_reset, secure_path
  • root-owned scripts and directories
  • a group, not SUID
  • patches and nosuid mounts

Tap the two lines in this sudoers file that let a limited user become root.

Defaults env_reset
Defaults secure_path="/usr/sbin:/usr/bin:/sbin:/bin"
Defaults env_keep += "LD_PRELOAD"
root ALL=(ALL:ALL) ALL
%sudo ALL=(ALL:ALL) ALL
deploy ALL=(root) NOPASSWD: /usr/bin/systemctl restart app.service
backup ALL=(root) NOPASSWD: /usr/bin/vim /etc/backup.conf
monitor ALL=(root) NOPASSWD: /usr/bin/df -h

Line 3 keeps LD_PRELOAD. The user can then load a library into every command that sudo runs as root. Line 7 gives root vim, which can run shell commands. Lines 4 and 5 give full sudo to root and to the admin group, as intended. Lines 6 and 8 run one exact command.

7Testing for privesc

RuleTest only systems that you have permission to test. Use your own test accounts. Do not touch real user data. Get approval before you run a kernel exploit, because it can crash the host.

You have a low shell on a host in scope. Put the test steps in the correct order.

  1. Record who you are: user, groups, host name, kernel and distribution
  2. List what runs as root: sudo rules, SUID files, capabilities, cron jobs, services
  3. Find which of those root items read something that you control
  4. Prove one path with a harmless action, for example a root-owned marker file
  5. Remove your marker, then report the path and the fix

Collect facts before you act. Also look for secrets in config files, history files and keys. Misconfigurations and secrets are safe to check. Kernel exploits come last. Tools such as LinPEAS do the listing for you, but you must read the result and understand it.

An audit checklist

# who am I?
id; hostname; uname -r; cat /etc/os-release
# what can I run as root?
sudo -l
# SUID files and capabilities
find / -perm -4000 -type f 2>/dev/null
getcap -r / 2>/dev/null
# scheduled jobs
cat /etc/crontab; ls -l /etc/cron.*; systemctl list-timers
# files that all users can write, outside /proc
find / -writable -type f -not -path '/proc/*' 2>/dev/null
# processes that run as root
ps -eo user,pid,cmd | grep '^root'

Read every result. A long list is normal. Look for the custom item: a script in /opt, a tool in /usr/local/bin, a rule that a person wrote by hand.

Groups that equal root

I am in the docker group. I am not root.
docker CLI
Start a container. Mount host / at /host.
dockerd runs as root
host disk //etc/shadow/etc/sudoers/root
Root in the container can change these host files.
docker group = root
  1. Mallory has a user in the docker group. The user is not root.
  2. Mallory uses the docker command. It sends requests to the Docker daemon socket.
  3. She asks for a container that mounts the host root directory. The daemon runs as root, so it agrees.
  4. The container now sees the whole host disk.
  5. Root inside the container can change /etc/shadow or /etc/sudoers on the host.
  6. The Docker documentation says the docker group grants root-level privileges. Treat it as root.

The host runs a kernel that has a public exploit. The host is in production. What do you do?

  1. Run the public exploit immediately to prove root
  2. Report the version and the advisory. Run the exploit only with approval, ideally on a copy of the host.
  3. Ignore it, because kernel bugs are rare
  4. Reboot the host to clear the bug

Kernel exploits can cause a kernel panic and data loss. The version and the vendor advisory are often enough proof. If the client wants a full proof, test on a clone or in a maintenance window.

Real attacks

  • Dirty COW, 2016: CVE-2016-5195. A race in the kernel's copy-on-write code let a local user write to read-only memory mappings. Kernels since 2.6.22 were affected. CERT/CC reported active exploitation. CERT/CC
  • Baron Samedit, 2021: CVE-2021-3156. A heap overflow in sudo gave root to any local user, with no sudoers entry. The bug was in sudo for about 10 years. Qualys
  • PwnKit, 2022: CVE-2021-4034. The SUID program pkexec had a memory bug since its first version in May 2009. Any local user got root on default Ubuntu, Debian, Fedora and CentOS. Qualys
  • Dirty Pipe, 2022: CVE-2022-0847. Kernels from 5.8 let a user overwrite data in read-only files through the page cache. Max Kellermann found it when he looked at corrupt log files. Max Kellermann
  • Looney Tunables, 2023: CVE-2023-4911. A buffer overflow in the glibc loader, through the GLIBC_TUNABLES variable. Default Fedora, Ubuntu and Debian were affected. Qualys
  • GameOver(lay), 2023: CVE-2023-2640 and CVE-2023-32629. Ubuntu's OverlayFS changes copied file capabilities in an unsafe way. Wiz said 40% of Ubuntu cloud workloads were affected. Wiz
  • nf_tables, 2024: CVE-2024-1086. A use-after-free in the kernel firewall code. CISA added it to its Known Exploited Vulnerabilities catalog in May 2024. In 2025, CISA marked it as used in ransomware campaigns. CISA, TechRadar
  • sudo chroot, 2025: CVE-2025-32463. Sudo 1.9.14 to 1.9.17 loaded a library from a directory that the user chose with --chroot. CISA added it to the KEV catalog in September 2025. sudo.ws, CISA

"You got root on a test host. How do you prove it without damage?"

Use a harmless action on a system that I have permission to test. For example, run id as root and create a marker file owned by root in /tmp. Do not read real user data or change passwords. Record the exact path, the preconditions and the commands. Then remove the marker and give the fix.

8Defences in layers

One setting cannot stop privesc. Use layers. Each layer closes paths that the layer before it did not close.

a www-data shell
1 · Patch
Updates close known kernel, sudo and glibc bugs.
2 · Least privilege
Exact sudo commands. No editors or shells.
3 · Remove
Remove the SUID bits and capabilities that you do not need.
4 · Lock files
Root scripts: root-owned, not writable.
5 · Detect
auditd and EDR alert on new SUID files and odd sudo use.
  1. Mallory has a low shell. Five layers protect the host.
  2. Patch. Kernel and system bugs give root to every user. Updates close them. Reboot or use live patching for the kernel.
  3. Least privilege. Give each user and service only the access that it needs.
  4. Remove. Each SUID file, capability and admin group member is attack surface.
  5. Lock files. A root job is only as safe as every file and directory that it reads.
  6. Detect. Alerts do not stop privesc. They tell Alice fast, so she can respond.

Common mistakes by admins

  • sudo: rules with ALL, editors, pagers, interpreters, or wildcards in arguments
  • Docker: users in the docker group, and containers with --privileged or a mounted docker.sock
  • Scripts: root jobs that call commands without full paths, or use * in a directory that users can write
  • Secrets: passwords in config files, history files and backups that all users can read

Which items close privesc paths? Do not choose items that only hide information or stop network attacks.

  1. Remove the SUID bit from programs that do not need it
  2. Hide the kernel version from uname
  3. Replace an editor sudo rule with sudoedit
  4. Add a network firewall in front of the host
  5. Mount /tmp and shares with nosuid
  6. Rename /bin/bash

Each correct item removes a "root runs it" part: the SUID bit, the root editor or the SUID files on a mount. The nosuid option tells the kernel to ignore SUID and SGID bits and file capabilities on that mount. Hiding the version and renaming files do not close any path.

A safer configuration

# /etc/sudoers.d/app  (edit with visudo)
Defaults env_reset
Defaults secure_path="/usr/sbin:/usr/bin:/sbin:/bin"
Defaults use_pty
deploy ALL=(root) NOPASSWD: /usr/bin/systemctl restart app.service
backup ALL=(root) sudoedit /etc/backup.conf
# /etc/fstab
tmpfs /tmp tmpfs defaults,nosuid,nodev,noexec 0 0
# /etc/sysctl.d/99-harden.conf
kernel.unprivileged_bpf_disabled = 1
kernel.kptr_restrict = 2
kernel.dmesg_restrict = 1

env_reset gives each sudo command a new, minimal environment. secure_path sets a fixed PATH for sudo. kptr_restrict hides kernel addresses from normal users. dmesg_restrict hides the kernel log from normal users. Kernel exploits often use that information. unprivileged_bpf_disabled stops normal users from loading BPF programs.

Why is sudoedit /etc/app.conf safer than sudo vim /etc/app.conf?

  1. sudoedit does not allow vim
  2. sudoedit does not need a sudoers rule
  3. The editor runs as the normal user on a temporary copy. Only the copy back runs as root.
  4. sudoedit opens the file read-only

With sudoedit, a shell command from the editor runs as the normal user. Root only copies the saved file into place.

9Senior round

Senior interviews often ask about these topics. Know what each one is and how it works.

CapabilitiesLinux splits root power into capabilities. CAP_SETUID changes UIDs. CAP_DAC_OVERRIDE bypasses file permission checks. The capabilities man page says that CAP_SYS_ADMIN can be called "the new root", because it allows many admin operations. Never give it to a program that runs user input.
User namespaces and the kernelAn unprivileged user namespace gives a user "root" inside the namespace. The real UID does not change. But the user can now reach more kernel code, for example nf_tables. The public exploit for CVE-2024-1086 uses this. Ubuntu 24.04 restricts unprivileged user namespaces with AppArmor by default.
The dynamic loader and the environmentThe loader removes dangerous variables such as LD_PRELOAD for SUID programs. PwnKit put a dangerous variable back into the environment of pkexec. Looney Tunables was a bug in how the loader read GLIBC_TUNABLES. Root programs must not trust their environment.
ContainersA container is a process on the host kernel. A kernel bug in a container is a bug on the host. --privileged, a mounted docker.sock, extra capabilities or a host path mount can give host root. Use rootless runtimes, seccomp and dropped capabilities.
DetectionMITRE ATT&CK maps these paths to T1548.001 (Setuid and Setgid), T1548.003 (Sudo and Sudo Caching), T1053.003 (Cron) and T1068 (Exploitation for Privilege Escalation). Use auditd rules on execve with UID changes, file watches on /etc/sudoers and /etc/passwd, and a daily diff of SUID files.
Old sudo logic bugsCVE-2019-14287: a rule such as (ALL, !root) was meant to block root. Sudo before 1.8.28 accepted the user ID -1. The UID then stayed 0, so the command ran as root. Rules that say "any user except root" are fragile. Allow exact target users.

"A developer asks to join the docker group on a shared build server. What do you say?"

Membership of the docker group equals root on that host. The Docker documentation says this. The developer can mount the host disk into a container. Give rootless Docker or Podman, or a separate build VM. If the group is necessary, treat the member as an admin and log daemon API use.

"How do you remove privesc paths across 5,000 Linux servers?"

Make the safe state the default and check it all the time. Manage sudoers with configuration management, with exact commands and no editors. Keep a baseline of SUID files and capabilities and alert on new ones. Patch the kernel, sudo, polkit and glibc with a fixed time limit. Use live patching where reboots are hard. Mount /tmp and shares with nosuid. Run CIS benchmark scans and send audit logs to the SIEM.

A kernel exploit works only when the user can create an unprivileged user namespace. Which change decreases the risk before the patch?

  1. Mount /tmp with noexec
  2. Remove all SUID files
  3. Block the port of the service
  4. Restrict unprivileged user namespaces, for example with the Ubuntu AppArmor restriction

The restriction removes a precondition of the exploit. It can break some apps that need namespaces, so test it first. The patch is still the real fix.

10Interview mode

Give your answer in four parts: what it is, how attackers use it, how to fix it, and one deeper detail. Use 30 to 60 seconds.

Example: "How can a SUID binary lead to root?"

  1. What: a SUID file runs with the UID of its owner. If root owns it, it runs as root.
  2. Attack: if the program can start a shell, read any file or load a library, the user gets that power as root.
  3. Fix: remove the bit with chmod u-s, or use a group or a capability instead.
  4. Detail: bash drops SUID privileges by default. Mount untrusted file systems with nosuid.

Say each answer aloud before you flip the card. Tick "only the ones I missed" to practise your missed cards.

What is privilege escalation?
A user gets more rights than the system gave them. On Linux, the target is usually root.
What is the difference between vertical and horizontal privesc?
Vertical goes up, for example from www-data to root. Horizontal goes to a different user at the same level, for example from www-data to alice.
What makes root special?
Root is UID 0. The kernel skips most permission checks for UID 0.
What is the SUID bit?
A file permission. The program runs with the UID of the file owner, not the user who starts it. ls -l shows it as s in the owner execute position.
Why does passwd have the SUID bit?
It must write /etc/shadow, and only root can write that file. It is safe because it does one small job.
What does sudo -l show?
The commands that the current user can run with sudo, and as which user. It is often the first check.
Why is a sudo rule for an editor dangerous?
Editors can run shell commands. The shell runs as root. Use sudoedit.
What is GTFOBins?
A public list of normal Unix programs and how they bypass local restrictions, for example with sudo, SUID or capabilities.
What is /etc/shadow?
The file that stores password hashes. Only root, and on some systems the shadow group, can read it.
Why is a writable root cron script dangerous?
Any user can change the script. Root runs it on a schedule, so the change runs as root.
What is a kernel exploit?
Code that uses a kernel bug to get root. Testers use it last, because it can crash the host.
Name three famous Linux privesc CVEs.
Dirty COW (CVE-2016-5195), PwnKit (CVE-2021-4034) and Dirty Pipe (CVE-2022-0847).
Why is the docker group a risk?
The Docker daemon runs as root. A member can mount the host disk into a container. The Docker documentation says the group grants root-level privileges.
What do you do first with a low shell on a test host?
Record the user, groups, host name and kernel. Then list what runs as root. Test only systems that you have permission to test.
What are Linux capabilities?
Root power split into units, such as CAP_NET_RAW or CAP_SETUID. A file or a process can have some of them without full root.
Why is cap_setuid on python dangerous?
The capability lets the program change its UID to 0. Python runs any code, so any user gets root.
What is PATH hijacking?
A root script runs a command without a full path. The user puts a program with the same name in a directory that comes first in PATH. Root runs it.
What do env_reset and secure_path do?
env_reset gives each sudo command a new, minimal environment. It is on by default. secure_path sets a fixed PATH for sudo commands.
Why is LD_PRELOAD in env_keep dangerous?
The user can then load a library into each command that sudo runs as root. The library code runs as root.
What is NFS no_root_squash?
An export option. Root on a client stays root on the share, so the client can put SUID root files there. root_squash is the default.
What does the nosuid mount option do?
The kernel ignores SUID and SGID bits and file capabilities for programs on that mount.
What is wildcard injection?
A root script uses * in a directory that users can write. The shell expands file names, and a file name that starts with - becomes an option of the command.
What was PwnKit?
CVE-2021-4034, disclosed in 2022. The SUID program pkexec mishandled an empty argument list. Any local user got root. The bug was there since 2009.
What was Baron Samedit?
CVE-2021-3156, a heap overflow in sudo. Sudo 1.8.2 to 1.8.31p2 and 1.9.0 to 1.9.5p1 were affected. The user did not need a sudoers entry.
What was Dirty Pipe?
CVE-2022-0847, from kernel 5.8. A user could overwrite data in read-only files through the page cache. Fixes are in 5.16.11, 5.15.25 and 5.10.102.
How do you find root scheduled jobs?
Read /etc/crontab and /etc/cron.*. Run systemctl list-timers. Watch the process list for short jobs that run as root.
Why is sudoedit safer than sudo with an editor?
The editor runs as the normal user on a temporary copy. Root only copies the saved file back.
Why is CAP_SYS_ADMIN called "the new root"?
It allows many admin operations, for example mount. The capabilities man page uses this name. It tells kernel developers not to choose it for new features.
Why do many kernel exploits need unprivileged user namespaces?
In a new user namespace, the user gets capabilities such as CAP_NET_ADMIN for that namespace. Then the user can reach more kernel code, for example nf_tables. Ubuntu 24.04 restricts these namespaces by default.
Was CVE-2024-1086 used in real attacks?
Yes. CISA added it to the KEV catalog in May 2024. In 2025, CISA marked it as used in ransomware campaigns.
What was Looney Tunables?
CVE-2023-4911, a buffer overflow in the glibc loader. It read GLIBC_TUNABLES when a user started a SUID program. Qualys disclosed it in October 2023.
What was the 2025 sudo chroot bug?
CVE-2025-32463. Sudo 1.9.14 to 1.9.17 loaded a library through an nsswitch.conf in a directory that the user chose. The fix is 1.9.17p1. CISA added it to KEV in September 2025.
What was CVE-2019-14287?
Sudo before 1.8.28 accepted the user ID -1. The UID then stayed 0. A rule such as (ALL, !root) then gave root.
How does container escape relate to privesc?
Containers share the host kernel. --privileged, a mounted docker.sock, extra capabilities or a host path mount can give host root.
How do you detect privesc?
Use auditd rules on UID changes in execve and file watches on sudoers and passwd. Diff the SUID files every day. Use EDR alerts on root shells from service users.
Which ATT&CK techniques cover Linux privesc?
T1548.001 Setuid and Setgid, T1548.003 Sudo and Sudo Caching, T1053.003 Cron and T1068 Exploitation for Privilege Escalation.
How do you remove privesc paths across a fleet?
Manage sudoers in configuration management. Keep a SUID and capability baseline. Patch with a time limit and live patching. Scan against CIS benchmarks.
Why is a kernel exploit risky in a production test?
It can cause a kernel panic and data loss. Get approval. Often the version and the vendor advisory are enough proof.
What was GameOver(lay)?
CVE-2023-2640 and CVE-2023-32629 in Ubuntu's OverlayFS. The kernel copied file capabilities in an unsafe way. Wiz said 40% of Ubuntu cloud workloads were affected.
How do you write a strong privesc finding?
Give the path, the preconditions and a harmless proof from your own test account. Give the impact and the exact fix. Say what you removed after the test.

11Cheat sheet

The bugA program runs with root power and reads something that a low user controls.
Four groups
  • Misconfiguration: sudo, SUID, caps, cron
  • Credentials: passwords, keys
  • Groups: docker, lxd, disk
  • Bugs: kernel, sudo, polkit, glibc
Check
  • id, uname -r
  • sudo -l
  • SUID files, getcap
  • cron, timers, root processes
  • writable files and directories
Defence order
  1. Patch
  2. Least privilege sudo
  3. Remove SUID and caps
  4. Lock root files
  5. Detect and alert
Show it
  • Only on systems that you have permission to test
  • id as root, a marker file
  • The path, the preconditions, the fix
Incorrect ideas
  • Privesc needs a kernel bug
  • The docker group is safe
  • Hiding the version is a fix
  • A file name in a sudo rule limits the program
  • A firewall stops local attacks
Done! Next classes: JWT attacks, the TLS handshake and threat modeling.

Did you find an error? Tell me on X. Paper versions: Linux /proc and Linux /dev flyers.

Get the next one by email

New posters land in the Security Zines newsletter on Substack. Free, no spam.