# gdi_set_bounds 堆/use-after-free 漏洞
## 概述
FreeRDP 在版本 3.21.0 之前存在一个使用已释放内存(Use-After-Free, UAF)漏洞,由离屏位图删除操作引发。
## 影响版本
受影响版本:FreeRDP 3.21.0 之前的所有版本。
修复版本:3.21.0。
## 细节
在处理离屏位图删除时,`gdi->drawing` 指针未被置空,仍指向已被释放的内存。当后续相关的图形更新包到达时,程序会通过该悬垂指针访问已释放内存,触发 UAF。
## 影响
恶意服务器可利用此漏洞导致客户端崩溃(拒绝服务),并可能引发堆内存 corruption,存在远程代码执行风险,具体取决于内存分配器行为和堆布局。
是否为 Web 类漏洞: 未知
判断理由:
| # | POC 描述 | 源链接 | 神龙链接 |
|---|
标题: Release 3.21.0 · FreeRDP/FreeRDP · GitHub -- 🔗来源链接
标签:x_refsource_MISC
神龙速读:
- **Version**: 3.21.0
- **Release Notes**: Bugfix release with new API functions for input data validation improvements.
- **Fixed Vulnerabilities**: CVE-2026-23530, CVE-2026-23531, CVE-2026-23532, CVE-2026-23533, CVE-2026-23534, CVE-2026-23732, CVE-2026-23883, CVE-2026-23884. (Medium client-side vulnerabilities)
- **Contributor**: ehdgks0627
- **Changes**: Includes fixes for various issues, such as monitor resolution, RPCX upgrades, krb cache, RDPDR checks, codec length checks, glyph length checks, format string checks and warnings, double free errors, and code warnings cleanup.
标题: Heap-use-after-free in gdi_set_bounds · Advisory · FreeRDP/FreeRDP · GitHub -- 🔗来源链接
标签:x_refsource_CONFIRM
神龙速读:
### 关键信息
- **漏洞类型**: Heap-use-after-free
- **受影响版本**: FreeRDP <= 3.20.2
- **修复版本**: 3.21.0
- **CVE ID**: CVE-2026-23884
- **严重性**: Moderate
- **漏洞描述**:
- Offscreen bitmap deletion leaves `gdi->drawing` pointing to freed memory, causing UAF when related update packets arrive.
- RDP AltSec `CREATE_OFFSCREEN_BITMAP` can delete an existing bitmap via `deleteList`, which calls `offscreen_cache_delete` and frees the `rdpBitmap` without updating `gdi->drawing`.
- Active surface selection assigns `gdi->drawing` to the offscreen bitmap; if that bitmap is later deleted, `gdi->drawing` becomes a dangling pointer.
- Subsequent primary orders with `ORDER_BOUNDS` invoke `update->SetBounds` -> `gdi_set_bounds` and dereference `gdi->drawing->hdc`, triggering a heap-use-after-free.
- **影响**:
- A malicious server can trigger a client-side use after free, causing a crash (DoS) and potential heap corruption with code-execution risk depending on allocator behavior and surrounding heap layout.
- **文件和代码片段**:
- `FreeRDP/libfreerdp/cache/offscreen.c` (Lines 87-91 and 114-122)
- **报告者**: ehdgks0627
标题: FreeRDP/libfreerdp/cache/offscreen.c at 3370e30e92a021eb680892dda14d642bc8b8727c · FreeRDP/FreeRDP · GitHub -- 🔗来源链接
标签:x_refsource_MISC
神龙速读:
**Key Vulnerability Information:**
- **File:** `libfreerdp/cache/offscreen.c`
- **Commit:** cc93479 (2 years ago)
- **Commit Message:** `[warnings] fix integer casting`
- **Vulnerable Code Section:**
```c
for (UINT32 i = 0; i < createOffscreenBitmap->deleteList.cIndices; i++)
{
index = createOffscreenBitmap->deleteList.indices[i];
offscreen_cache_delete(cache->offscreen, index);
}
```
- **Potential Vulnerability:**
- **Offscreen Cache Handling:** The code involves offscreen cache management, including creation, deletion, and switching surfaces.
- **Integer Casting Fix:** The commit message suggests a fix related to integer casting, which could indicate potential overflow or underflow vulnerabilities in previous versions.
- **Code Highlights:**
- `rdp_offscreen_cache` structure definitions
- Functions for putting, deleting, and getting entries from the offscreen cache
- Memory allocation and freeing within `offscreen_cache_new` and `offscreen_cache_free`
- Error handling in `WLog_ERR` statements
- **Security Considerations:**
- Ensure proper bounds checking when accessing `offscreenCache->entries` and `offscreenCache->maxEntries`
- Validate input parameters to prevent buffer overflows or other memory corruption issues
标题: FreeRDP/libfreerdp/cache/offscreen.c at 3370e30e92a021eb680892dda14d642bc8b8727c · FreeRDP/FreeRDP · GitHub -- 🔗来源链接
标签:x_refsource_MISC
神龙速读:
### 关键信息
- **项目**: FreeRDP (开源远程桌面协议实现)
- **文件**: `libfreerdp/cache/offscreen.c`
- **提交信息**:
- 提交者: akallabeth
- 提交消息: `[warnings] fix integer casting`
- 提交时间: 2 years ago (cc93479)
#### 漏洞相关代码片段
```c
static rdpBitmap* offscreen_cache_get(rdpOffscreenCache* offscreenCache, UINT32 index)
{
rdpBitmap* bitmap = NULL;
WINPR_ASSERT(offscreenCache);
if (index >= offscreenCache->maxEntries)
{
WLog_ERR(TAG, "invalid offscreen bitmap index: 0x%08" PRIX32 "", index);
return NULL;
}
bitmap = offscreenCache->entries[index];
if (!bitmap)
{
WLog_ERR(TAG, "invalid offscreen bitmap at index: 0x%08" PRIX32 "", index);
return NULL;
}
return bitmap;
}
```
#### 可能的漏洞点
1. **无效的索引访问**
- 代码检查 `index >= offscreenCache->maxEntries` 以防止越界访问,但可能存在未被覆盖的情况导致访问无效索引。
- **潜在风险**: 访问越界可能导致内存泄漏或崩溃。
2. **空指针检查**
- 在获取 bitmap 时有空指针检查,但未对 `offscreenCache` 本身进行空指针检查。
- **潜在风险**: 如果 `offscreenCache` 为 NULL,可能引发段错误。
3. **日志错误信息**
- 当索引无效时,日志记录错误信息但返回 NULL,可能导致上层逻辑处理异常。
- **潜在风险**: 异常处理不完善可能引发其他逻辑错误。
### 总结
此代码片段主要涉及对 offscreen 缓存的访问逻辑,通过索引获取 bitmap。可能存在越界访问和空指针异常的风险,需要进一步的异常处理和边界检查以确保安全性。
暂无评论