
Набор инструментов для исследования и обнаружения LPE-уязвимости CVE-2026-31431 в ядре Linux, включающий анализ эксплойтов, правила YARA, обнаружение через auditd/Falco, руководство по патчингу и лабораторную среду.
algif_aeadCISA KEV | CVSS 7.8 HIGH | Затрагивает ядра Linux 4.14 — начало 2026 года (~9 лет)
CVE-2026-31431, получивший прозвище «Copy Fail», — это уязвимость локального повышения привилегий (LPE) высокой степени серьёзности в криптографической подсистеме ядра Linux. Непривилегированный локальный пользователь может повысить привилегии до root за секунды на любой системе без установленного патча.
| Атрибут | Значение |
|---|---|
| CVE | CVE-2026-31431 |
| Прозвище | Copy Fail |
| CVSS v3.1 | 7.8 HIGH |
| Вектор атаки | Локальный |
| Требуемые привилегии | Низкие |
| Взаимодействие с пользователем | Отсутствует |
| Компонент | crypto/algif_aead.c — шаблон authencesn |
| Введено | 2017 (коммит 72548b093ee3) |
| Раскрыто | 2026 |
| Лет без исправления | ~9 лет |
| CISA KEV | Да |
| Публичный PoC | Да (автономный Python-скрипт на 732 байта) |
detection/check_vulnerable.sh до и после устранения уязвимости.CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
| Metric | Value | Rationale |
|--------|-------|-----------|
| Attack Vector | **Local** | Requires shell access (SSH, container exec, physical) |
| Attack Complexity | **Low** | Reliable, fully automated — no race condition required |
| Privileges Required | **Low** | Any unprivileged user account |
| User Interaction | **None** | No victim interaction needed |
| Confidentiality | **High** | Full system compromise |
| Integrity | **High** | Full system compromise |
| Availability | **High** | Full system compromise |
### Threat Landscape
| Factor | Assessment |
|--------|-----------|
| PoC Availability | Public, weaponized, 732-byte standalone Python |
| Exploit Reliability | High — works across tested distros without modification |
| Detection Difficulty | High — no disk writes, no dirty pages |
| Attacker Skill Required | Low — script kiddie with public PoC |
| CISA KEV | Added 2026 — actively monitored |
| Microsoft Defender | Flagged as under active investigation |
### Affected Environments
| Environment | Risk |
|-------------|------|
| Bare-metal Linux servers | Critical |
| Linux VMs (cloud or on-prem) | Critical |
| Kubernetes nodes | Critical (also enables container escape) |
| Docker hosts | Critical |
| Shared hosting / multi-tenant | Critical |
| WSL2 / Linux on Windows | Assess per kernel version |
---
## 3. Technical Deep Dive
### 3.1 Background: AF_ALG and AEAD
The Linux kernel exposes cryptographic operations to userspace via **AF_ALG sockets** (`AF_ALG = 38`). This interface (`algif_aead`) allows unprivileged applications to invoke kernel crypto hardware accelerators without needing kernel-mode code.
**AEAD** (Authenticated Encryption with Associated Data) algorithms like AES-GCM and ChaCha20-Poly1305 are widely used for TLS, disk encryption, and VPN protocols. The vulnerable template is `authencesn` — an AEAD composition using `hmac(sha256)` + `cbc(aes)` with Extended Sequence Number (ESN) support, commonly used in IPsec.
### 3.2 Root Cause
In 2017, commit `72548b093ee3` introduced **in-place AEAD operation** to `algif_aead` as a performance optimization — allowing the crypto engine to read and write the same buffer. This was flawed:```
The bug chain:
1. Caller binds AF_ALG socket to:
authencesn(hmac(sha256),cbc(aes))
2. Caller sends a decryption request via sendmsg() with specific flags
3. Caller uses splice() to feed PAGE CACHE PAGES from an open file
descriptor directly into the socket's scatterlist
4. The authencesn template, during ESN header processing, uses the
OUTPUT BUFFER as scratch space — writing 4 bytes past the
expected output boundary
5. Because the scatterlist contains page cache pages (not private
copies), this scratch write lands DIRECTLY IN THE PAGE CACHE
6. Page cache is shared kernel-wide — all processes reading the
same file now see the modified bytes
Key insight: splice() is zero-copy — it hands page cache references
to the socket. The in-place "optimization" then writes INTO those
pages. No dirty bit is set because the write goes through the crypto
engine, not the normal write path.
Уязвимость обеспечивает контролируемую запись 4 байт в page cache любого файла, который атакующий может открыть для чтения:
| Свойство | Значение |
|---|---|
| Размер записи | 4 байта |
| Контроль смещения | Да — контролируется атакующим через смещение splice |
| Цель | Page cache любого читаемого файла |
| Пометка грязной страницы | Нет |
| Изменение на диске | Нет |
| Обновление временной метки | Нет |
| Запись в журнале ядра | Нет (если не настроен auditd) |
Запись повторяема — эксплойт зацикливает запись по 4 байта для пропатчивания более крупных последовательностей кода.
[1] Open /usr/bin/su (or any setuid-root binary) for reading ↓ [2] Map a copy to find target instruction bytes (e.g., UID check, execve path, security gate) ↓ [3] Compute exact page cache offset of target bytes ↓ [4] Set up AF_ALG socket → authencesn(hmac(sha256),cbc(aes)) ↓ [5] splice() the target binary's page cache into the socket ↓ [6] Trigger decryption → authencesn scratch write patches the target bytes in page cache (4 bytes per iteration) ↓ [7] Repeat for each 4-byte patch needed ↓ [8] Execute /usr/bin/su → runs root-owned setuid binary but now with attacker-controlled code in page cache ↓ [9] Root shell
### 3.5 Почему стандартные защиты не срабатывают
| Защита | Обойдена? | Причина |
|---------|-----------|--------|
| Мониторинг целостности файлов (Tripwire/AIDE) | **Да** | Нет изменений на диске |
| Проверка хешей файлов в IDS | **Да** | Байты на диске не изменены |
| `inotify` отслеживание файлов | **Да** | Нет события записи в VFS |
| SELinux / AppArmor | **Частично** | Контролирует процесс, а не запись в page cache через криптодвижок |
| Read-only монтирования | **Да** | Page cache изменяется в памяти, а не через монтирование |
| auditd `watch` на бинарник | **Да** | Audit отслеживает записи VFS — здесь VFS обходится |
### 3.6 Затронутые версии ядра