漏洞描述
漏洞名称 |
Win32k 特权提升漏洞 | ||
漏洞公开编号 |
CVE-2024-38059 |
||
漏洞类型 |
权限提升 |
公开时间 |
2024-07-10 |
漏洞等级 |
重要 |
评分 |
7.8 |
漏洞所需权限 |
低权限 |
漏洞利用难度 |
低 |
PoC状态 |
未知 |
EXP状态 |
未知 |
漏洞细节 |
未知 |
在野利用 |
未知 |
漏洞分析
void __fastcall DirectComposition::CInteractionTrackerBindingManagerMarshaler::CleanUpListItemsPendingDeletion(__int64 this, struct DirectComposition::CApplicationChannel *a2)
{
....
// 1. 防止重入
if ( !*(_BYTE *)(this + 65) )
{
v4 = *(_QWORD *)(this + 96);
v5 = 0;
v6 = 0;
*(_BYTE *)(this + 65) = 1;
if ( v4 )
{
v7 = 0i64;
do
{
v8 = *(_QWORD *)(this + 72);
v9 = *(_QWORD *)(this + 104);
v10 = *(_DWORD *)(v7 * v9 + v8 + 16) == 0;
v11 = *(_OWORD *)(v7 * v9 + v8);
*(_OWORD *)v17 = v11;
if ( v10 )
{
v14 = v17[0];
v10 = (*((_DWORD *)v17[0] + 16))-- == 1;
if ( v10 )
DirectComposition::CInteractionTrackerMarshaler::SetBindingManagerMarshaler((__int64)v14, a2, 0i64);
v15 = v17[1];
v10 = (*((_DWORD *)v17[1] + 16))-- == 1;
if ( v10 )
// 2. CInteractionTrackerBindingManagerMarshaler 对象在调用 SetBindingManagerMarshaler 后可能被销毁
DirectComposition::CInteractionTrackerMarshaler::SetBindingManagerMarshaler((__int64)v15, a2, 0i64);
DirectComposition::CApplicationChannel::ReleaseResource((__int64)a2, (__int64)v14);
DirectComposition::CApplicationChannel::ReleaseResource((__int64)a2, (__int64)v15);
}
else
{
v12 = *(_OWORD *)(v7 * v9 + v8 + 16);
v13 = v5 * v9;
Src[0] = v11;
Src[1] = v12;
++v5;
memmove((void *)(v8 + v13), Src, v9);
}
// 3. 这里产生UAF
v4 = *(_QWORD *)(this + 96);
v7 = ++v6;
}
while ( v6 < v4 );
}
// 4. 这里产生UAF
DirectComposition::CDCompDynamicArrayBase::Shrink(this + 72, v4 - v5);
*(_BYTE *)(this + 65) = 0;
}
}
6.退出进程或销毁hChannel,蓝屏发生
void __fastcall DirectComposition::CApplicationChannel::ReleaseAllResources(__int64 this, __int64 a2)
{
// 1. 清空 marshaler 对象句柄表并同时释放对象
...
// 2. 删除第二个 marshaler 对象表并释放对象
while ( 1 )
{
v11 = (__int64)DirectComposition::CLinearObjectTableBase::EnumerateObjects(this + 112, &v21);
v12 = v11;
if ( !v11 )
break;
DirectComposition::CResourceMarshaler::AddRef(v11);
// 3. 调用 marshaler对象的 ReleaseAllReferences 函数
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v12 + 0xC0i64))(v12, this);
DirectComposition::CApplicationChannel::ReleaseResource(this, v12);
}
if ( a2 )
*(_BYTE *)a2 = *(_DWORD *)(this + 524) != 0;
}
void __fastcall DirectComposition::CInteractionTrackerMarshaler::ReleaseAllReferences(__int64 this, struct DirectComposition::CApplicationChannel *a2)
{
...
// 1. 将 CInteractionTrackerBindingManagerMarshaler 从 CInteractionTrackerMarshaler 对象中移除
v11 = *(_QWORD *)(this + 448);
if ( v11 )
{
// 2. 最终调用 DirectComposition::CInteractionTrackerBindingManagerMarshaler::CleanUpListItemsPendingDeletion 函数
DirectComposition::CInteractionTrackerBindingManagerMarshaler::RemoveTrackerBindings(v11, a2, *(_DWORD *)(this + 32));
DirectComposition::CApplicationChannel::ReleaseResource((__int64)a2, *(_QWORD *)(this + 448));
*(_QWORD *)(this + 448) = 0i64;
}
}
5. 内核继续访问 CInteractionTrackerBindingManagerMarshaler 对象时发生崩溃
影响版本
Windows Server 2022, 23H2 Edition (Server Core installation)
安全建议
安装相应的补丁程序,目前,官方已发布修复程序,受影响的用户可以直接升级至安全版本。
下载地址:https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-38059
参考信息
https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-38059
https://learn.microsoft.com/zh-cn/windows/win32/directcomp/basic-concepts
原文始发于微信公众号(山石网科安全技术研究院):Self Destruction To Use After Free In Kernel:CVE-2024-38059分析记录