You can see an article from MAX Kellerman about the : The Dirty Pipe Vulnerability
real URL here : https://dirtypipe.cm4all.com/
Max Kellermann <max.kellermann@ionos.com>
Abstract
This is the story of CVE-2022-0847, a vulnerability in the Linux kernel since 5.8 which allows overwriting data in arbitrary read-only files. This leads to privilege escalation because unprivileged processes can inject code into root processes.
It is similar to CVE-2016-5195 “Dirty Cow” but is easier to exploit.
The vulnerability was fixed in Linux 5.16.11, 5.15.25 and 5.10.102.
Corruption pt. I
It all started a year ago with a support ticket about corrupt files. A customer complained that the access logs they downloaded could not be decompressed. And indeed, there was a corrupt log file on one of the log servers; it could be decompressed, but gzip
reported a CRC error. I could not explain why it was corrupt, but I assumed the nightly split process had crashed and left a corrupt file behind. I fixed the file’s CRC manually, closed the ticket, and soon forgot about the problem.
Months later, this happened again and yet again. Every time, the file’s contents looked correct, only the CRC at the end of the file was wrong. Now, with several corrupt files, I was able to dig deeper and found a surprising kind of corruption. A pattern emerged.
Access Logging
Let me briefly introduce how our log server works: In the CM4all hosting environment, all web servers (running our custom open source HTTP server) send UDP multicast datagrams with metadata about each HTTP request. These are received by the log servers running Pond, our custom open source in-memory database. A nightly job splits all access logs of the previous day into one per hosted web site, each compressed with zlib.
Via HTTP, all access logs of a month can be downloaded as a single .gz
file. Using a trick (which involves Z_SYNC_FLUSH
), we can just concatenate all gzipped daily log files without having to decompress and recompress them, which means this HTTP request consumes nearly no CPU. Memory bandwidth is saved by employing the splice()
system call to feed data directly from the hard disk into the HTTP connection, without passing the kernel/userspace boundary (“zero-copy”).
Windows users can’t handle .gz
files, but everybody can extract ZIP files. A ZIP file is just a container for .gz
files, so we could use the same method to generate ZIP files on-the-fly; all we needed to do was send a ZIP header first, then concatenate all .gz
file contents as usual, followed by the central directory (another kind of header).
Timeline
-
2021-04-29: first support ticket about file corruption
-
2022-02-19: file corruption problem identified as Linux kernel bug, which turned out to be an exploitable vulnerability
-
2022-02-20: bug report, exploit and patch sent to the Linux kernel security team
-
2022-02-21: bug reproduced on Google Pixel 6; bug report sent to the Android Security Team
-
2022-02-21: patch sent to LKML (without vulnerability details) as suggested by Linus Torvalds, Willy Tarreau and Al Viro
-
2022-02-23: Linux stable releases with my bug fix (5.16.11, 5.15.25, 5.10.102)
-
2022-02-24: Google merges my bug fix into the Android kernel
-
2022-02-28: notified the linux-distros mailing list
-
2022-03-07: public disclosure