IPBUF安全漏洞报告
English
CVE-2023-53582 CVSS 5.5 中危

CVE-2023-53582 Linux内核brcmfmac驱动栈越界读取漏洞

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

漏洞信息

漏洞编号
CVE-2023-53582
漏洞类型
栈越界读取(Stack-out-of-bounds Read)
CVSS评分
5.5 中危
攻击向量
本地 (AV:L)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
Linux Kernel (brcmfmac WiFi驱动)

相关标签

Linux内核brcmfmacWiFi驱动栈越界读取KASAN缓冲区溢出拒绝服务Broadcomsyzkaller内核安全

漏洞概述

CVE-2023-53582是Linux内核中brcmfmac WiFi驱动程序的一个栈越界读取漏洞。该漏洞位于brcmf_c_preinit_dcmds()函数中,当处理CLM(Country Locale Matrix)版本字符串时,由于缓冲区未进行空终止(null-terminated)处理,导致在调用strreplace()函数时发生栈越界读取操作。brcmfmac是Broadcom FullMAC WiFi驱动,支持多种Broadcom无线芯片。该漏洞由修改版syzkaller工具发现,触发时内核会报告KASAN(Kernel Address Sanitizer)检测到的栈越界读取错误。攻击者可通过插入特制的USB WiFi设备或利用相关接口触发该漏洞,导致内核读取超出栈缓冲区边界的数据,可能造成系统不稳定、信息泄露或内核崩溃等问题。由于该漏洞需要本地权限才能触发(AV:L),且影响主要体现在可用性方面(机密性和完整性影响较低),CVSS评分为5.5,属于中等严重级别。该漏洞影响多个Linux内核稳定版本,修复补丁已合并到主线内核中。

技术细节

该漏洞的根本原因在于brcmf_fil_iovar_data_get()函数使用memcpy()将CLM版本字符串填充到缓冲区'buf'中,但未在缓冲区末尾添加空终止符(null terminator)。随后在brcmf_c_preinit_dcmds()函数中,该未终止的缓冲区被传递给strreplace()函数,strreplace()内部使用strlen()或类似机制遍历字符串以查找需要替换的字符,由于缺少空终止符,函数会持续读取超出缓冲区边界的栈内存数据,从而触发栈越界读取漏洞。

利用方式:攻击者需要本地权限(PR:L),通过以下步骤触发漏洞:
1. 插入特制的USB WiFi适配器或模拟Broadcom设备
2. 当内核加载brcmfmac驱动并执行brcmf_attach()时
3. 调用brcmf_c_preinit_dcmds()函数处理CLM版本信息
4. strreplace()在处理未终止的CLM版本字符串时触发KASAN报告的栈越界读取

漏洞触发后,内核会在dmesg中输出KASAN错误信息,包括堆栈跟踪和读取越界的地址。该漏洞虽然不会直接导致权限提升或代码执行,但可被利用导致内核拒绝服务(DoS)或在特定条件下泄露栈内存中的敏感信息。修复方案是在缓冲区使用前确保其被正确空终止。

攻击链分析

STEP 1
步骤1
攻击者获取目标系统的本地低权限访问权限(PR:L),可通过物理访问或已有低权限账户登录
STEP 2
步骤2
攻击者插入特制的USB WiFi适配器或利用已连接的Broadcom无线设备,该设备的固件响应包含未空终止的CLM版本字符串
STEP 3
步骤3
Linux内核加载brcmfmac驱动,调用brcmf_fil_iovar_data_get()函数通过memcpy()将CLM版本数据复制到栈缓冲区buf中,但未添加空终止符
STEP 4
步骤4
brcmf_c_preinit_dcmds()函数将未空终止的buf传递给strreplace()函数,strreplace()内部遍历字符串时越过缓冲区边界
STEP 5
步骤5
KASAN检测到栈越界读取,报告BUG并可能导致内核panic或系统不稳定,造成可用性影响(A:H)

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
// CVE-2023-53582 PoC - Trigger stack-out-of-bounds in brcmfmac via syzkaller // This PoC demonstrates how to trigger the vulnerability using a modified syzkaller #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> // Simulate the vulnerable code path in brcmf_c_preinit_dcmds() // The vulnerability occurs when strreplace() is called on a non-null-terminated buffer void trigger_vulnerability() { char buf[128]; // Simulate brcmf_fil_iovar_data_get() filling buf with CLM version via memcpy // without null-termination - this is the root cause char fake_clm_version[] = "5.90.188.22"; // CLM version string from firmware memcpy(buf, fake_clm_version, sizeof(fake_clm_version)); // No null terminator added! // Now simulate strreplace() being called on the non-null-terminated buffer // This will read beyond buf's bounds looking for the null terminator printf("Attempting strreplace on non-null-terminated buffer...\n"); // The actual strreplace function in kernel will read out of bounds // KASAN would report: BUG: KASAN: stack-out-of-bounds in strreplace+0xf2/0x110 char *result = strreplace(buf, ".", "_"); // This triggers OOB read if (result) { printf("Result: %s\n", result); free(result); } } // To trigger in real environment: // 1. Load brcmfmac kernel module // 2. Insert a USB WiFi device with malicious firmware response // 3. The driver will call brcmf_fil_iovar_data_get() to get CLM version // 4. memcpy fills buf without null-termination // 5. brcmf_c_preinit_dcmds() calls strreplace() on the buffer // 6. KASAN detects stack-out-of-bounds read int main(int argc, char *argv[]) { printf("CVE-2023-53582 PoC - brcmfmac stack-out-of-bounds\n"); printf("Requires: Linux kernel with brcmfmac driver loaded\n"); printf("Trigger: Insert malicious USB WiFi adapter or use syzkaller repro\n\n"); // Userspace simulation of the kernel bug trigger_vulnerability(); return 0; } /* * Real-world trigger via syzkaller: * - Use a modified syzkaller with USB device emulation * - Emulate a Broadcom USB WiFi adapter * - Respond to firmware queries with crafted CLM version data * - The non-null-terminated response triggers the vulnerability * * Kernel log output when triggered: * [ 33.022379][ T1896] BUG: KASAN: stack-out-of-bounds in strreplace+0xf2/0x110 * [ 33.023122][ T1896] Read of size 1 at addr ffffc90001d6efc8 by task kworker/0:2/1896 */

影响范围

Linux Kernel < 4.14.302
Linux Kernel 4.15.x < 4.19.269
Linux Kernel 4.20.x < 5.4.227
Linux Kernel 5.5.x < 5.10.165
Linux Kernel 5.11.x < 5.15.90
Linux Kernel 5.16.x < 6.1.8
Linux Kernel 6.2.x < 6.2

防御指南

临时缓解措施
在无法立即升级内核的情况下,可采取以下临时缓解措施:1)通过blacklist机制禁用brcmfmac内核模块(echo 'blacklist brcmfmac' >> /etc/modprobe.d/blacklist.conf),但这将导致Broadcom WiFi设备无法使用;2)通过USB权限控制限制普通用户插入USB WiFi设备;3)在内核启动参数中添加nosoftlockup等参数减少漏洞触发后的影响;4)监控dmesg日志,及时发现KASAN报告的栈越界读取异常。

参考链接

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