Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

What Is Dirty COW?

Dirty COW, CVE-2016-5195, was a nine-year-old race condition in the Linux kernel that let any local user write to read-only files and escalate to root on almost every distribution.

Illustration for the cybersecurity term Dirty COW
Home / Blog / Cybersecurity Terms / What Is Dirty COW?
17 November 2026

What Is Dirty COW?

What Is Dirty COW?

Dirty COW is CVE-2016-5195, a privilege escalation vulnerability in the Linux kernel disclosed on 19 October 2016. The name is a contraction of “dirty copy-on-write”, and it describes a race condition in the kernel’s memory subsystem that allowed an unprivileged local user to write to files they only had permission to read. Overwriting /etc/passwd or a setuid binary turns that into root access within seconds.

Two things made it notable. It worked on essentially every Linux system in use at the time, including Android, embedded devices, and container hosts. And it had been present since kernel 2.6.22, released in 2007, meaning it sat in the most heavily reviewed open source codebase in the world for nine years.

Copy-on-Write, Briefly

When a process maps a file privately with MAP_PRIVATE, the kernel does not duplicate the pages immediately. It maps the original, read-only, and waits. If the process writes, a page fault occurs, the kernel copies the page, and the write lands on the private copy. The original file is untouched. This is copy-on-write, and it is what makes fork() cheap.

The flaw was in the handling of that fault. By racing two threads — one repeatedly writing to the mapping through /proc/self/mem, the other repeatedly calling madvise() with MADV_DONTNEED to discard the private copy — an attacker could occasionally get the kernel to lose track of which page the write should target. The write then reached the original, read-only page cache entry rather than the private copy, modifying the file’s contents in memory and, for many file systems, on disk.

The exploit was short, portable, and extremely reliable. Proof of concept code appeared within hours of disclosure.

Discovery and Impact

Phil Oester discovered it by capturing traffic to a compromised server and finding an exploit binary in it, which means it was being used in the wild before it was reported. Linus Torvalds noted that he had attempted to fix the same race in 2005 but the fix had been reverted because of problems on s390 hardware.

The patch landed quickly in the mainline kernel and distributions shipped updates within days. Android was the harder problem: the ZNIU malware family used Dirty COW to root devices in 2017, and the fragmented update landscape meant many handsets stayed vulnerable for a long time afterwards. Embedded and industrial Linux devices, where kernels are often frozen at the version the vendor certified, were worse again.

Why It Still Matters

Dirty COW is patched everywhere that receives patches. It remains relevant for three reasons.

Detection and Response

Detecting exploitation after the fact is difficult, because the technique leaves little on disk beyond the modified file. Useful signals include unexpected changes to /etc/passwd, /etc/shadow, or setuid binaries, which file integrity monitoring should catch; processes making heavy use of madvise() combined with writes to /proc/self/mem, which audit rules can record; and new root-owned processes with an unexpected parent.

Preventively, the controls that matter are the ordinary ones: keep kernels current and reboot after updating, or use live patching where downtime is costly; minimise the number of users with local shell access; and apply seccomp and mandatory access control so that a process cannot reach the syscalls a given exploit needs.

Where you have Linux estates that cannot be patched quickly, our infrastructure security testing services identify which hosts are genuinely reachable by an attacker who already has a local account.

FAQ – Frequently Asked Questions

Can Dirty COW Be Exploited Remotely?

No. It is a local privilege escalation and requires the attacker to be able to execute code on the system already, whether through a shell account, a compromised web application, or a container. In real intrusions it was used as the second step, after a remote vulnerability or stolen credentials provided initial access as an unprivileged user.

Which Linux Versions Were Affected?

Every kernel from 2.6.22, released in 2007, up to the versions patched in October 2016, which covered essentially all distributions and Android releases in use at the time. Fixed versions appeared quickly in the mainline kernel and in distribution updates. Anything still running an unpatched kernel from that period has many other problems alongside this one.

Why Did the Bug Survive for Nine Years?

It was a race condition in a rarely exercised path of the memory management code, triggered only by an unusual combination of operations with precise timing. Race conditions do not show up in ordinary testing or code review, because the faulty behaviour depends on thread interleaving. Linus Torvalds had attempted a related fix in 2005, but it was reverted for hardware-specific reasons.

Does Dirty COW Allow Container Escape?

In practice, yes, where containers rely on kernel namespaces for isolation and share the host kernel. Root inside a container plus a kernel escalation generally means root on the host. The incident is one reason teams adopted seccomp profiles, user namespaces, read-only root file systems, and in high-risk cases hardware-isolated runtimes such as microVMs.

Related Terms

You May Be Interested In These

What Are Mobile Authentication Risks?

Cybersecurity Terms

17 November 2026

What Are Mobile Authentication Risks?

Read More
What Is Pivoting?

Cybersecurity Terms

17 November 2026

What Is Pivoting?

Read More
What Is Sudo Baron Samedit?

Cybersecurity Terms

17 November 2026

What Is Sudo Baron Samedit?

Read More