CVE-2025-39964: Linux Kernel Crypto AF_ALG Concurrent Write Race Condition
HERMES THREAT SCORE & OPERATIONAL EXPLOITABILITY
Target:Linux Kernel Crypto User API (crypto/af_alg.c / af_alg_sendmsg) Classic CVSS v3.1 initially rated this flaw as low/moderate severity (3.3 to 5.5) under the theoretical assumption that it only triggered local denial of service. The Hermes Threat Score re-evaluates it at 88 HIGH following its weaponization by threat actors and formal addition to the CISA KEV Catalog on September 18, 2026.
CVE-2025-39964: Linux Kernel Crypto AF_ALG Concurrent Write Race ConditionVULNERABILITY
Software platform affected by security vulnerabilities and agentic attack patterns.
๐ Why is this related? (Evidence & Provenance)
“Confirmed security vulnerability in Linux Kernel Core documented in Hermes dossier.”
- [vulnerability_report]
- [government_confirmation]CISA verified active exploitation in the wild and mandated federal remediation deadline in KEV entry. — Source: Cybersecurity & Infrastructure Security Agency (CISA): CISA Adds CVE-2026-59822 to Known Exploited Vulnerabilities Catalog (Reliability: VERY_HIGH)
1. Technical Root Cause: The Lack of Exclusive Write Ownership
Section titled โ1. Technical Root Cause: The Lack of Exclusive Write OwnershipโThe AF_ALG socket interface allows unprivileged userland processes to access in-kernel hardware-accelerated cryptographic ciphers (e.g. AES, SHA, ChaCha20).
When a process initiates data transmission via sendmsg(), the kernel routes the request to af_alg_sendmsg(). In vulnerable kernel versions, multiple threads could concurrently issue sendmsg() calls against the exact same socket context (struct af_alg_ctx):
sequenceDiagram autonumber actor ThreadA as Thread A (Attacker) actor ThreadB as Thread B (Attacker) participant Socket as AF_ALG Socket (af_alg_ctx) participant SGL as Scatterlist Buffer Allocator
ThreadA->>Socket: sendmsg(size=4096) ThreadB->>Socket: sendmsg(size=1024) [Concurrent race] Note over Socket: ctx->used counter and sgl pointers modified simultaneously Socket->>SGL: Asymmetric page allocation & partial release ThreadA->>Socket: Thread A completes and prematurely frees shared page buffer ThreadB->>Socket: Thread B writes into freed page (Use-After-Free / Slab Corruption)Because af_alg_sendmsg() lacked an exclusive lock on write operations:
ctx->usedcounters were modified non-atomically.- The scatter-gather list (
sgl) chained buffers became corrupted. - Thread completion routines triggered premature deallocations while peer threads were still transmitting, resulting in Use-After-Free (UAF) and slab corruption.
2. Kernel Patch Analysis (Commit 1b34cbbf4f01)
Section titled โ2. Kernel Patch Analysis (Commit 1b34cbbf4f01)โThe Linux kernel development team resolved the flaw by introducing an explicit write ownership lock ctx->write:
// crypto/af_alg.c fix snippetif (ctx->write) { err = -EBUSY; goto unlock;}ctx->write = true;This ensures that only a single userland thread can execute sendmsg() on any given AF_ALG socket instance at any point in time. Any concurrent write attempt receives an explicit -EBUSY error rather than corrupting memory state.
3. Forensic Analysis & Detection Rules
Section titled โ3. Forensic Analysis & Detection Rulesโ3.1 Kernel Crash Signatures (dmesg)
Section titled โ3.1 Kernel Crash Signatures (dmesg)โLook for reference count underflow or page table corruption originating in crypto/af_alg.c:
kernel BUG at crypto/af_alg.c:382!refcount_t: underflow; use-after-free has been detected on af_alg socket.Call Trace: <TASK> af_alg_free_resources+0x.../0x... [af_alg] af_alg_release+0x.../0x... [af_alg] sock_close+0x.../0x... ...3.2 Auditd Monitoring for AF_ALG Sockets
Section titled โ3.2 Auditd Monitoring for AF_ALG SocketsโDetect suspicious creation of cryptographic sockets by non-root users:
-a always,exit -F arch=b64 -S socket -F a0=38 -k crypto_af_alg_creation(On x86_64, socket family constant 38 corresponds to AF_ALG).
3.3 YARA Detection for AF_ALG Exploit Binaries
Section titled โ3.3 YARA Detection for AF_ALG Exploit Binariesโrule Linux_AF_ALG_Exploit_Artifact { meta: description = "Detects compiled binaries opening AF_ALG cryptographic sockets in multithreaded loops" cve = "CVE-2025-39964" author = "Hermes Codex Intelligence" strings: $af_alg_str1 = "skcipher" ascii $af_alg_str2 = "cbc(aes)" ascii $sock_call = { 48 C7 C7 26 00 00 00 } // mov rdi, 38 (AF_ALG) condition: uint32(0) == 0x464C457F and all of ($af_alg_str*) and $sock_call}3.4 Weaponized Exploit Repository (CVE-2025-39964_EXP)
Section titled โ3.4 Weaponized Exploit Repository (CVE-2025-39964_EXP)โA functional local privilege escalation exploit repository authored by researcher n1k0oowang is available on GitHub (n1k0oowang/CVE-2025-39964_EXP). The exploit orchestrates multithreaded concurrent invocations of af_alg_sendmsg() on shared AF_ALG cryptographic sockets, corrupting sgl scatterlist structures to trigger kernel heap use-after-free conditions and grooming the slab allocator to overwrite credential structures (commit_creds) for local root privilege escalation.
4. Remediation & Workarounds
Section titled โ4. Remediation & Workaroundsโ- Apply Updated Stable Kernels:
Upgrade to Linux kernel versions
5.10.245,5.15.194,6.1.154,6.6.108,6.12.49, or6.16.9(and newer). - Blacklist the Vulnerable Kernel Module (Immediate Workaround):
If userland applications do not require direct kernel cryptographic acceleration:
Terminal window echo "blacklist af_alg" > /etc/modprobe.d/disable-af-alg.confecho "install af_alg /bin/true" >> /etc/modprobe.d/disable-af-alg.conf - Container Hardening:
Ensure containers drop unnecessary capabilities and block
socket(AF_ALG)via seccomp filters.
5. References & Historical Provenance
Section titled โ5. References & Historical Provenanceโ- CISA KEV Catalog: Added September 18, 2026
- Weaponized Exploit PoC: n1k0oowang/CVE-2025-39964_EXP on GitHub
- Upstream Patch Commits:
1b34cbbf4f011a121ef7b2d7d6e6920a036d5285,0f28c4adbc4a,1f323a48e9b5,45bcf60fe49b,7c4491b5644e - Related Hermes Intelligence: