{"id":54778,"date":"2026-06-01T22:12:37","date_gmt":"2026-06-02T02:12:37","guid":{"rendered":"https:\/\/overcentral.com\/en\/linux-kernel-drops-af_alg-interface-after-ai-discovered-flaw\/"},"modified":"2026-06-01T22:24:54","modified_gmt":"2026-06-02T02:24:54","slug":"linux-kernel-drops-af-alg-ai-flaw","status":"publish","type":"post","link":"https:\/\/overcentral.com\/en\/linux-kernel-drops-af-alg-ai-flaw\/","title":{"rendered":"Linux Kernel Drops AF_ALG Interface After AI-Discovered Flaw"},"content":{"rendered":"<p>The Linux kernel is taking an unprecedented step in its security posture by fully deprecating the AF_ALG cryptographic interface, a socket-based API that has exposed kernel-level encryption to userspace applications for over a decade. The decision, driven directly by the discovery of a critical vulnerability unearthed in roughly one hour by an AI-powered code analysis tool, signals a fundamental shift in how the kernel community is approaching attack surface management in an era of machine-speed vulnerability discovery.<\/p>\n<h2>What Is AF_ALG and Why Did the Linux Kernel Introduce It?<\/h2>\n<p>AF_ALG is a socket interface introduced in Linux kernel 2.6.38 in 2011 that allowed userspace applications to access kernel cryptographic implementations directly. Its primary purpose was to provide a shared pathway for hardware crypto accelerators, enabling applications to offload encryption operations to dedicated hardware without needing to implement their own kernel drivers. OpenSSL 1.1.0 and later versions included native support for AF_ALG as an engine, and the interface saw use in embedded Linux environments where hardware acceleration was desirable.<\/p>\n<p>Despite these intentions, the reality is that AF_ALG was never widely adopted by userspace applications. Most encryption in userspace is handled by well-established libraries such as OpenSSL, GnuTLS, and NSS, which maintain their own cryptographic implementations. The kernel&#x27;s internal crypto code exists primarily for in-kernel consumers like dm-crypt, kTLS, and IPsec, not for userspace programs that already have mature, self-contained crypto libraries.<\/p>\n<h2>How Did an AI Tool Discover the Copy Fail Vulnerability?<\/h2>\n<p>In late April 2026, security researcher Taeyang Lee at the South Korean cybersecurity firm <a href=\"https:\/\/www.theori.io\/\" target=\"_blank\" rel=\"noopener noreferrer\" data-iacss-external=\"1\">Theori<\/a> used an AI-driven code analysis tool called <a href=\"https:\/\/xint.dev\/\" target=\"_blank\" rel=\"sponsored noopener noreferrer\" data-iacss-external=\"1\">Xint Code<\/a> to scan the Linux kernel&#x27;s crypto subsystem. The scan took approximately one hour. What it uncovered was a severe privilege escalation vulnerability now tracked as <a href=\"https:\/\/cve.mitre.org\/cgi-bin\/cvename.cgi?name=CVE-2026-31431\" target=\"_blank\" rel=\"noopener noreferrer\" data-iacss-external=\"1\">CVE-2026-31431<\/a>, dubbed Copy Fail.<\/p>\n<p>The vulnerability, present in virtually every Linux distribution shipping kernels from 2017 onward, allowed an attacker to leverage the AF_ALG interface&#x27;s zero-copy optimization to achieve arbitrary read-write access to kernel memory. A Python proof-of-concept exploit weighing just 732 bytes could grant root privileges from an unprivileged user context. Security researchers immediately compared its severity to Dirty Pipe and Dirty COW, two of the most impactful privilege escalation flaws in Linux history.<\/p>\n<p>The zero-copy mechanism, which allowed userspace programs to directly encrypt data on page-cache pages (such as those belonging to the <code>su<\/code>codecodecodecodecodecode binary), created a classic TOCTOU (time-of-check, time-of-use) vulnerability window. An attacker could request encryption on a page, then swap its contents before the kernel completed the operation, effectively tricking the kernel into writing arbitrary data to privileged memory locations.<\/p>\n<h2>&#8220;We Cannot Defend This Any Longer&#8221;<\/h2>\n<p>Eric Biggers, a Google kernel cryptography developer who posted the deprecation patch, did not mince words about the rationale. His commit message stated plainly that AF_ALG is <strong>almost entirely unnecessary<\/strong> and exposes a <strong>vast attack surface<\/strong> that modern vulnerability discovery tools can no longer be effectively defended against.<\/p>\n<p>Biggers specifically referenced Copy Fail as the catalyst. But he made clear that this was not about fixing a single bug. The problem, he argued, is structural. The AF_ALG interface opens the entire kernel crypto subsystem to any unprivileged process that opens an AF_ALG socket. With AI tools dramatically lowering the cost of finding vulnerabilities in such exposed interfaces, the maintenance burden has become unsustainable relative to the number of actual users.<\/p>\n<p>The calculus is brutal: when only a handful of programs genuinely depend on a feature, and when that feature creates a privileged entry point into kernel memory that AI tools can now probe at machine speed, the rational response is not to patch endlessly. It is to remove the interface itself.<\/p>\n<h2>The Phased Removal of AF_ALG<\/h2>\n<p>The deprecation did not happen overnight. On May 18, 2026, a patch was merged into the cryptodev tree that removed zero-copy support from AF_ALG, directly closing the attack vector exploited by Copy Fail. Zero-copy was the most dangerous capability within the interface, and cutting it was the first and most urgent step.<\/p>\n<p>The full deprecation patch, slated for the Linux 7.2 merge window opening in mid-<a href=\"https:\/\/overcentral.com\/en\/berserk-chapter-384-june-2026-return\/\" title=\"Berserk Returns With New Chapter 384 in June 2026\" data-iacss-internal=\"1\">June 2026<\/a>, goes much further. It marks the entire AF_ALG interface as deprecated, removes hardware offload functionality, and leaves only a minimal software-only implementation for transitional purposes. The hardware accelerator path was removed because, as Biggers explained, the performance and attack-surface trade-off no longer makes sense. If a real use case for hardware offload from userspace emerges in the future, the correct approach is to design a new, security-hardened API specifically for that purpose rather than maintaining a general-purpose interface that serves almost no one.<\/p>\n<h2>Which Systems Are Actually Affected by This Change?<\/h2>\n<p>For the vast majority of Linux users, the deprecation of AF_ALG will have no practical impact. Standard desktop and server environments rely on userspace crypto libraries that do not use AF_ALG. The key subsystems that depend on kernel crypto functionality operate entirely within the kernel:<\/p>\n<ul>\n<li><strong>dm-crypt \/ LUKS<\/strong> for disk encryption<\/li>\n<li><strong>kTLS<\/strong> for kernel-level TLS offload<\/li>\n<li><strong>IPsec<\/strong> for network encryption<\/li>\n<li><strong>SSH, OpenSSL, GnuTLS, and NSS<\/strong> in their standard configurations<\/li>\n<\/ul>\n<p>None of these depend on AF_ALG. The interface exists only for userspace programs that choose to call into kernel crypto rather than using userspace libraries.<\/p>\n<p>The systems that may be affected include:<\/p>\n<ul>\n<li>Environments that explicitly enable the OpenSSL <code>afalg<\/code>codecodecodecodecodecode engine<\/li>\n<li>Applications that directly bind to AF_ALG sockets for hardware crypto offload<\/li>\n<li>Embedded Linux systems where hardware accelerator access has been routed through AF_ALG<\/li>\n<\/ul>\n<p>For these cases, the recommended migration path is to switch to standard userspace crypto libraries, which generally offer competitive performance and a significantly smaller attack surface from the kernel&#x27;s perspective.<\/p>\n<p>One notable user of AF_ALG is <code>iwd<\/code>codecodecodecodecodecode, Intel&#x27;s wireless daemon, which has been recommended to transition to userspace cryptography going forward.<\/p>\n<h2>AF_ALG Attack Surface Expansion and Deprecation Timeline<\/h2>\n<table>\n<tbody>\n<tr>\n<td><strong>2011<\/strong> \u2014 AF_ALG introduced in Linux 2.6.38 as a socket interface to expose kernel crypto to userspace, primarily for hardware accelerator sharing.<\/td>\n<\/tr>\n<tr>\n<td><strong>2017<\/strong> \u2014 In-place encryption optimization added for AEAD operations. This allowed page-cache pages to enter writable scatterlists, inadvertently creating the architectural condition that would later enable Copy Fail.<\/td>\n<\/tr>\n<tr>\n<td><strong>April 2026<\/strong> \u2014 Copy Fail (CVE-2026-31431) disclosed after AI scanning discovered the vulnerability in roughly one hour. The flaw affects nearly all distributions shipping kernels from 2017 onward and enables root privilege escalation.<\/td>\n<\/tr>\n<tr>\n<td><strong><a href=\"https:\/\/overcentral.com\/en\/may-2026-google-core-update\/\" title=\"Google Begins Rolling Out May 2026 Core Update\" data-iacss-internal=\"1\">May 2026<\/a><\/strong> \u2014 Zero-copy support removed from AF_ALG, closing the direct attack path used by Copy Fail.<\/td>\n<\/tr>\n<tr>\n<td><strong>June 2026<\/strong> \u2014 Full deprecation announced for Linux 7.2. Hardware offload removed. Software-only implementation retained as a transitional measure. The deprecation process has officially begun.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Why AI Changed the Calculus for Linux Kernel Security<\/h2>\n<p>The Copy Fail discovery is not an isolated incident. It represents a broader transformation in vulnerability research that the Linux kernel community is only beginning to grapple with. The cost of finding security flaws in exposed kernel interfaces has dropped dramatically. Tools like Xint Code, which combine static analysis with AI-driven pattern recognition, can scan massive codebases in minutes and surface vulnerabilities that would have taken human researchers weeks or months to identify.<\/p>\n<p><a href=\"https:\/\/overcentral.com\/en\/linus-torvalds-reverts-ai-patches\/\" title=\"Linus Torvalds Vows to Revert AI-Generated Patches\" data-iacss-internal=\"1\">Linus Torvalds<\/a> himself has expressed frustration with the surge of AI-generated bug reports and patches. During the Linux 7.1 release cycle, he declared that AI-originated bug reports would be treated as public by default, meaning they bypass traditional responsible disclosure norms. The sheer volume of output from automated tools is straining the kernel&#x27;s review and maintenance capacity.<\/p>\n<p>Eric Biggers&#x27; decision to deprecate AF_ALG rather than continue patching it reflects this new reality. When the cost of finding a vulnerability in an interface drops to near zero, and when that interface is used by almost no one, the only defensible strategy is to eliminate the interface entirely. The kernel crypto subsystem has arrived at that conclusion.<\/p>\n<p>Biggers&#x27; closing line in the patch thread was characteristically measured: <strong>&#8220;Let&#x27;s move forward and document the deprecation.&#8221;<\/strong> It is a deceptively simple statement for a decision that represents nine years of latent risk, one hour of AI scanning, and a fundamental change in how the kernel community thinks about what it can afford to keep.<\/p>\n<p>The message from the kernel crypto maintainers is clear: if it cannot be defended, it must be removed. In the age of AI-accelerated vulnerability discovery, that doctrine is likely to apply to more than just AF_ALG.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Linux kernel is taking an unprecedented step in its security posture by fully deprecating the AF_ALG cryptographic interface, a socket-based API that has exposed kernel-level encryption to userspace applications for over a decade. The decision, driven directly by the discovery of a critical vulnerability unearthed in roughly one hour by an AI-powered code analysis [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":73444,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/iili.io\/CF7wAI1.jpg","fifu_image_alt":"Linux Kernel Drops AF_ALG Interface After AI-Discovered Flaw","footnotes":""},"categories":[349],"tags":[],"class_list":["post-54778","post","type-post","status-publish","format-standard","has-post-thumbnail","category-articles"],"fifu_image_url":"https:\/\/iili.io\/CF7wAI1.jpg","fifu_image_alt":"Linux Kernel Drops AF_ALG Interface After AI-Discovered Flaw","_links":{"self":[{"href":"https:\/\/overcentral.com\/en\/wp-json\/wp\/v2\/posts\/54778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/overcentral.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/overcentral.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/overcentral.com\/en\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/overcentral.com\/en\/wp-json\/wp\/v2\/comments?post=54778"}],"version-history":[{"count":0,"href":"https:\/\/overcentral.com\/en\/wp-json\/wp\/v2\/posts\/54778\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/overcentral.com\/en\/wp-json\/wp\/v2\/media\/73444"}],"wp:attachment":[{"href":"https:\/\/overcentral.com\/en\/wp-json\/wp\/v2\/media?parent=54778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/overcentral.com\/en\/wp-json\/wp\/v2\/categories?post=54778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/overcentral.com\/en\/wp-json\/wp\/v2\/tags?post=54778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}