Bug 8151 (CVE-2024-24860) - Bluetooth: {min,max}_key_size_set函数存在竞争条件
Summary: Bluetooth: {min,max}_key_size_set函数存在竞争条件
Status: NEW
Alias: CVE-2024-24860
Product: ANCK 5.10 Dev
Classification: ANCK
Component: drivers (show other bugs) drivers
Version: 5.10.y-16
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: GuixinLiu
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-01 17:22 UTC by Shiloong
Modified: 2024-03-06 09:59 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shiloong admin 2024-02-01 17:22:00 UTC
上报人信息:
  - 白家驹 <baijiaju@buaa.edu.cn>
  - 北京航空航天大学网络空间安全学院

成因:
{min,max}_key_size_set函数用于更新hdev->le_{min,max}_key_size,不允许使le_max_key_size小于le_min_key_size,但在判断更新参数合法性时没有持有锁,hdev->le_{min,max}_key_size可能在判断更新参数合法性后被改写,使判断更新参数合法性的比较无效化,从而写入非法的le_{min,max}_key_size,使le_max_key_size小于le_min_key_size。

	
危害:
hdev->le_{min,max}_key_size是蓝牙组件的重要参数。hdev->le_{min,max}_key_size在check_enc_key_size函数中被用于判断参数合法性,合法则更新smp->enc_key_size为传入值,le_max_key_size小于le_min_key_size会使smp->enc_key_size无法更新或更新为非法值;hdev->le_max_key_size在build_pairing_cmd中被传递给max_key_size,从而污染max_key_size。

bug触发后,hdev->le_{min,max}_key_size非法,会使蓝牙加密密钥长度异常,危害蓝牙加密安全。

	
修复缓解:
   - 在{min,max}_key_size_set函数中,扩大缓冲区,将判断更新参数合法性代码纳入hci_dev_lock的临界区。

补丁已提交给Linux Kernel Bluetooth子系统维护者并被接收,补丁链接:https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=da9065caa594d19b26e1a030fd0cc27bd365d685