The Privilege-Escalation Decade: Dirty COW, Baron Samedit, PwnKit, Dirty Pipe and Looney Tunables

Between 2016 and 2023 a particular kind of Linux vulnerability kept arriving: not a remote break-in, but a way for someone who already had an ordinary account on a machine to become root. Dirty COW in 2016, Baron Samedit in 2021, PwnKit a year later, Dirty Pipe a few weeks after that, Looney Tunables in 2023. Different researchers, different parts of the system — the kernel, sudo, pkexec, the C library’s program loader — but the same shape every time, and the same two sentences in every write-up: it had been there for years, and it affects almost every distribution in its default install. This page is about that shape, because the individual mechanisms matter less than what the run of them says about where Linux is actually soft.

This is the fourth page in a series on the vulnerabilities that changed how Linux is built and defended, after Heartbleed, Shellshock and regreSSHion. Those three each got a page of their own. This set gets one page between them, because what is worth learning from them is the thing they have in common — and because the detail of how any one of them is driven is an attacker’s business, not a defender’s.

The five, briefly

Dirty COW (CVE-2016-5195) was a flaw in the Linux kernel’s memory management, reported by the administrator Phil Oester in October 2016 after he found it being used against a server he was investigating. Linus Torvalds fixed it within days — and noted in the fix that he had first tried to fix the same underlying race in 2005, only to have that fix reverted because it broke the s390 mainframe port. The bug had been reachable in shipping kernels since version 2.6.22 in 2007. It rooted servers and, as it turned out, almost every Android phone then in use.

Baron Samedit (CVE-2021-3156), disclosed by Qualys on 26 January 2021, was a flaw in sudo — the single most trusted setuid program on most Linux machines. Qualys dated its introduction to a commit in July 2011, which is to say it had been in sudo‘s default configuration, on Ubuntu, Debian and Fedora alike, for nearly ten years.

PwnKit (CVE-2021-4034), disclosed by Qualys on 25 January 2022, was a flaw in pkexec, the setuid-root helper that ships with polkit on desktop Linux. Qualys traced it to pkexec‘s very first version in May 2009: more than twelve years hiding, as their write-up put it, in plain sight, in a program installed by default across the major distributions.

Dirty Pipe (CVE-2022-0847) was reported to the kernel developers by Max Kellermann and made public on 7 March 2022. It was a flaw in the kernel’s pipe handling, present since kernel 5.8 in 2020; Kellermann himself described it as similar to Dirty COW but easier to exploit, and like Dirty COW it reached Android as well as servers. It was fixed in kernels 5.16.11, 5.15.25 and 5.10.102.

Looney Tunables (CVE-2023-4911), disclosed by Qualys on 3 October 2023, was a flaw in the glibc dynamic loader’s handling of an environment variable, introduced with glibc 2.34 in April 2021. The loader runs, with the privileges of the program it is starting, for every single program on the system, which is what made a bug in it serious; Qualys confirmed it on default installs of Fedora, Ubuntu and Debian, and noted that Alpine, which uses musl rather than glibc, was not affected.

What they have in common

Every one of these was a flaw in a piece of the system that is deliberately trusted to cross the line between an ordinary user and root. A normal program runs with your privileges and can do no more than you can. A small, deliberate set of components are the exceptions: the kernel, which is privilege itself; setuid-root programs like sudo and pkexec, which the system lets an ordinary user start but which then run as root; and the machinery, like the dynamic loader, that every program depends on as it starts. That set is the trusted surface. It is where the whole security model of a multi-user machine is enforced, and it is small enough to list. A bug anywhere in it does not let an attacker do something new to their own account — it lets them step across the line the surface exists to hold. None of these five was a remote hole; all of them were a local user becoming root, which is the same outcome every one of them produced by a completely different route.

How small that trusted surface is, on the machine used for this page:

$ find /usr/bin /usr/sbin /bin /sbin -perm -4000 -type f 2>/dev/null
/usr/bin/fusermount3
/usr/bin/sudo
/usr/bin/chfn
/usr/bin/chsh
/usr/bin/gpasswd
/usr/bin/mount
/usr/bin/newgrp
/usr/bin/passwd
/usr/bin/su
/usr/bin/umount

Ten setuid-root programs, plus the kernel and the loader behind them. That is the list an attacker with a shell studies, and it is the same list a defender can audit in an afternoon. Notably, pkexec is not on it: this is a server image, and polkit’s helper simply is not installed, which is exactly the position PwnKit argued every server should be in.

Why “local only” is not “minor”

Each of these was, in the vocabulary of advisories, a local privilege escalation: it requires the attacker to be able to run code on the machine already. It is tempting to file that under “not my problem — nobody untrusted has an account here,” and for a single-user laptop that is nearly true. For almost anything else it is the opposite of true, because the number of ways an attacker reaches the “can run code as some unprivileged user” starting line is enormous and growing.

A web application that can be made to run one command gives an attacker a shell as www-data. A CI system runs other people’s code by design. A shared host has real, mutually untrusting users. A container that is breached, or simply malicious, is an unprivileged process on the host kernel. In every one of those cases the attacker has already arrived at the starting line, and a local privilege escalation is the second move that turns a limited foothold into total control. Remote code execution gets the headlines and the emergency patching; local privilege escalation is the quiet half of nearly every serious intrusion, the step between “they got in” and “they own it.” A defender who dismisses it is defending only against the attacker who stops at the front door.

What it taught Linux

