From 5c1399c30901b98ee9eb0b83be2847eb74b9e80d Mon Sep 17 00:00:00 2001 From: matt335672 <30179339+matt335672@users.noreply.github.com> Date: Wed, 7 Dec 2022 10:49:06 +0000 Subject: [PATCH 9/9] CVE-2022-23493 Check chansrv channel ID on a channel close Prevent OOB read if an invalid channel ID is sent. --- xrdp/xrdp_mm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index b59345d7..c27c2341 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -1447,6 +1447,12 @@ xrdp_mm_trans_process_drdynvc_channel_close(struct xrdp_mm *self, return 1; } in_uint32_le(s, chansrv_chan_id); + if (chansrv_chan_id < 0 || chansrv_chan_id > 255) + { + LOG(LOG_LEVEL_ERROR, "Attempting to close invalid chansrv channel %d", + chansrv_chan_id); + return 1; + } chan_id = self->cs2xr_cid_map[chansrv_chan_id]; /* close dynamic channel */ error = libxrdp_drdynvc_close(self->wm->session, chan_id); -- 2.39.0