CVE-2026-31431 Copy Fail:Linux 内核本地提权漏洞深度分析与修复
|
wanlinwang
|
5 min read
严重程度:CVSS 7.8 (High)
漏洞别名:Copy Fail
影响范围:2017 年至今几乎所有主流 Linux 发行版
公开披露:2026-04-29
内核补丁:commit a664bf3d603d
一、交互式漏洞利用流程演示
以下是一个 7 步交互式可视化,展示从普通用户到 root 的完整攻击链。
二、漏洞技术原理
根本原因
2017 年,algif_aead.c 引入了 in-place 优化(commit 72548b093ee3):
1
2
3
4
5
6
7
| // 优化前(安全):src 和 dst 分离
req->src = TX_SGL; // 含 Page Cache 页(只读路径)
req->dst = RX_SGL; // 用户缓冲区(可写)
// 优化后(有漏洞):src = dst
req->src = req->dst = 合并的 SGL;
// Page Cache 页通过 sg_chain() 链入可写的 dst!
|
authencesn 的越界写
1
2
3
| // 第3步:写 seqno_lo 到 dst[assoclen + cryptlen]
// 这个位置正好是 Tag 区域 = 现在是 Page Cache 页!
scatterwalk_map_and_copy(tmp+1, dst, assoclen+cryptlen, 4, 1);
|
攻击者控制三个维度:
| 控制项 |
方法 |
| 哪个文件 |
任何普通用户可读的 setuid 文件 |
| 哪个偏移 |
通过 assoclen + splice offset 精确定位 |
| 写入什么值 |
AAD[4:8](seqno_lo)完全由攻击者构造 |
三、修复方法
数据来源:Ubuntu 官方、CERT-EU、CloudLinux、Tenable(2026-04-30)
3.1 确认是否受影响
1
2
3
4
5
6
7
| # 查看内核版本
uname -r
# 确认模块状态(built-in 或 loadable)
modinfo algif_aead | grep filename
# 输出 "(builtin)" → RHEL 系,需用 grubby 方案
# 输出文件路径 → Debian 系,rmmod 有效
|
3.2 立即临时缓解
方案 A:禁用模块(Ubuntu / Debian 系)
1
2
3
| echo "install algif_aead /bin/false" | sudo tee /etc/modprobe.d/disable-algif.conf
sudo rmmod algif_aead 2>/dev/null || true
sudo update-initramfs -u
|
验证:
1
2
| sudo modprobe algif_aead # 应该报错
lsof | grep AF_ALG # 应该无输出
|
方案 B:grubby 内核参数(RHEL / AlmaLinux / Rocky 系)
⚠️ RHEL 系 algif_aead 为内置模块,modprobe.d 无效,必须用此方案。
1
2
3
4
| sudo grubby --update-kernel=ALL --args="initcall_blacklist=algif_aead_init"
sudo reboot
# 重启后验证
sudo grubby --info=ALL | grep initcall_blacklist
|
3.3 安装修复补丁
Ubuntu / Debian
1
2
3
| sudo apt update && sudo apt upgrade -y linux-image-$(uname -r)
sudo reboot
uname -r
|
RHEL / AlmaLinux 9
1
2
3
| sudo dnf install -y https://repo.almalinux.org/almalinux/9/extras/x86_64/os/Packages/almalinux-release-testing-9-1.el9.noarch.rpm
sudo dnf update kernel -y && sudo reboot
sudo dnf config-manager --disable almalinux-testing
|
RHEL / AlmaLinux 10
1
2
3
| sudo dnf install -y https://repo.almalinux.org/almalinux/10/extras/x86_64/os/Packages/almalinux-release-testing-10-1.el10.x86_64.rpm
sudo dnf update kernel -y && sudo reboot
sudo dnf config-manager --disable almalinux-testing
|
Amazon Linux 2023
1
| sudo yum update kernel -y && sudo reboot
|
SUSE / openSUSE
1
| sudo zypper update kernel-default -y && sudo reboot
|
3.4 打完补丁后撤销临时缓解
1
2
3
4
5
6
| # Debian 系
sudo rm /etc/modprobe.d/disable-algif.conf && sudo update-initramfs -u
# RHEL 系
sudo grubby --update-kernel=ALL --remove-args="initcall_blacklist=algif_aead_init"
sudo reboot
|
3.5 Kubernetes / 容器环境
⚠️ 修复必须在宿主机上操作,不能只在容器内。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
| # patch-copy-fail.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: patch-copy-fail-cve
namespace: default
spec:
selector:
matchLabels:
app: patch-copy-fail-cve
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: patch-copy-fail-cve
spec:
hostPID: true
priorityClassName: system-node-critical
volumes:
- name: root-mount
hostPath:
path: /
type: Directory
initContainers:
- name: patch-copy-fail-cve
image: busybox:1.36.1
command: ["/bin/sh", "-c"]
args:
- |
tee /host/etc/modprobe.d/disable-algif-aead.conf <<<'install algif_aead /bin/false'
chroot /host rmmod algif_aead 2>/dev/null || true
chroot /host update-initramfs -u
securityContext:
privileged: true
runAsUser: 0
volumeMounts:
- name: root-mount
mountPath: /host
containers:
- name: pause
image: registry.k8s.io/pause:3.10.1
|
1
| kubectl apply -f patch-copy-fail.yaml
|
四、各方案对比
| 方案 |
需要重启 |
效果 |
适用场景 |
rmmod algif_aead |
否 |
立即生效,重启失效 |
Debian 系,模块可卸载 |
modprobe.d 禁用 |
需更新 initramfs |
持久有效 |
Debian 系 |
grubby 内核参数 |
需要 |
持久有效 |
RHEL 系(built-in 内核) |
| 升级内核(推荐) |
需要 |
根本修复 |
所有发行版 |
| KernelCare livepatch |
不需要 |
根本修复 |
订阅用户 |
五、影响范围说明
禁用 algif_aead 不影响:dm-crypt/LUKS、kTLS、IPsec/XFRM、OpenSSL/GnuTLS/NSS(默认配置)、SSH。
检查当前是否有程序依赖:
1
2
| lsof | grep AF_ALG
# 无输出 → 可安全禁用
|
六、参考资料
Support the Creator
If you found this article helpful, consider supporting.