Old, trusted, ubiquitous code is where the serious bugs hide. Baron Samedit was in sudo for a decade, PwnKit in pkexec for twelve years, Dirty COW in the kernel for nine. These are not obscure programs that escaped attention; they are the most-run, most-reviewed code on the system. The “many eyes” that open source relies on had looked at all of them countless times without finding these bugs, for the same reason noted on the Shellshock and regreSSHion pages: the eyes were reading the code to understand what it did, not to attack the privilege boundary it sat on. Age and popularity are not evidence of safety, and the run of these bugs is what finally made that an operating assumption rather than a cynic’s remark.

Every setuid program is a question you should be able to answer. The most practical response to this decade was to shrink the trusted surface: audit what is setuid-root on a machine, and remove or disable anything that does not need to be. PwnKit in particular sent a lot of administrators looking for pkexec on headless servers that had no desktop, no local console users, and no reason to carry a graphical privilege helper at all. The surface cannot be eliminated — you will always have sudo, mount, su — but most machines are carrying more of it than they use, and each unnecessary setuid binary is a bet that no one will ever find a bug in it.

The kernel is shared, and a container does not change that. Dirty COW and Dirty Pipe were kernel bugs, and a container shares the host’s kernel. Root inside a container, reached through a kernel flaw, is root on the host — the namespaces and cgroups that isolate a container are a resource boundary, not the strong security boundary many people assume. This is why the serious container runtimes layer on seccomp profiles, user namespaces and dropped capabilities, and why the host kernel’s patch level matters more than the tidiness of any image running on it. A fully up-to-date Alpine container on an unpatched host is still one kernel bug from compromise.

For bugs with no remote vector, patch latency is the entire defence. None of these five could be fired across the network, so there was no internet-wide scanning to force the issue the way regreSSHion did — but each was turned into a reliable, public exploit within days of disclosure, and Dirty COW was in the wild before it even had a name. There is no clever mitigation to buy time; there is only the unexciting discipline of applying updates. Unattended upgrades for userspace components like sudo, polkit and glibc, and a livepatch service or a reboot schedule for the kernel, are what stand between “disclosed” and “exploited here,” and the gap between those two is measured in hours. Keeping a Server Patched is the page on making that automatic.

What to check on your machine today

All five are long fixed in every supported distribution, so the version checks pass almost everywhere. The point of running them is to confirm it on your machine, and to learn the three commands that answer “am I current?” for the components these bugs lived in.

sudo --version | head -1        # Baron Samedit was fixed in sudo 1.9.5p2 (Jan 2021)
ldd --version | head -1         # Looney Tunables fixed after glibc 2.34; distros backport
uname -r                        # Dirty COW and Dirty Pipe were kernel bugs
pkexec --version 2>/dev/null || echo "pkexec not installed"   # PwnKit lived here

On the machine used for this page these report Sudo version 1.9.15p5, ldd (Ubuntu GLIBC 2.39-0ubuntu8.12) 2.39, kernel 6.18.44, and pkexec not installed — every one of them well past the versions these bugs lived in, and the one graphical helper simply absent on a server. As with every page in this series, the distribution’s version string is a starting point and the package changelog is the real answer, for the reasons The Life of a Package lays out.

find / -xdev -perm -4000 -type f 2>/dev/null     # every setuid-root program on this filesystem
ls -l /var/run/reboot-required 2>/dev/null && cat /var/run/reboot-required.pkgs   # Debian/Ubuntu: a kernel update you haven't booted into

Read the first list and remove what you cannot account for; act on the second. The setuid audit is the single most useful habit this decade left behind — the list should be short, every entry on it should have a reason, and anything you do not recognise deserves a question before it deserves the benefit of the doubt. The reboot check matters because a kernel bug like Dirty COW or Dirty Pipe is only fixed once you are running the new kernel: installing the package is not enough, and a server that updates automatically but never reboots can sit on a patched-but-not-running kernel for months. Securing a New Linux Server is where the habits that keep this surface small start.

Sources

  • Dirty COW: the upstream fix commit (Linus Torvalds, “mm: remove gup_flags FOLL_WRITE games from __get_user_pages()”, 18 October 2016), which records the 2005 attempt and its revert; Red Hat’s CVE-2016-5195 page (Important, exploit found in the wild); the CERT/CC note VU#243144 (present since kernel 2.6.22); and the Ubuntu and Debian trackers for fixed versions
  • Baron Samedit: the Qualys advisory of 26 January 2021 (introduced July 2011; affected sudo 1.8.2–1.8.31p2 and 1.9.0–1.9.5p1; “hiding in plain sight for nearly 10 years”)
  • PwnKit: the Qualys advisory of 25 January 2022 (present since pkexec’s first version in May 2009; all polkit versions from 2009 affected)
  • Dirty Pipe: Max Kellermann’s oss-security post of 7 March 2022 (present since kernel 5.8; fixed in 5.16.11, 5.15.25 and 5.10.102; “similar to Dirty COW but easier to exploit”) and the Ubuntu dirtypipe vulnerability page
  • Looney Tunables: the Qualys advisory of 3 October 2023 (introduced with glibc 2.34 in April 2021; confirmed on Fedora, Ubuntu and Debian; Alpine unaffected)
  • Versions, the setuid list and the reboot check were read on the Ubuntu 24.04 machine used for this page

By design, this page does not reproduce any of the five exploits or describe how any one bug is driven; each advisory above holds that detail for the readers — defenders building detections, distribution maintainers — who need it.

Related reading