CVE-2026-31897 Overview
CVE-2026-31897 is an out-of-bounds read vulnerability affecting FreeRDP, a free implementation of the Remote Desktop Protocol. The vulnerability exists in the freerdp_bitmap_decompress_planar function within libfreerdp/codec/planar.c. When SrcSize is 0 and pSrcData is non-NULL, the function dereferences *srcp (which points to pSrcData) without first verifying that SrcSize >= 1, resulting in a one-byte read past the end of the source buffer.
Critical Impact
This vulnerability allows remote attackers to read sensitive information from memory or cause a denial of service condition through network-based attacks without requiring authentication or user interaction.
Affected Products
- FreeRDP versions prior to 3.24.0
- Applications and systems utilizing FreeRDP library for Remote Desktop Protocol connectivity
- Remote desktop clients built on the FreeRDP implementation
Discovery Timeline
- 2026-03-13 - CVE CVE-2026-31897 published to NVD
- 2026-03-17 - Last updated in NVD database
Technical Details for CVE-2026-31897
Vulnerability Analysis
This out-of-bounds read vulnerability occurs in the planar bitmap decompression routine of FreeRDP. The freerdp_bitmap_decompress_planar function processes compressed bitmap data during RDP sessions. The function initializes a pointer srcp to point to the input data buffer pSrcData, then immediately dereferences this pointer without proper bounds validation.
The critical flaw is the missing check for the SrcSize parameter. While the original code verified that pSrcData was not NULL, it failed to validate that there was actually any data to read (i.e., SrcSize >= 1). This oversight allows an attacker to trigger a memory read operation on a zero-length buffer, causing the function to read one byte beyond the allocated memory region.
Root Cause
The root cause is insufficient input validation in the boundary condition handling of the freerdp_bitmap_decompress_planar function. The function only checked for a NULL pointer but did not validate the size parameter before dereferencing the data pointer. This is a classic CWE-125 (Out-of-bounds Read) vulnerability where array index validation is incomplete.
Attack Vector
The vulnerability is network-exploitable without requiring authentication or user interaction. An attacker controlling a malicious RDP server can send specially crafted bitmap data with a zero-length source buffer to a connecting FreeRDP client. When the client attempts to decompress this malformed bitmap data, the out-of-bounds read is triggered. This could lead to information disclosure (reading adjacent memory contents) or crash the client application, resulting in denial of service.
// Security patch from libfreerdp/codec/planar.c
const BYTE* srcp = pSrcData;
- if (!pSrcData)
+ if (!pSrcData || (SrcSize < 1))
{
- WLog_ERR(TAG, "Invalid argument pSrcData=nullptr");
+ WLog_ERR(TAG, "Invalid argument pSrcData=%p [size=%" PRIu32 "]", pSrcData, SrcSize);
return FALSE;
}
Source: GitHub FreeRDP Commit Details
Detection Methods for CVE-2026-31897
Indicators of Compromise
- Unexpected FreeRDP client crashes during RDP session establishment or bitmap rendering
- Memory access violations or segmentation faults in processes using FreeRDP libraries
- Anomalous RDP traffic patterns containing malformed bitmap data with zero-length source buffers
- Core dumps indicating crashes within freerdp_bitmap_decompress_planar or related codec functions
Detection Strategies
- Monitor for FreeRDP client application crashes and correlate with network activity from untrusted RDP servers
- Implement network intrusion detection rules to identify RDP sessions with anomalous bitmap compression parameters
- Deploy endpoint detection to monitor for memory access violations in FreeRDP-based applications
- Audit system logs for repeated connection failures to RDP servers combined with client-side crashes
Monitoring Recommendations
- Enable crash reporting and monitoring for all FreeRDP-based remote desktop applications
- Configure network monitoring to alert on RDP connections to non-corporate or untrusted servers
- Implement application-level logging to capture bitmap decompression errors and parameter values
- Use memory sanitizers (ASan/MSan) in development and testing environments to detect similar issues
How to Mitigate CVE-2026-31897
Immediate Actions Required
- Upgrade FreeRDP to version 3.24.0 or later immediately across all affected systems
- Audit all applications and systems using FreeRDP as a dependency and schedule updates
- Restrict RDP connections to trusted servers only until patches can be applied
- Implement network segmentation to limit exposure of vulnerable FreeRDP clients
Patch Information
The vulnerability is fixed in FreeRDP version 3.24.0. The patch adds an early length check to the freerdp_bitmap_decompress_planar function to ensure SrcSize is at least 1 before attempting to read from the source buffer. The fix is available in commit cd27c8faca0eeb0d4309cc5837dfdf3c42eba4e7. Organizations should consult the GitHub Security Advisory GHSA-xgv6-r22m-7c9x for complete details.
Workarounds
- If immediate patching is not possible, restrict RDP connections to trusted and verified servers only
- Implement firewall rules to block outbound RDP connections to untrusted networks
- Consider using alternative RDP clients that do not rely on vulnerable FreeRDP versions
- Deploy network-based security controls to inspect RDP traffic for malicious bitmap data
# Configuration example - Restrict FreeRDP connections to trusted servers
# Add to firewall rules to limit outbound RDP connections
iptables -A OUTPUT -p tcp --dport 3389 -d trusted_server_ip -j ACCEPT
iptables -A OUTPUT -p tcp --dport 3389 -j DROP
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

