一、 漏洞 CVE-2022-50568 基础信息
漏洞信息
                                        # USB Gadget F_HID 生命周期问题

### 概述

该漏洞存在于 Linux 内核的 `f_hid` USB 小工具驱动中,涉及 `struct cdev` 与其宿主 `struct f_hidg` 的生命周期管理不当,导致潜在的 **use-after-free** 问题。

### 影响版本

漏洞影响使用 `f_hid` 驱动的 Linux 内核版本,特别是在通过 libusbgx 或 configfs 管理 USB 小工具设备时。具体修复版本未提及,但已在内核提交中修复。

### 细节

- `struct f_hidg` 中嵌套的 `struct cdev` 没有正确绑定到宿主结构体的生命周期。
- 当 `/dev/hidgN` 设备被打开时,若此时删除了对应的 USB gadget 设备,可能会导致 `cdev` 在已被释放后仍被访问。
- 漏洞可通过以下方式复现(例如使用 libusbgx 示例程序):
  ```bash
  gadget-hid
  exec 3<> /dev/hidg0
  gadget-vid-pid-remove
  exec 3<&-
  ```
- 在 gadget 删除过程中,`cdev` 被提前释放,而仍有引用存在。

### 修复方法

- 将 `cdev` 的生命周期绑定到 `struct f_hidg`。
- 使用 `cdev_device_add()` 与 `cdev_device_del()` 辅助函数统一管理设备生命周期。
- 确保设备对象的添加和删除时间与 `struct f_hidg` 保持一致,防止在访问 `/dev/hidgN` 时产生悬空指针引用。

### 影响

此漏洞可能造成 **use-after-free**,攻击者可通过操作设备节点在内核上下文中访问已经被释放的内存,可能导致系统崩溃或潜在的权限提升风险。
                                        
提示
尽管我们采用了先进的大模型技术,但其输出仍可能包含不准确或过时的信息。
神龙会尽力确保数据准确,但也请结合实际情况进行甄别与判断。
神龙祝您一切顺利!
漏洞标题
usb: gadget: f_hid: fix f_hidg lifetime vs cdev
来源:美国国家漏洞数据库 NVD
漏洞描述信息
In the Linux kernel, the following vulnerability has been resolved: usb: gadget: f_hid: fix f_hidg lifetime vs cdev The embedded struct cdev does not have its lifetime correctly tied to the enclosing struct f_hidg, so there is a use-after-free if /dev/hidgN is held open while the gadget is deleted. This can readily be replicated with libusbgx's example programs (for conciseness - operating directly via configfs is equivalent): gadget-hid exec 3<> /dev/hidg0 gadget-vid-pid-remove exec 3<&- Pull the existing device up in to struct f_hidg and make use of the cdev_device_{add,del}() helpers. This changes the lifetime of the device object to match struct f_hidg, but note that it is still added and deleted at the same time.
来源:美国国家漏洞数据库 NVD
CVSS信息
N/A
来源:美国国家漏洞数据库 NVD
漏洞类别
N/A
来源:美国国家漏洞数据库 NVD
漏洞标题
Linux kernel 安全漏洞
来源:中国国家信息安全漏洞库 CNNVD
漏洞描述信息
Linux kernel是美国Linux基金会的开源操作系统Linux所使用的内核。 Linux kernel存在安全漏洞,该漏洞源于f_hidg生命周期与cdev不匹配,可能导致释放后重用。
来源:中国国家信息安全漏洞库 CNNVD
CVSS信息
N/A
来源:中国国家信息安全漏洞库 CNNVD
漏洞类别
其他
来源:中国国家信息安全漏洞库 CNNVD
二、漏洞 CVE-2022-50568 的公开POC
# POC 描述 源链接 神龙链接
三、漏洞 CVE-2022-50568 的情报信息
四、漏洞 CVE-2022-50568 的评论

暂无评论


发表评论