CVE-2025-68670
Executive Summary
CVE-2025-68670 is a critical, unauthenticated stack-based buffer overflow vulnerability in xrdp, an open-source RDP server. The flaw exists in versions prior to 0.10.5 and is triggered during the processing of user domain information in the connection sequence. An attacker can send a specially crafted RDP connection request that overflows a stack buffer, overwriting the return address and potentially achieving arbitrary code execution. With a CVSS score of 9.1, this vulnerability poses a severe risk to any system running an unpatched xrdp instance, especially those exposed to the internet. The impact is slightly mitigated if stack canary protection is enabled, but this should not be relied upon as a primary defense. No public proof-of-concept (PoC) or exploit code has been released at this time.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability is not related to a package manager ecosystem (NPM, PyPI, Go, Ruby). It affects the xrdp open-source project directly. Organizations should verify the integrity of their xrdp binaries and ensure they are sourced from official repositories or the project's GitHub releases.
CVSS Breakdown & Threat Level
- CVSS Score: 9.1 (Critical)
- Attack Vector (AV): Network (N) – Exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): None (N) – No user action required.
- Scope (S): Unchanged (U) – The vulnerable component is the only one affected.
- Confidentiality (C): High (H) – Full data access possible.
- Integrity (I): High (H) – Full system control possible.
- Availability (A): High (H) – Service disruption possible.
Threat Level: Critical. The combination of network exploitability, low complexity, and no required privileges makes this a prime target for automated scanning and exploitation.
Deep Dive & Mechanics
The vulnerability resides in the handling of user domain information during the RDP connection sequence. When a client initiates an RDP connection, it sends a packet containing the user's credentials, including a domain name. The xrdp server copies this domain string into a fixed-size stack buffer without proper bounds checking. By sending an overly long domain string, an attacker can overflow this buffer, corrupting adjacent stack memory, including the saved return address.
The core issue is a classic stack-based buffer overflow (CWE-121). The vulnerable code path likely involves a function like g_strncpy or memcpy that does not validate the length of the source string against the destination buffer size. The overflow allows the attacker to control the instruction pointer (EIP/RIP) upon function return, enabling arbitrary code execution.
The impact is slightly reduced if the xrdp binary was compiled with stack canary protection (e.g., -fstack-protector). In that case, the canary value would be checked before the function returns, and the program would abort if the canary was overwritten. However, this is not a complete mitigation, as an attacker could potentially leak the canary value through another vulnerability or brute-force it.
Vulnerable vs. Patched Code
The following is a conceptual representation of the vulnerable and patched code. The actual implementation may vary.
Vulnerable Code (xrdp < 0.10.5):
// In some connection handling function
char domain_buffer[64];
char *domain = get_domain_from_packet(packet);
// VULNERABLE: No bounds checking
strcpy(domain_buffer, domain);
Patched Code (xrdp >= 0.10.5):
// In some connection handling function
char domain_buffer[64];
char *domain = get_domain_from_packet(packet);
// PATCHED: Bounds checking with safe copy
strncpy(domain_buffer, domain, sizeof(domain_buffer) - 1);
domain_buffer[sizeof(domain_buffer) - 1] = '\0';
The patch introduces a length-limited copy using strncpy and ensures null-termination, preventing the buffer overflow.
Exploitation & Lab Setup
Red Team
Objective: Achieve remote code execution on an unpatched xrdp server.
Prerequisites:
- Target running xrdp < 0.10.5.
- Network access to port 3389 (or custom RDP port).
- Ability to craft raw RDP packets.
Exploitation Steps:
Reconnaissance: Scan for xrdp services using Shodan or Nmap.
nmap -p 3389 --script rdp-ntlm-info <target>Crafting the Exploit: Since no public exploit exists, a custom exploit must be developed. The exploit will need to:
- Establish a TCP connection to the target on port 3389.
- Send a crafted RDP Connection Request PDU (X.224 Connection Request) with an overly long domain field.
- The domain field should contain shellcode and padding to overwrite the return address.
- The shellcode should be position-independent and account for stack alignment.
Conceptual Python Script (for educational purposes only):
import socket target_ip = "192.168.1.100" target_port = 3389 # Craft a malicious RDP connection request # This is a simplified example and will not work without proper RDP protocol knowledge shellcode = b"\x90" * 100 # NOP sled + actual shellcode padding = b"A" * 64 # Fill buffer return_address = b"\xef\xbe\xad\xde" # Address to jump to (little-endian) payload = padding + return_address + shellcode # Build the RDP packet (simplified) packet = b"\x03\x00\x00\x13" # TPKT header packet += b"\x0e\xe0\x00\x00" # X.224 Connection Request packet += b"\x00\x00\x00\x00" # Cookie packet += payload sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((target_ip, target_port)) sock.send(packet) sock.close()Post-Exploitation: Upon successful exploitation, the attacker gains a shell on the target system with the privileges of the xrdp process (typically root).
Blue Team
Objective: Detect and prevent exploitation attempts.
Detection Strategies:
- Network Monitoring: Monitor for unusually large RDP connection requests. A normal domain field is typically less than 256 bytes. Any request with a domain field exceeding 1024 bytes should be flagged.
- Host-Based Monitoring: Monitor xrdp logs for crashes or segmentation faults. A sudden increase in xrdp process crashes may indicate exploitation attempts.
- Stack Canary Monitoring: If stack canaries are enabled, monitor for
SIGABRTsignals from the xrdp process, which indicate a canary check failure.
Prevention:
- Patch Immediately: Upgrade to xrdp version 0.10.5 or later.
- Network Segmentation: Restrict access to RDP ports (3389) to trusted IP addresses only.
- Web Application Firewall (WAF): If xrdp is behind a reverse proxy, configure rules to block oversized RDP packets.
- Compile with Stack Canaries: Ensure xrdp is compiled with
-fstack-protector-strongto enable stack canary protection.
Indicators of Compromise (IOCs)
Network IOCs:
- RDP connection requests with a domain field length exceeding 1024 bytes.
- Multiple failed RDP connection attempts from the same source IP.
- Unusual patterns in RDP traffic, such as repeated connection requests with varying domain lengths.
Host IOCs:
- xrdp process crashes (segmentation faults) in system logs.
- Core dumps from the xrdp process.
- Unusual child processes spawned by xrdp.
- Presence of shellcode or suspicious binaries in
/tmpor other writable directories.
Log Examples:
/var/log/xrdp.log: [ERROR] xrdp process crashed with signal 11 (SIGSEGV) /var/log/syslog: kernel: [12345.678] xrdp[1234]: segfault at 0xdeadbeef ip 0x41414141 sp 0x7ffc12345678 error 4
Detection Engineering
YARA Rule
rule CVE_2025_68670_xrdp_overflow {
meta:
description = "Detects xrdp binaries vulnerable to CVE-2025-68670"
author = "Valters IT"
date = "2025-01-01"
hash = "sha256: <hash_of_vulnerable_binary>"
strings:
$s1 = "strcpy" ascii wide nocase
$s2 = "domain_buffer" ascii wide nocase
$s3 = "get_domain_from_packet" ascii wide nocase
condition:
all of them
}
Sigma Rule
title: CVE-2025-68670 - xrdp Stack Buffer Overflow Attempt
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects network traffic indicative of an attempt to exploit CVE-2025-68670
author: Valters IT
date: 2025-01-01
logsource:
category: network
product: suricata
detection:
selection:
event_type: alert
alert.signature_id: 202568670
condition: selection
falsepositives:
- Legitimate large domain names (unlikely)
level: critical
Suricata Rule
alert tcp $EXTERNAL_NET any -> $HOME_NET 3389 (msg:"CVE-2025-68670 - xrdp Stack Buffer Overflow Attempt"; flow:to_server,established; content:"|03 00 00 13 0e e0 00 00|"; depth:8; content:"|00|"; within:2; byte_test:2,>,1024,8,relative; classtype:attempted-admin; sid:202568670; rev:1;)
Explanation: This Suricata rule looks for RDP connection requests (TPKT header 03 00 00 13 and X.224 Connection Request 0e e0 00 00) and checks if the domain field (starting at offset 8) is larger than 1024 bytes. If so, it generates an alert.
Remediation & Mitigation
Immediate Action: Upgrade xrdp to version 0.10.5 or later. This is the only complete fix.
# For Debian/Ubuntu sudo apt-get update && sudo apt-get install xrdp # For RHEL/CentOS sudo yum update xrdp # From source wget https://github.com/neutrinolabs/xrdp/releases/download/v0.10.5/xrdp-0.10.5.tar.gz tar -xzf xrdp-0.10.5.tar.gz cd xrdp-0.10.5 ./configure make sudo make installCompensating Controls (if patching is not immediately possible):
- Network Segmentation: Use a firewall to restrict access to port 3389 to only trusted IP addresses.
- Stack Canary Protection: Recompile xrdp with
-fstack-protector-strongto enable stack canary protection. This will cause the process to crash instead of allowing code execution, but it is not a complete fix. - Intrusion Prevention System (IPS): Deploy the Suricata rule provided in this report to detect and block exploitation attempts.
- Application Allowlisting: Use tools like SELinux or AppArmor to restrict the capabilities of the xrdp process.
Long-Term Measures:
- Implement a vulnerability management program to ensure timely patching.
- Conduct regular security audits of open-source components.
- Consider using a Web Application Firewall (WAF) or RDP gateway to add an additional layer of security.
Valters IT
DevSecOps & Cyber Threat Intelligence