CVE-2026-31431(Copy Fail)C 语言 PoC,逻辑对齐 theori-io/copy-fail-CVE-2026-31431 原版 Python exploit。
仅用于已授权的安全研究与实验环境。禁止在未授权系统上使用。
Linux AF_ALG 中 authencesn(hmac(sha256),cbc(aes)) 在 splice + AEAD 路径下,可将 AAD 里 4 字节写入目标文件页缓存(磁盘内容不变)。
本仓库 exploit 行为与原版一致:
/usr/bin/su 页缓存逐 4 字节写入 zlib 解压后的微型 ELFsu,由被篡改的页缓存加载假 su,通常无需密码即可获得 root shellcopy-fail/
├── include/
│ ├── copy_fail.h
│ └── su_payload_zlib.h
├── src/
│ ├── alg.c # AF_ALG / splice 原语
│ ├── util.c # 前置检查
│ ├── test_main.c # 漏洞检测
│ └── exploit_main.c # 提权
├── Makefile
└── README.md
Ubuntu / Debian:
sudo apt install build-essential zlib1g-dev
cd copy-fail
make
生成:
| 产物 | 说明 |
|---|---|
bin/copy-fail-test | 漏洞检测(临时 sentinel 文件,不修改系统文件) |
bin/copy-fail-exploit | 提权(修改 /usr/bin/su 页缓存后 exec su) |
在高版本系统上编译后,若出现 GLIBC_2.34 / GLIBC_2.38 not found,在编译机执行:
make static
将 bin/copy-fail-test、bin/copy-fail-exploit 拷到目标机运行。也可在目标机上对源码执行 make(动态链接,体积更小)。
./bin/copy-fail-test
echo $?
| 退出码 | 含义 |
|---|---|
| 0 | 未表现出漏洞特征 / 前置条件不满足 |
| 2 | 存在漏洞特征 |
| 1 | 测试过程出错 |
./bin/copy-fail-exploit
id
无输出为正常设计;成功则进入 root shell。失败时 echo $? 一般为 1。
AF_ALG socketbind 算法 authencesn(hmac(sha256),cbc(aes))/usr/bin/su 有读权限splice 可写入 AF_ALG socket若检测器提示 cannot be instantiated (No such file or directory):
grep -r algif_aead /etc/modprobe.d/
sudo modprobe algif_aead
grep authencesn /proc/crypto
部分发行版通过 modprobe 禁用 algif_aead(如 Ubuntu USN 缓解),需在有 root 的实验机上解除后再测。
提权测试后(root shell 中)可丢弃页缓存污染:
echo 3 > /proc/sys/vm/drop_caches
或重启虚拟机。