Aibet2 Stack
📖 Tutorial

Uncovering a Decade-Old Kernel Vulnerability: AEAD Socket Bug Allows Page Cache Writes

Last updated: 2026-05-01 18:01:32 Intermediate
Complete guide
Follow along with this comprehensive guide

In 2023, security firm Xint disclosed a critical vulnerability in the Linux kernel that has lurked unnoticed since 2017. This bug, centered on AEAD encrypted sockets, enables attackers to perform arbitrary 4-byte writes into the page cache. By exploiting the splice() system call and AF_ALG sockets, adversaries can corrupt privileged binaries, such as setuid programs. The flaw has already been patched in mainline kernels, but its discovery highlights a subtle interplay between kernel memory management and cryptographic interfaces. Below, we break down the details in a question-and-answer format.

What is the nature of the AEAD socket security bug discovered by Xint?

Xint uncovered a Linux kernel vulnerability that allows an unprivileged user to write arbitrary 4-byte values to arbitrary offsets within the page cache. The bug resides in how AEAD (Authenticated Encryption with Associated Data) sockets handle data when combined with the splice() system call. Specifically, when a user requests an AEAD-encrypted socket via the AF_ALG interface and then splices a crafted payload into it, the kernel's scatterlist for that socket ends up holding direct references to page cache pages. This bypasses normal copy-on-write protections, permitting a controlled corruption of cached file data. The exploit effectively turns the splice operation into a write primitive against any file that is currently memory-mapped or cached, including sensitive system binaries.

Uncovering a Decade-Old Kernel Vulnerability: AEAD Socket Bug Allows Page Cache Writes
Source: lwn.net

How long has this vulnerability existed in the Linux kernel?

The vulnerability was introduced in kernel version 4.11, which was released in 2017. It remained present for over six years until Xint's disclosure and subsequent fix in mainline kernels. This extended window means that millions of Linux systems, including servers, desktops, and embedded devices, were potentially exposed. The bug is not architecture-specific and affects all distributions that use the mainline kernel or backports of the relevant code. During this time, any unprivileged user with access to AF_ALG sockets could potentially exploit the flaw, though reliable exploitation required understanding of the kernel memory layout and file caching behavior.

What is the core primitive exploited in this vulnerability?

The core primitive is the splice() system call, which transfers data between file descriptors and pipes without copying data to userspace. Splice works by passing page cache pages by reference directly into kernel buffers, avoiding duplication. In normal usage, this is efficient but safe because the pages are read-only. However, when combined with an AF_ALG socket (specifically one configured for AEAD encryption), the socket's input scatterlist receives these direct page references. The vulnerability arises because the AEAD socket does not expect to receive page cache pages that could later be modified — yet splice() provides exactly that. As a result, an attacker can prepare a payload that, when spliced, overwrites specific parts of the page cache, including those backing setuid binaries.

How does splice() contribute to the exploit mechanism?

Splice() is central to the exploit because it enables zero-copy data transfer. When a user splices a file into a pipe and then from the pipe into an AF_ALG socket, the socket's internal scatterlist points directly to the kernel's cached pages of that original file. These pages are not duplicated — they are the same physical pages that serve every read(), mmap(), and execve() of that file. Because the socket processes the data as it would for encryption, but without ensuring the pages are immutable, a carefully timed write via the socket can modify the page cache content. The proof-of-concept demonstrates this by corrupting a setuid binary: after splicing, the attacker can inject a 4-byte change at a strategic offset, altering the binary's behavior to gain elevated privileges.

What kind of attack can a proof-of-concept demonstrate?

Xint's proof-of-concept shows how to use the vulnerability to corrupt a setuid binary on multiple popular Linux distributions. By requesting an AEAD-encrypted socket from user space and splicing a specific payload into it, an attacker can overwrite four bytes in the page cache corresponding to that binary. When the binary is next executed, the corrupted code allows the attacker to escalate privileges to root. The PoC works reliably on distributions like Ubuntu, Debian, and Fedora, as long as the unpatched kernel is used. This attack does not require special hardware or kernel configuration beyond the presence of the AF_ALG socket family and splice support — both common in general-purpose Linux kernels.

What is the impact on user-space binaries like setuid?

The impact is severe because setuid binaries run with elevated privileges. Corrupting even a few bytes of such a binary can alter its execution path, giving an attacker the ability to spawn a shell with root permissions. Since the vulnerability allows arbitrary 4-byte writes to the page cache, an attacker can target the executable code of any file that is cached, including libraries and security-critical binaries. The exploit does not require root access to trigger; any unprivileged user with permission to create AF_ALG sockets and use splice can attempt it. Once the binary is corrupted, the system's integrity is compromised until the kernel is patched and the page cache is cleared.

Has the vulnerability been fixed, and where can more details be found?

Yes, the vulnerability has been fixed in mainline Linux kernels. The patch ensures that when pages are passed to an AF_ALG socket via splice(), the socket takes a copy or otherwise prevents write access to the original page cache pages. Xint published a supplemental blog post with in-depth technical analysis, including the root cause and the fix approach. Additionally, the Linux kernel mailing list contains the commit that addresses the issue. System administrators are advised to update to a kernel version that includes this patch as soon as possible. For those running long-term support kernels, backports are likely available from their distribution maintainers.

What are the potential risks to system integrity?

The primary risk is unauthorized privilege escalation. Because the bug allows modification of any cached file, an attacker could corrupt authentication binaries, shell programs, or dynamic loaders, leading to persistent root-level access. Even after a reboot, if the corrupted files are still cached (depending on filesystem behavior), the attack surface remains. Additionally, the vulnerability could be used to bypass security mechanisms like SELinux or AppArmor, since it writes directly to kernel memory structures rather than going through normal system call paths. This makes detection difficult without kernel-level auditing. Organizations running workloads on untrusted multi-user systems, such as shared hosting or cloud containers, are especially at risk.