From 37d9c7ceced779187df22bcd220d44fb54c08fe1 Mon Sep 17 00:00:00 2001 From: Luigi Colluto Date: Sun, 5 Jul 2026 19:57:21 +0200 Subject: [PATCH] fix: add read/write timeouts to the RDP connection --- src/plugins/rdp/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/rdp/mod.rs b/src/plugins/rdp/mod.rs index a63b854..20210e8 100644 --- a/src/plugins/rdp/mod.rs +++ b/src/plugins/rdp/mod.rs @@ -53,6 +53,15 @@ impl Plugin for RDP { .map_err(|e| e.to_string())?; let stream = TcpStream::connect_timeout(&address, timeout).map_err(|e| e.to_string())?; + // connect_timeout only bounds the connect; without these a malicious or silent RDP + // server would hang the operator's thread during the handshake reads in + // Connector::connect (blocking, synchronous socket). + stream + .set_read_timeout(Some(timeout)) + .map_err(|e| e.to_string())?; + stream + .set_write_timeout(Some(timeout)) + .map_err(|e| e.to_string())?; let mut rdp_connector = Connector::new() .screen(800, 600)