Headline
CVE-2023-39355: Use-After-Free in RDPGFX_CMDID_RESETGRAPHICS
FreeRDP is a free implementation of the Remote Desktop Protocol (RDP), released under the Apache license. Versions of FreeRDP on the 3.x release branch before beta3 are subject to a Use-After-Free in processing RDPGFX_CMDID_RESETGRAPHICS
packets. If context->maxPlaneSize
is 0, context->planesBuffer
will be freed. However, without updating context->planesBuffer
, this leads to a Use-After-Free exploit vector. In most environments this should only result in a crash. This issue has been addressed in version 3.0.0-beta3 and users of the beta 3.x releases are advised to upgrade. There are no known workarounds for this vulnerability.
Summary
Use-After-Free in RDPGFX_CMDID_RESETGRAPHICS
Affected
FreeRDP based clients only. FreeRDP proxy not affected as image decoding is not done by proxy (data passthrough)
Details
BOOL freerdp_bitmap_planar_context_reset(BITMAP_PLANAR_CONTEXT* context, UINT32 width,
UINT32 height)
{
if (!context)
return FALSE;
context->bgr = FALSE;
context->maxWidth = PLANAR_ALIGN(width, 4);
context->maxHeight = PLANAR_ALIGN(height, 4);
context->maxPlaneSize = context->maxWidth * context->maxHeight;
context->nTempStep = context->maxWidth * 4;
void* tmp = winpr_aligned_recalloc(context->planesBuffer, context->maxPlaneSize, 4, 32);
if (!tmp)
return FALSE;
context->planesBuffer = tmp;
If context->maxPlaneSize is 0, context->planesBuffer will be freed. However, without updating context->planesBuffer, this leads to a Use-After-Free (UAF) vulnerability.
PoC
- Send RDPGFX_CMDID_RESETGRAPHICS packet with height == 0 or width == 0
- Send RDPGFX_CMDID_RESETGRAPHICS packet again, crashed
Impact
Use-After-Free leading to unexpected behavior
Related news
Gentoo Linux Security Advisory 202401-16 - Multiple vulnerabilities have been discovered in FreeRDP, the worst of which could result in code execution. Versions greater than or equal to 2.11.0 are affected.