Copy Fail Detection and Remediation(复制故障检测与修复)
一套用于检测和修复 CVE-2026-31431(复制故障)的 Ansible 角色和剧本套件,该漏洞是 Linux 内核 algif_aead 模块中的一个严重本地权限提升漏洞。
🔗 GitHub: https://github.com/parmstro/cfDr
cfDr 这个名称是 "Copy Fail Doctor"(复制故障医生)的谐音——它是您应对 CVE-2026-31431 的可靠良方。
CVE-2026-31431(CVSS 7.8)是 2026 年发现的 Linux 内核 AEAD 套接字接口(AF_ALG)中的一个逻辑缺陷。该漏洞允许任何非特权本地用户在数秒内将权限提升至 root。
algif_aead 内核模块(AF_ALG 加密接口)内核版本:Linux 内核 >= 4.10(2017 年发布)
受影响的发行版:
注意:任何使用内核 4.10 或更高版本的 Linux 发行版都可能存在漏洞。
该漏洞特别危险,原因如下:
一旦攻击者获得任何形式的本地访问权限(SSH、Web Shell、容器逃逸等),他们就可以:
在等待厂商提供内核补丁期间,有多种缓解策略可供使用。cfDr 实现了所有这些策略,并根据您的系统配置提供智能推荐。
并非所有修复方案效果相同。以下内容您需要了解:
| 方法 | Root 能否绕过? | 覆盖范围 | 企业级 Linux 支持 |
|---|---|---|---|
| 模块黑名单 | ✅ 可以(通过 insmod) | 阻止 modprobe 加载 | 所有版本 |
| SELinux 策略 | ❌ 不能(LSM 层) | 仅限已配置的域 | 所有版本(默认) |
| systemd seccomp | ❌ 不能(系统调用过滤器) | 仅限已配置的服务 | 所有版本 |
| eBPF LSM | ❌ 不能(LSM 层) | 系统范围(若已配置) | RHEL 9+、Fedora 34+ |
cfDr 的默认推荐:标志 3(模块黑名单 + SELinux)
这提供了两个独立的防护层:``` ┌─────────────────────────────────────────────────┐ │ Layer 1: Module Blacklist │ │ • Prevents modprobe algif_aead │ │ • Persists across reboots │ │ • CAN be bypassed by malicious root (insmod) │ ├─────────────────────────────────────────────────┤ │ Layer 2: SELinux Policy │ │ • Blocks AF_ALG socket() at syscall level │ │ • Works even if module is loaded │ │ • CANNOT be bypassed from userspace │ │ • Covers user_t, unconfined_t (majority cases) │ └─────────────────────────────────────────────────┘
Result: If either layer fails, the other still protects
### 为什么仅靠模块黑名单是不够的
拥有 root 权限的坚定攻击者可以绕过模块黑名单:```bash
# Module blacklist DOES NOT prevent:
insmod /lib/modules/$(uname -r)/kernel/crypto/algif_aead.ko.xz
然而,这是可以接受的,因为:
要实现完整、不可绕过的防护,你需要:
模块黑名单 + 以下至少一项:
cfDr 使用位标志来启用多种缓解措施:
| 标志值 | 已启用的缓解措施 | 使用场景 |
|---|---|---|
| 1 | 仅模块黑名单 | 最低防护,适用于没有 SELinux 的系统 |
| 2 | 仅 SELinux | 仅 SELinux 环境 |
| 3 | 模块黑名单 + SELinux | 推荐默认值 |
| 5 | 模块黑名单 + seccomp | 非 SELinux 环境,带服务加固 |
| 7 | 模块黑名单 + SELinux + seccomp | 增强防护 |
| 15 | 所有缓解措施 | 最高防护(仅限 RHEL 9+) |
计算标志:1(黑名单)+ 2(SELinux)+ 4(seccomp)+ 8(eBPF)= 总和
SELinux 防护:
user_t、unconfined_t、httpd_t、postgresql_t、mysqld_tuser_t 和 unconfined_t 覆盖了绝大多数攻击场景systemd seccomp 防护:
httpd、nginx、postgresql、mariadb、redis、memcachedeBPF LSM 防护:
cfDr 在多个维度上执行全面评估:
uname -r
- 判断内核版本是否 >= 4.10(受影响范围)
- 识别内核发行版本及发行版信息
#### 2. 模块可用性检查```bash
modinfo algif_aead
algif_aead 模块lsmod | grep algif_aead
- 确定模块当前是否已加载
- **关键**:已加载模块 = 可主动利用
#### 4. 活动套接字检测```bash
lsof -U | grep AF_ALG
模块黑名单:```bash grep -E "blacklist algif_aead|install algif_aead" /etc/modprobe.d/*.conf
**SELinux 策略**:```bash
semodule -l | grep cve_2026_31431_af_alg_deny
systemd seccomp:```bash systemctl show | grep RestrictAddressFamilies
#### 6. 分类状态判定
cfDr 将每台主机归类为以下状态之一:
| 状态 | 条件 | 所需操作 |
|--------|-----------|-----------------|
| **易受攻击 - 模块已加载** | 内核 >= 4.10,模块存在且已加载 | **立即处理** - 可主动利用 |
| **易受攻击 - 模块存在** | 内核 >= 4.10,模块存在但未加载 | **高优先级** - 可加载并利用 |
| **已缓解 - 模块被列入黑名单** | 检测到黑名单 | **低优先级** - 监控,应用额外防护层 |
| **已防护 - 纵深防御** | 黑名单 + SELinux/seccomp/eBPF | **无需处理** - 完全防护 |
| **不易受攻击 - 内核过旧** | 内核 < 4.10 | **无需处理** - 早于漏洞出现时间 |
| **不易受攻击 - 无模块** | 内核中无 algif_aead 模块 | **无需处理** - 模块不可用 |
### 评估输出
每台主机将获得:
1. **控制台输出**:简短的单行状态
2. **详细文件**:`/root/cve-2026-31431-assessment-<hostname>.txt`
3. **JSON 报告**:`/tmp/cve-2026-31431-<hostname>.json`
简短输出示例:```
webserver1.example.com: VULNERABLE - Module exists and can be loaded
dbserver2.example.com: PROTECTED - Defense-in-depth (Module Blacklist + SELinux)
appserver3.example.com: NOT VULNERABLE - Module not available
cfDr 是一个现代的 Ansible 角色,包含多个 playbook 入口点:``` cfDr/ ├── roles/ │ └── cve_2026_31431/ # Main role │ ├── tasks/ │ │ ├── main.yml # Role orchestration │ │ ├── assessment.yml # Vulnerability detection │ │ ├── remediation_module_blacklist.yml │ │ ├── remediation_selinux.yml │ │ ├── remediation_seccomp.yml │ │ ├── remediation_ebpf.yml │ │ ├── reporting.yml # Status reporting │ │ └── inventory_update.yml # Inventory generation │ ├── templates/ # Config file templates │ ├── defaults/ # Default variables │ └── handlers/ # Service restarts, etc. ├── quickstart.yml # Simplest usage ├── sample_playbook.yml # Multiple examples └── cve_2026_31431_playbook.yml # Full-featured playbook
### 执行流程
#### 评估模式(默认)```
1. Pre-flight checks
↓
2. Gather system facts
↓
3. Detect kernel version
↓
4. Check module availability
↓
5. Check current load status
↓
6. Check existing mitigations
↓
7. Determine vulnerability status
↓
8. Flag vulnerable hosts
↓
9. Generate reports
↓
10. Create summary
↓
11. [Optional] Generate inventory
apply_remediation=true)```1-8. [Same as Assessment Mode] ↓ 9. Apply Module Blacklist (if flag 1) • Unload module if loaded • Create blacklist config • Update initramfs/initrd • Verify blacklist works ↓ 10. Apply SELinux Policy (if flag 2) • Install policy packages • Compile policy module • Install policy • Verify policy active ↓ 11. Apply systemd seccomp (if flag 4) • Create drop-in files • Reload systemd • Restart services • Verify filters active ↓ 12. Apply eBPF LSM (if flag 8) • Compile eBPF program • Load into kernel • Verify program attached ↓ 13. Re-assess protection status ↓ 14. Generate reports ↓ 15. Create summary
### 修复详情
#### 模块黑名单(标志 1)
**功能说明**:
1. 如果 `algif_aead` 模块当前已加载,则将其卸载(`rmmod algif_aead`)
2. 创建 `/etc/modprobe.d/blacklist-algif_aead-cve-2026-31431.conf`: ```
blacklist algif_aead
install algif_aead /bin/true
update-initramfs -udracut -fmodprobe 加载防护:即时生效,无需重启 持久性:在重启和内核更新后仍然有效
功能说明:
policycoreutilspolicycoreutils-python-utilsselinux-policy-develcheckpolicysemodule -i cve_2026_31431_af_alg_deny.pp受保护的域(默认):
user_t - 普通用户进程unconfined_t - 不受限制的进程httpd_t - Apache Web 服务器postgresql_t - PostgreSQL 数据库mysqld_t - MySQL/MariaDB 数据库防护:在 LSM 层阻止,无法绕过 持久性:策略在重启后仍然有效
功能说明:
/etc/systemd/system/<service>.service.d/90-cve-2026-31431-block-af-alg.confRestrictAddressFamilies=~AF_ALG 指令受保护的服务(默认):
httpd、nginx - Web 服务器postgresql、mariadb - 数据库redis、memcached - 缓存服务器防护:在系统调用层面按服务阻止套接字创建 持久性:在重启和服务更新后仍然有效
功能说明:
要求:
CONFIG_BPF_LSM=y防护:动态、可编程的系统级策略 持久性:需要系统服务在启动时重新加载
cfDr 可以生成仅包含易受攻击主机的即用型清单文件:
生成的文件:``` inventory_output/ ├── vulnerable_hosts.yml # YAML inventory ├── vulnerable_hosts.ini # INI inventory ├── group_vars_vulnerable_hosts.yml # Group variables └── host_vars/ ├── host1.yml # Per-host details └── host2.yml
**包含内容**:
- 漏洞评估结果
- 推荐的缓解标志(按主机计算)
- 系统详细信息(内核版本、SELinux 状态)
- 可直接应用的修复设置
**智能建议**:
- 标志 3(模块黑名单 + SELinux):如果 SELinux 已启用
- 标志 1(仅模块黑名单):如果 SELinux 不可用
- 可通过生成的 `host_vars` 按主机自定义
---
## 对系统加密的影响
### 关键发现:标准 RHEL 加密不受影响
**置信度**:⭐⭐⭐⭐⭐ **高** - 请参阅 [IPsec/XFRM 验证报告](https://github.com/parmstro/cfdr/blob/HEAD/docs/IPSEC_VALIDATION.md) 获取全面分析
**对 Enterprise Linux 部署的好消息:** 根据包括 [CERT-EU](https://cert.europa.eu/publications/security-advisories/2026-005/)、[CloudLinux](https://blog.cloudlinux.com/cve-2026-31431-copy-fail-mitigation-and-patches) 和 [HPCsec](https://www.hpcsec.com/2026/04/30/advisory-cve-2026-31431-copy-fail-local-privilege-escalation-via-af-alg-algif_aead/) 在内的权威来源,**cfDr 的缓解措施对标准 RHEL 系统加密和服务的影响极小甚至为零**。
### 不受影响的内容
以下关键的 RHEL 加密系统**不使用 AF_ALG**,完全不受我们的修复措施影响:
#### 核心系统服务
| 服务/组件 | 功能 | 状态 |
|------------------|----------|--------|
| **dm-crypt / LUKS** | 全盘加密 | ✅ 不受影响 |
| **IPsec / XFRM** | VPN 和加密网络 | ✅ 不受影响([已验证](https://github.com/parmstro/cfdr/blob/HEAD/docs/IPSEC_VALIDATION.md)) |
| **kTLS** | 内核 TLS 实现 | ✅ 不受影响 |
| **SSH** | 安全 Shell 连接 | ✅ 不受影响 |
#### 加密库
| 库 | 用途 | 状态 |
|---------|-------|--------|
| **OpenSSL**(默认) | SSL/TLS、证书、通用加密 | ✅ 不受影响 |
| **GnuTLS**(默认) | TLS 实现 | ✅ 不受影响 |
| **NSS** | Mozilla 网络安全服务 | ✅ 不受影响 |
| **内核密钥环** | 内核密钥管理 | ✅ 不受影响 |
#### 关键基础设施
- ✅ **SSL/TLS** - 所有 Web 服务器加密不受影响
- ✅ **HTTPS** - 安全 Web 流量不受影响
- ✅ **电子邮件加密**(S/MIME、PGP)- 不受影响
- ✅ **证书操作** - 不受影响
- ✅ **数据库加密** - 不受影响
- ✅ **备份加密** - 不受影响
### 为什么标准服务不使用 AF_ALG
如 [Linux 内核加密文档](https://www.kernel.org/doc/html/v4.11/crypto/userspace-if.html) 所述,**AF_ALG 是内核加密的用户空间套接字接口**,于 Linux 2.6.38 中引入。然而,大多数 RHEL 系统服务**直接**使用内核加密 API,而非通过 AF_ALG 套接字层。
根据 [CERT-EU 的安全公告](https://cert.europa.eu/publications/security-advisories/2026-005/):
> “dm-crypt / LUKS、kTLS、IPsec、SSH 以及默认的 OpenSSL / GnuTLS 构建不依赖 AF_ALG,不受 AF_ALG 限制的影响。”
架构如下所示:```
┌─────────────────────────────────────────────┐
│ Userspace Applications │
├─────────────────────────────────────────────┤
│ Standard Crypto Libraries │
│ (OpenSSL, GnuTLS, NSS) │
│ │ │
│ └─────> In-Kernel Crypto API ──────────┐ │
│ (Direct access) │ │
├──────────────────────────────────────────┼──┤
│ AF_ALG Socket Interface (RARELY USED) │ │
│ │ │ │
│ └─────> In-Kernel Crypto API ──────────┘ │
├─────────────────────────────────────────────┤
│ Kernel Crypto Subsystem │
│ (AES, SHA, AEAD algorithms) │
└─────────────────────────────────────────────┘
Standard services bypass AF_ALG entirely
“对于大多数 HPC 环境,这不会破坏任何东西——AF_ALG 是内核加密的用户空间入口,实际上几乎没有任何东西会使用它。”
只有以下这些极其罕见的配置可能会受到影响:
在 RHEL 上并非默认配置。 必须显式配置 afalg 引擎:```bash
openssl engine afalg
**用例:** 硬件加密加速卸载
**普遍性:** 在标准部署中极为罕见
**影响:** 应用程序回退到软件加密
#### 2. 使用 libkcapi 的自定义应用程序
使用专用库进行**直接 AF_ALG 套接字编程**。
**用例:** 专用安全工具或自定义加密应用程序
**普遍性:** 在标准企业环境中几乎不存在
**影响:** 特定于应用程序,需要修改代码
#### 3. 硬件加密卸载工具
使用 AF_ALG 实现硬件加速的**专用工具**。
**用例:** 高性能计算、加密硬件加速器
**普遍性:** 仅存在于专业的高安全性或 HPC 环境中
**影响:** 回退到软件加密
### Red Hat 官方立场
根据 [Red Hat Bugzilla #2460538](https://bugzilla.redhat.com/show_bug.cgi?id=2460538):
- **CVE:** CVE-2026-31431
- **严重性:** 高(CVSS 7.8)
- **状态:** 已在内核 6.19.12+ 中修复
- **修复方案:** 回退 2017 年的原地优化(提交 72548b093ee3)
- **影响:** “在 algif_aead 中原地操作没有益处,因为源和目标来自不同的映射”
### 按缓解标志划分的影响评估
| 标志 | 缓解措施 | 对标准服务的影响 |
|------|------------|----------------------------|
| 1 | 模块黑名单 | ✅ 零影响 - 未使用 AF_ALG |
| 2 | SELinux 策略 | ✅ 零影响 - 阻止未使用的系统调用 |
| **3** | **黑名单 + SELinux** | ✅ **零影响 - 推荐** |
| 5 | 黑名单 + seccomp | ✅ 零影响 - 按服务安全 |
| 7 | 黑名单 + SELinux + seccomp | ✅ 零影响 - 纵深防御 |
| 15 | 所有缓解措施 | ✅ 零影响 - 最大保护 |
### 修复后验证
应用 cfDr 缓解措施后,验证关键服务是否继续正常运行:```bash
# Test SSH connectivity
ssh localhost echo "SSH working"
# Test HTTPS (if web server running)
curl -k https://localhost
# Test LUKS encryption (if using encrypted volumes)
cryptsetup status /dev/mapper/luks-volume
# Test IPsec (if VPN configured)
ipsec status
# Test system services
systemctl status sshd
systemctl status httpd
systemctl status postgresql
# Check for any service failures
systemctl --failed
预期结果: 所有服务继续正常运行。
多个权威安全组织确认了我们的评估:
CERT-EU(2026年4月30日):
“dm-crypt / LUKS、kTLS、IPsec、SSH 以及默认的 OpenSSL / GnuTLS 构建不依赖 AF_ALG”
Sysdig(2026年4月29日):
文档说明标准加密操作使用内核内 API,而非 AF_ALG 套接字
R-fx Networks(2026年5月2日):
“托管工作负载不会合法使用 AF_ALG,因此将其禁用作为缓解措施是安全的,不会影响生产服务”
HPCsec(2026年4月30日):
“对于大多数 HPC 环境,这不会破坏任何东西——AF_ALG 是内核加密的用户空间入口,实际上几乎没有人使用它”
适用于标准 RHEL/CentOS/Fedora 环境:
决策矩阵:
| 您的环境 | 建议 | 原因 |
|---|---|---|
| 标准 RHEL 服务器 | 立即部署标志 3 | 零影响,即时防护 |
| 使用自定义加密的 RHEL | 先审计 AF_ALG 使用情况 | 可能性极低,但仍需验证 |
| 开发系统 | 立即部署标志 3 | 与生产环境相同 |
| 高安全环境 | 部署标志 7 或 15 | 最大纵深防御 |
cfDr 的修复措施对所有标准 RHEL 部署都是安全的。 algif_aead 模块和 AF_ALG 套接字接口不被 Enterprise Linux 系统上的任何关键系统加密所使用。
这意味着:
唯一理论上的风险是针对明确编程使用 AF_ALG 套接字的自定义应用程序——这种情况极为罕见,多个安全组织已独立确认在企业环境中阻止 AF_ALG 是安全的。
该工作流程在全面性与运维安全性之间取得平衡:
ansible-playbook -i inventory quickstart.yml
**会发生什么**:
- 评估所有主机
- 不做任何更改
- 生成报告
**审查**:
- 检查每台主机上的 `/root/cve-2026-31431-assessment-<hostname>.txt`
- 查看摘要输出
- 识别存在漏洞的主机
**预期输出**:```
CVE-2026-31431 Summary Report
==========================================
Total hosts scanned: 50
Vulnerable hosts: 12
VULNERABLE HOSTS REQUIRING REMEDIATION:
web1.example.com, web2.example.com, db1.example.com, ...
DEFAULT RECOMMENDED MITIGATION: Flag 3
- Module Blacklist (1) + SELinux (2) = Defense-in-depth
- Module Blacklist alone can be bypassed by root (via insmod)
- SELinux blocks syscall even if blacklist is bypassed
- Covers user_t/unconfined_t (vast majority of scenarios)
ansible-playbook -i inventory quickstart.yml -e generate_inventory=true -e inventory_output_dir=./vulnerable_hosts
**会发生什么**:
- 识别出存在漏洞的主机
- 为每台主机计算推荐的缓解标志
- 生成清单文件
**审查**:```bash
# Check generated inventory
cat vulnerable_hosts/vulnerable_hosts.yml
# Review per-host recommendations
ls vulnerable_hosts/host_vars/
ansible-playbook -i vulnerable_hosts/vulnerable_hosts.yml cve_2026_31431_playbook.yml
-e apply_remediation=true
--limit 'dev*:test*'
**发生的情况**:
- 仅对测试/开发主机应用缓解措施
- 重启服务(针对 seccomp)
- 已执行验证
**验证**:```bash
# Re-scan test hosts
ansible-playbook -i vulnerable_hosts/vulnerable_hosts.yml quickstart.yml --limit 'dev*:test*'
# Check for "PROTECTED - Defense-in-depth" status
测试应用:
ansible-playbook -i vulnerable_hosts/vulnerable_hosts.yml cve_2026_31431_playbook.yml
-e apply_remediation=true
--limit 'web*'
ansible-playbook -i vulnerable_hosts/vulnerable_hosts.yml cve_2026_31431_playbook.yml
-e apply_remediation=true
--limit 'app*'
ansible-playbook -i vulnerable_hosts/vulnerable_hosts.yml cve_2026_31431_playbook.yml
-e apply_remediation=true
--limit 'db*'
**会发生什么**:
- 每个层级单独修复
- 服务一次重启一个层级
- 允许分阶段验证
**在阶段之间进行监控**:
- 检查服务可用性
- 查看应用程序日志
- 验证用户体验
#### 第 5 步:验证与文档记录```bash
# Final assessment of all hosts
ansible-playbook -i inventory quickstart.yml
文档:
Total hosts scanned: 50 Vulnerable hosts: 0
All hosts protected with defense-in-depth mitigations
### 应急响应工作流程
针对**正在被利用**的系统或**即时威胁**:```bash
# Immediate assessment and remediation
ansible-playbook -i inventory quickstart.yml -e apply_remediation=true -e mitigation_flags=3
# Re-verify all hosts
ansible-playbook -i inventory quickstart.yml
在以下情况下使用此方法:
注意:此操作会同时对所有易受攻击的主机应用缓解措施。请密切监控。
对于持续合规和新系统检测:```bash
0 2 * * 0 ansible-playbook -i inventory quickstart.yml -e generate_inventory=true
**集成对象**:
- 配置管理数据库(CMDB)
- 安全信息和事件管理(SIEM)
- 用于修复跟踪的工单系统
### 自定义缓解工作流
对于超出 Flag 3 的**特定需求**:```bash
# Use enhanced protection (Flag 7: Blacklist + SELinux + seccomp)
ansible-playbook -i inventory quickstart.yml \
-e apply_remediation=true \
-e mitigation_flags=7
# Or customize per-host via inventory
# Edit generated host_vars/*.yml files to set custom flags
vim vulnerable_hosts/host_vars/web1.example.com.yml
# Change: recommended_mitigation_flags: 7
# Apply customized settings
ansible-playbook -i vulnerable_hosts/vulnerable_hosts.yml cve_2026_31431_playbook.yml \
-e apply_remediation=true
修复后,验证防护措施:```bash
sudo lsmod | grep algif_aead
sudo modprobe algif_aead
cat /etc/modprobe.d/blacklist-algif_aead-cve-2026-31431.conf
sudo semodule -l | grep cve_2026_31431
systemctl show httpd | grep RestrictAddressFamilies
---
## 快速开始
对于希望立即上手的用户:
### 最简单的用法```bash
# Clone repository
git clone https://github.com/parmstro/cfDr.git
cd cfDr
# Step 1: Assess all hosts
ansible-playbook -i inventory quickstart.yml
# Step 2: Apply recommended mitigations to vulnerable hosts
ansible-playbook -i inventory quickstart.yml --limit vulnerable_hosts -e apply_remediation=true
ansible-playbook -i /path/to/your/inventory quickstart.yml
ansible-playbook -i /path/to/your/inventory quickstart.yml
--limit vulnerable_hosts
-e apply_remediation=true
### 生成漏洞清单```bash
# Scan and create inventory of vulnerable hosts
ansible-playbook -i inventory quickstart.yml -e generate_inventory=true
# Review generated files
ls inventory_output/
# Apply mitigations using generated inventory
ansible-playbook -i inventory_output/vulnerable_hosts.yml cve_2026_31431_playbook.yml \
-e apply_remediation=true
按剧本运行覆盖默认缓解措施:```bash
ansible-playbook quickstart.yml -e apply_remediation=true -e mitigation_flags=1
ansible-playbook quickstart.yml -e apply_remediation=true -e mitigation_flags=2
ansible-playbook quickstart.yml -e apply_remediation=true -e mitigation_flags=3
ansible-playbook quickstart.yml -e apply_remediation=true -e mitigation_flags=7
ansible-playbook quickstart.yml -e apply_remediation=true -e mitigation_flags=15
### 自定义 SELinux 域
编辑 `roles/cve_2026_31431/defaults/main.yml`:```yaml
# Add additional domains to protect
selinux_denied_domains:
- user_t
- unconfined_t
- httpd_t
- postgresql_t
- mysqld_t
- custom_app_t # Your custom domain
- another_service_t
编辑 roles/cve_2026_31431/defaults/main.yml:```yaml
seccomp_protected_services:
### 自定义库存输出目录```bash
# Specify custom output location
ansible-playbook quickstart.yml \
-e generate_inventory=true \
-e inventory_output_dir=/path/to/output
sample_playbook.yml 包含多个示例:```yaml
### 要求
- **Ansible**:2.9 或更高版本(推荐 2.15+)
- **特权访问**:目标主机上需要 sudo/root 权限
- **Python**:目标主机上需要 2.7 或 3.5+ 版本
- **支持的操作系统**:Red Hat Enterprise Linux、CentOS、Fedora(Debian/Ubuntu 支持有限)
---
## 其他资源
### CVE 信息与分析
**官方来源**:
- [NVD - CVE-2026-31431](https://nvd.nist.gov/vuln/detail/CVE-2026-31431)
- [MITRE CVE 条目](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-31431)
**安全研究与分析**:
- [Sysdig - CVE-2026-31431 分析](https://www.sysdig.com/blog/cve-2026-31431-copy-fail-linux-kernel-flaw-lets-local-users-gain-root-in-seconds)
- [The Hacker News - Copy Fail 漏洞](https://thehackernews.com/2026/04/new-linux-copy-fail-vulnerability.html)
- [CERT-EU 安全公告](https://cert.europa.eu/publications/security-advisories/2026-005/)
- [Help Net Security - Copy Fail 详情](https://www.helpnetsecurity.com/2026/04/30/copyfail-linux-lpe-vulnerability-cve-2026-31431/)
### 相关缓解项目
社区对 CVE-2026-31431 缓解的贡献:
- **[block-copyfail](https://github.com/atgreen/block-copyfail)** - Anthony Green 编写的 eBPF LSM 实现
- 基于 eBPF 的全面缓解方案
- 为现代内核提供系统级保护
- cfDr 的 eBPF 实现来源
- **[Blastwall](https://gprocunier.github.io/blastwall/demo.html)** - Greg Procunier 编写的 SELinux 策略框架
- 高级 SELinux 策略管理
- 多 CVE 防护框架
- cfDr 的 SELinux 实现来源
### Red Hat 特定资源
**知识库文章**:
- [Red Hat 客户门户 - CVE-2026-31431](https://access.redhat.com/security/cve/cve-2026-31431)
- [Red Hat 安全数据 - 受影响产品](https://access.redhat.com/security/data/metrics/)
**缓解指南**:
- [Enterprise Linux 的 SELinux - 用户指南](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/using_selinux/)
- [systemd 安全功能](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_systems_using_the_rhel_9_web_console/securing-systemd-services_system-management-using-the-rhel-9-web-console)
### 文档
**cfDr 扩展文档**:
- [Enterprise Linux 缓解指南](https://github.com/parmstro/cfdr/blob/HEAD/enterprise-linux-mitigations.md) - 所有缓解方法的全面对比
- [SELinux 缓解指南](https://github.com/parmstro/cfdr/blob/HEAD/selinux-mitigation.md) - 详细的 SELinux 策略实现
- [seccomp 缓解指南](https://github.com/parmstro/cfdr/blob/HEAD/seccomp-mitigation.md) - systemd seccomp 过滤器实现
- [eBPF LSM 缓解指南](https://github.com/parmstro/cfdr/blob/HEAD/ebpf-lsm-mitigation.md) - eBPF LSM 程序实现
- [docs/CONTRIBUTORS.md](https://github.com/parmstro/cfdr/blob/HEAD/CONTRIBUTORS.md) - 贡献指南与致谢
**Ansible 文档**:
- [Ansible 用户指南](https://docs.ansible.com/ansible/latest/user_guide/)
- [Ansible 最佳实践](https://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html)
---
## 补丁监控
### Red Hat Enterprise Linux
**主要来源**:Red Hat 客户门户
- **安全公告**:https://access.redhat.com/security/security-updates/
- **勘误公告**:https://access.redhat.com/errata/
- **CVE 跟踪器**:https://access.redhat.com/security/cve/cve-2026-31431
**通知方式**:
1. **电子邮件提醒**(推荐):
- 登录 Red Hat 客户门户
- 导航至:账户设置 → 通知
- 启用:“安全公告”和“产品勘误”
- 选择:您管理的 RHEL 版本
2. **RSS 订阅**:
- RHEL 7 安全:https://access.redhat.com/blogs/766093/feed
- RHEL 8 安全:https://access.redhat.com/blogs/1683903/feed
- RHEL 9 安全:https://access.redhat.com/blogs/5480361/feed
- 全部安全:https://access.redhat.com/security/data/oval/com.redhat.rhsa-all.xml
3. **API 访问**: ```bash
# Check for kernel security updates
curl -H "Accept: application/json" \
"https://access.redhat.com/labs/securitydataapi/cve/CVE-2026-31431.json"
自动化监控: ```bash
sudo yum install yum-plugin-security
sudo yum updateinfo list security
sudo yum updateinfo list security kernel
查找内容:
公告格式示例:``` RHSA-2026:XXXX - Important: kernel security update Severity: Important CVEs: CVE-2026-31431 Affected Products: RHEL 7, 8, 9
### CentOS / Rocky Linux / AlmaLinux
**CentOS Stream**:
- **公告**:https://lists.centos.org/pipermail/centos-announce/
- **安全邮件列表**:https://lists.centos.org/mailman/listinfo/centos-security-announce
**Rocky Linux**:
- **安全追踪器**:https://errata.rockylinux.org/
- **公告**:https://rockylinux.org/news/
**AlmaLinux**:
- **勘误**:https://errata.almalinux.org/
- **安全**:https://wiki.almalinux.org/security/
### Fedora
**主要来源**:Fedora 项目
- **更新系统**:https://bodhi.fedoraproject.org/
- **安全列表**:https://lists.fedoraproject.org/archives/list/[email protected]/
**通知方式**:```bash
# Subscribe to security announcements
# Visit: https://lists.fedoraproject.org/admin/lists/security-announce.lists.fedoraproject.org/
# Check for updates
sudo dnf check-update kernel
# View available security updates
sudo dnf updateinfo list security
主要来源:Ubuntu 安全公告
通知方式:```bash
sudo apt update sudo apt list --upgradable | grep security
sudo apt install ubuntu-security-tools usn list --cve CVE-2026-31431
### Debian
**主要来源**:Debian 安全跟踪器
- **安全跟踪器**:https://security-tracker.debian.org/tracker/CVE-2026-31431
- **安全公告**:https://www.debian.org/security/
**通知方式**:```bash
# Subscribe to Debian Security Announcements
# Visit: https://lists.debian.org/debian-security-announce/
# Check for security updates
sudo apt update
sudo apt list --upgradable
主要来源:SUSE 安全
通知方式:```bash
sudo zypper list-patches --category security
sudo zypper info --cve CVE-2026-31431
### 上游内核
**Linux 内核邮件列表**:
- **LKML 存档**:https://lkml.org/
- **安全列表**:https://www.kernel.org/category/releases.html
**Git 仓库**:```bash
# Monitor kernel git for patches
git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
# Search for CVE-2026-31431 patches
git log --all --grep="CVE-2026-31431"
为您的环境创建一个监控脚本:```bash #!/bin/bash
DISTRO=$(grep ^ID= /etc/os-release | cut -d= -f2 | tr -d '"')
case $DISTRO in rhel|centos|rocky|alma) yum updateinfo list security kernel 2>/dev/null | grep -i CVE-2026-31431 ;; fedora) dnf updateinfo list security kernel 2>/dev/null | grep -i CVE-2026-31431 ;; ubuntu|debian) apt-get update -qq apt-cache show linux-image-$(uname -r) | grep CVE-2026-31431 ;; sles|opensuse*) zypper info --cve CVE-2026-31431 kernel-default ;; esac
curl -s "https://access.redhat.com/labs/securitydataapi/cve/CVE-2026-31431.json" |
jq -r '.affected_release[] | select(.package | startswith("kernel")) |
"(.product_name): (.advisory) - (.package)"'
**使用 cron 进行调度**:```bash
# Check daily for patches
0 6 * * * /usr/local/bin/check-cve-2026-31431-patch.sh | mail -s "CVE-2026-31431 Patch Check" [email protected]
确认补丁是否可用: ```bash
sudo yum check-update kernel # RHEL/CentOS/Fedora sudo apt update && apt list --upgradable linux-image-* # Ubuntu/Debian
查看发布说明:
在非生产环境中测试: ```bash
sudo yum update kernel # RHEL/CentOS/Fedora sudo apt upgrade linux-image-* # Ubuntu/Debian sudo reboot
验证补丁有效性: ```bash
uname -r
ansible-playbook -i inventory quickstart.yml
规划生产环境部署:
移除临时缓解措施(可选): ```bash
sudo rm /etc/modprobe.d/blacklist-algif_aead-cve-2026-31431.conf sudo semodule -r cve_2026_31431_af_alg_deny # SELinux policy
建议:即使在应用内核补丁之后,仍建议保留纵深防御缓解措施,以防范未来的漏洞。
发现 Bug 或有功能请求?
我们欢迎各种贡献!请参阅 docs/CONTRIBUTORS.md 了解:
cfDr 建立在安全专业人士的集体专业知识之上:
完整的贡献详情请参阅 docs/CONTRIBUTORS.md。
本项目根据 MIT 许可证提供,用于漏洞评估和修复目的。
详情请参阅 LICENSE。
重要提示:本工具在等待供应商提供内核补丁期间提供临时缓解措施。这些缓解措施可显著降低风险,但在所有场景下可能无法提供完全保护。
cfDr 按“原样”提供,不附带任何担保。请务必:
cfDr 的贡献者与维护者不对因使用本工具而导致的任何损害或数据丢失负责。
最后更新:2026-05-02T23:30:00Z