Pipes are the Swiss army knife of modern kernel exploitation. struct pipe_buffer arrays live in a resizable kmalloc cache and hold a struct page *, flags and an ops pointer. Corrupt them and you can leak, hijack control flow, or (the Dirty Pipe idea) write into the page cache of files you can only read, such as /etc/passwd or a setuid binary.
What you will learn
- pipe_buffer layout,
fcntl(F_SETPIPE_SZ)to choose its cache, and splice() to attach file pages - PIPE_BUF_FLAG_CAN_MERGE and why it lets you write to read-only files (CVE-2022-0847)
- Overwriting privileged files and binaries through the page cache
- Other ways into the page cache: COW bypasses, missing FOLL_WRITE, uprobes
- Getting a lot from a tiny primitive (decrement, few bytes) by choosing the right victim
Prerequisites
Module 04. Module 06 is useful for leaks.
References
Challenges
30-Day Scoreboard:
This scoreboard reflects solves for challenges in this module after the module launched in this dojo.
| Rank | Hacker | Badges | Score |