nisec-eric/cve-2026-31431
GitHub: nisec-eric/cve-2026-31431
CVE-2026-31431(Copy Fail)Linux 内核本地提权漏洞的完整研究仓库,包含多语言 PoC、漏洞检测与缓解脚本以及深度技术分析文档。
Stars: 0 | Forks: 0
# CVE-2026-31431 — "Copy Fail" 研究仓库
[]()
[]()
[](https://nvd.nist.gov/vuln/detail/CVE-2026-31431)
[](https://github.com/nisec-eric/cve-2026-31431/releases)
[](LICENSE)
## ⚠️ 免责声明
**本仓库中的所有代码和文档仅用于授权的安全研究和教育目的。**
在未经拥有或未获得明确书面授权进行测试的系统上运行漏洞利用代码是违法行为。使用本仓库即表示您对自己的行为承担全部责任。
## 概述
| 字段 | 详情 |
|---|---|
| **CVE** | CVE-2026-31431 |
| **别名** | Copy Fail |
| **类型** | Linux 内核本地提权 (LPE) / 页缓存任意写入 |
| **CVSS v3.1** | 7.8 高危 — `AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H` |
| **CWE** | CWE-669 (不同空间间的不正确资源传输) |
| **组件** | `crypto/algif_aead` — `authencesn` 加密模板 |
| **引入时间** | 2017 (提交 `72548b093ee3`) |
| **修复时间** | 主线提交 `a664bf3d603d` (2026-04-01) |
| **已修复内核版本** | v6.18.22+, v6.19.12+, v7.0+ |
| **发现者** | Xint / Theori (Taeyang Lee + Xint Code AI 辅助审计) |
| **披露时间** | 2026-04-29 — [copy.fail](https://copy.fail/) |
### 为什么 Copy Fail 与众不同
| | 典型的 Linux LPE | Copy Fail |
|---|---|---|
| 竞态条件 | 需要 | **无** |
| 特定发行版的偏移量 | 需要 | **无** |
| 可靠性 | 30–80% | **100%,单次触发** |
| 受影响的时间窗口 | 窄 | **2017 → 2026 (9 年)** |
| 磁盘文件修改 | 可能 | **无 (隐蔽)** |
| 跨容器 | 否 | **是** |
## 仓库结构
```
.
├── README.md ← You are here
├── LICENSE ← MIT
├── .gitignore
├── docs/
│ ├── analysis-report.md ← Comprehensive security analysis
│ ├── analysis-report.html ← Styled HTML version
│ ├── exploit-walkthrough.md ← Line-by-line PoC analysis
│ └── exploit-walkthrough.html ← Styled HTML version
└── poc/
├── README.md ← PoC usage guide
├── copy_fail_exp.py ← Official PoC (732 bytes, obfuscated)
├── copy_fail_exp_readable.py ← Deobfuscated + annotated version
├── copy_fail_exp_compat.py ← Python 3.6+ compat (ctypes splice)
├── copy_fail_exp_alpine.py ← Alpine Linux variant
├── copy_fail_exp.c ← C implementation (zero deps)
├── copy_fail_exp.go ← Go implementation (zero deps)
├── copy_fail_rust/ ← Rust implementation
│ ├── Cargo.toml
│ └── src/main.rs
├── check_vulnerable.py ← Vulnerability scanner
└── mitigate.sh ← One-click mitigation script
```
## 快速开始
### 下载预构建的发布版
```
# 从 GitHub Releases — 预编译二进制文件 (Linux amd64/arm64) + 所有 Python 脚本
wget https://github.com/nisec-eric/cve-2026-31431/releases/latest/download/copy-fail-go-linux.tar.gz
wget https://github.com/nisec-eric/cve-2026-31431/releases/latest/download/copy-fail-c-linux.tar.gz
wget https://github.com/nisec-eric/cve-2026-31431/releases/latest/download/copy-fail-python.tar.gz
tar xzf copy-fail-go-linux.tar.gz
tar xzf copy-fail-c-linux.tar.gz
tar xzf copy-fail-python.tar.gz
# Go 静态二进制文件 (不需要 Python)
chmod +x copy-fail-exp-amd64
./copy-fail-exp-amd64
# C 静态二进制文件
chmod +x copy-fail-exp-c-amd64
./copy-fail-exp-c-amd64
# 或者直接使用 Python 脚本
python3 check_vulnerable.py
```
### 1. 检查您的系统是否存在漏洞
```
python3 poc/check_vulnerable.py
```
### 2. 应用缓解措施 (无需重启)
```
sudo bash poc/mitigate.sh
```
这会将 `algif_aead` 内核模块加入黑名单 — 对 99% 的系统不会产生任何影响。
### 3. 正确修补 — 升级您的内核
```
# Debian/Ubuntu
sudo apt update && sudo apt upgrade linux-image-*
# RHEL/CentOS/Fedora
sudo dnf update kernel
# 重启进入修补后的 kernel
sudo reboot
```
### 4. 验证
```
python3 poc/check_vulnerable.py
# Exit code 1 = 已保护 ✓
```
## PoC 漏洞利用
| 文件 | 语言 | 依赖 | 备注 |
|---|---|---|---|
| `copy_fail_exp.py` | Python 3.10+ | 仅需 stdlib | 官方 732 字节 PoC |
| `copy_fail_exp_compat.py` | Python 3.6+ | stdlib + ctypes | 适用于 CentOS 7, AL2 等 |
| `copy_fail_exp_alpine.py` | Python 3.10+ | 仅需 stdlib | 针对 Alpine 上的 `/bin/ping` |
| `copy_fail_exp.c` | C | gcc + Linux headers | 静态二进制文件,零依赖 |
| `copy_fail_exp.go` | Go 1.21+ | 仅需 stdlib | 静态二进制文件,零依赖 |
| `copy_fail_rust/` | Rust 1.70+ | libc + flate2 crates | 静态二进制文件 |
```
# C
gcc -static -o exp ./poc/copy_fail_exp.c && ./exp
# Python
python3 poc/copy_fail_exp.py
python3 poc/copy_fail_exp_compat.py # Python < 3.10
# Go
go build -o exp ./poc/copy_fail_exp.go && ./exp
# Rust
cd poc/copy_fail_rust && cargo run --release
```
所有版本均接受一个可选参数,用于指定不同的 SUID 二进制文件作为目标:
```
python3 poc/copy_fail_exp.py /usr/bin/passwd
./exp /usr/bin/sudo
```
## 文档
### 📄 [安全分析报告](docs/analysis-report.md) ([HTML](docs/analysis-report.html))
涵盖以下内容的完整漏洞评估:
- 技术根本原因 (scatterlist 页来源,`authencesn` 临时写入)
- 受影响的版本及发行版修补状态
- 裸机 Linux、Kubernetes、Docker、WSL2 的修复方案
- 检测和监控指南 (auditd、SELinux、文件完整性)
- 披露时间线
### 📄 [漏洞利用解析](docs/exploit-walkthrough.md) ([HTML](docs/exploit-walkthrough.html))
涵盖以下内容的逐行 PoC 分析:
- 带有注释的完整反混淆源码
- 内核内部机制:`AF_ALG` socket 流程,`splice()` 页缓存交付,`sg_chain()` 机制
- 跨越 scatterlist 边界的 `authencesn` ESN 临时写入
- 载荷分析 (160 字节 ELF shellcode)
- 攻击变体:`/etc/passwd` 注入,共享库定向攻击,容器逃逸
- 攻击的局限性和边界
## 各环境影响
| 环境 | 风险 | 原因 |
|---|---|---|
| 多租户 Linux 主机 | 🔴 高 | 任何用户 → root |
| Kubernetes / 容器 | 🔴 高 | 共享页缓存 → 容器逃逸 |
| CI 运行器 (自托管) | 🔴 高 | 恶意 PR → 运行器 root |
| 云 SaaS (用户代码) | 🔴 高 | 租户 → 宿主机 root |
| 标准服务器 | 🟡 中等 | 与 Web RCE / 凭据盗取进行链式攻击 |
| 单用户笔记本电脑 | 🟢 低 | 已经是唯一用户 |
## 主要参考
- [copy.fail](https://copy.fail/) — 官方漏洞页面
- [Xint 博客 — 技术文章](https://xint.io/blog/copy-fail-linux-distributions) — 根本原因深度分析
- [NVD 条目](https://nvd.nist.gov/vuln/detail/CVE-2026-31431)
- [GitHub 公告 GHSA-2274-3hgr-wxv6](https://github.com/advisories/GHSA-2274-3hgr-wxv6)
- [内核补丁 (提交 a664bf3d603d)](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a664bf3d603d)
- [官方 PoC 仓库](https://github.com/theori-io/copy-fail-CVE-2026-31431)
- [Red Hat 公告](https://access.redhat.com/security/cve/cve-2026-31431) | [Ubuntu](https://ubuntu.com/security/CVE-2026-31431) | [SUSE](https://www.suse.com/security/cve/CVE-2026-31431.html) | [Amazon Linux](https://explore.alas.aws.amazon.com/CVE-2026-31431.html)
## 许可证
[MIT](LICENSE) — 请负责任地使用。
标签:0day, AI for Work, AI辅助漏洞挖掘, algif_aead, Copy Fail, Crypto子系统, CSV导出, CVE-2026-31431, CVSS 7.8, CWE-669, Exploit, Linux内核漏洞, LPE, Web报告查看器, x86_64, 可视化界面, 子域名枚举, 安全渗透, 容器逃逸, 底层安全, 情报收集, 日志审计, 本地提权, 漏洞研究, 系统安全, 红队武器, 网络安全, 逆向工具, 隐私保护, 零日漏洞, 页面缓存任意写, 高危漏洞