diff mbox series

[meta-oe,scarthgap,13/22] freerdp3: fix CVE-2026-24683

Message ID 20260409070919.3968586-13-ankur.tyagi85@gmail.com
State New
Headers show
Series [meta-oe,scarthgap,1/22] abseil-cpp: ignore CVE-2025-0838 | expand

Commit Message

Ankur Tyagi April 9, 2026, 7:09 a.m. UTC
From: Ankur Tyagi <ankur.tyagi85@gmail.com>

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-24683

Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
---
 .../freerdp/freerdp3/CVE-2026-24683.patch     | 114 ++++++++++++++++++
 .../recipes-support/freerdp/freerdp3_3.4.0.bb |   1 +
 2 files changed, 115 insertions(+)
 create mode 100644 meta-oe/recipes-support/freerdp/freerdp3/CVE-2026-24683.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/freerdp/freerdp3/CVE-2026-24683.patch b/meta-oe/recipes-support/freerdp/freerdp3/CVE-2026-24683.patch
new file mode 100644
index 0000000000..8d24931b3d
--- /dev/null
+++ b/meta-oe/recipes-support/freerdp/freerdp3/CVE-2026-24683.patch
@@ -0,0 +1,114 @@ 
+From da05a4039644b0821c0a61806d40688ac08f3ce0 Mon Sep 17 00:00:00 2001
+From: akallabeth <akallabeth@posteo.net>
+Date: Mon, 26 Jan 2026 12:08:48 +0100
+Subject: [PATCH] [channels,ainput] lock context when updating listener
+
+(cherry picked from commit d9ca272dce7a776ab475e9b1a8e8c3d2968c8486)
+
+CVE: CVE-2026-24683
+Upstream-Status: Backport [https://github.com/FreeRDP/FreeRDP/commit/d9ca272dce7a776ab475e9b1a8e8c3d2968c8486]
+Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
+---
+ channels/ainput/client/ainput_main.c | 36 ++++++++++++++++++++--------
+ 1 file changed, 26 insertions(+), 10 deletions(-)
+
+diff --git a/channels/ainput/client/ainput_main.c b/channels/ainput/client/ainput_main.c
+index 1a2128dcc..5f66cf90e 100644
+--- a/channels/ainput/client/ainput_main.c
++++ b/channels/ainput/client/ainput_main.c
+@@ -45,6 +45,7 @@ struct AINPUT_PLUGIN_
+ 	AInputClientContext* context;
+ 	UINT32 MajorVersion;
+ 	UINT32 MinorVersion;
++	CRITICAL_SECTION lock;
+ };
+ 
+ /**
+@@ -85,18 +86,15 @@ static UINT ainput_on_data_received(IWTSVirtualChannelCallback* pChannelCallback
+ 
+ static UINT ainput_send_input_event(AInputClientContext* context, UINT64 flags, INT32 x, INT32 y)
+ {
+-	AINPUT_PLUGIN* ainput = NULL;
+-	GENERIC_CHANNEL_CALLBACK* callback = NULL;
+ 	BYTE buffer[32] = { 0 };
+-	UINT64 time = 0;
+ 	wStream sbuffer = { 0 };
+ 	wStream* s = Stream_StaticInit(&sbuffer, buffer, sizeof(buffer));
+ 
+ 	WINPR_ASSERT(s);
+ 	WINPR_ASSERT(context);
+ 
+-	time = GetTickCount64();
+-	ainput = (AINPUT_PLUGIN*)context->handle;
++	const UINT64 time = GetTickCount64();
++	AINPUT_PLUGIN* ainput = (AINPUT_PLUGIN*)context->handle;
+ 	WINPR_ASSERT(ainput);
+ 
+ 	if (ainput->MajorVersion != AINPUT_VERSION_MAJOR)
+@@ -105,8 +103,6 @@ static UINT ainput_send_input_event(AInputClientContext* context, UINT64 flags,
+ 		          ainput->MajorVersion, ainput->MinorVersion);
+ 		return CHANNEL_RC_UNSUPPORTED_VERSION;
+ 	}
+-	callback = ainput->base.listener_callback->channel_callback;
+-	WINPR_ASSERT(callback);
+ 
+ 	{
+ 		char ebuffer[128] = { 0 };
+@@ -125,10 +121,15 @@ static UINT ainput_send_input_event(AInputClientContext* context, UINT64 flags,
+ 	Stream_SealLength(s);
+ 
+ 	/* ainput back what we have received. AINPUT does not have any message IDs. */
++	EnterCriticalSection(&ainput->lock);
++	GENERIC_CHANNEL_CALLBACK* callback = ainput->base.listener_callback->channel_callback;
++	WINPR_ASSERT(callback);
+ 	WINPR_ASSERT(callback->channel);
+ 	WINPR_ASSERT(callback->channel->Write);
+-	return callback->channel->Write(callback->channel, (ULONG)Stream_Length(s), Stream_Buffer(s),
+-	                                NULL);
++	const UINT rc = callback->channel->Write(callback->channel, (ULONG)Stream_Length(s),
++	                                         Stream_Buffer(s), NULL);
++	LeaveCriticalSection(&ainput->lock);
++	return rc;
+ }
+ 
+ /**
+@@ -140,8 +141,16 @@ static UINT ainput_on_close(IWTSVirtualChannelCallback* pChannelCallback)
+ {
+ 	GENERIC_CHANNEL_CALLBACK* callback = (GENERIC_CHANNEL_CALLBACK*)pChannelCallback;
+ 
+-	free(callback);
++	if (callback)
++	{
++		AINPUT_PLUGIN* ainput = (AINPUT_PLUGIN*)callback->plugin;
++		WINPR_ASSERT(ainput);
+ 
++		/* Lock here to ensure that no ainput_send_input_event is in progress. */
++		EnterCriticalSection(&ainput->lock);
++		free(callback);
++		LeaveCriticalSection(&ainput->lock);
++	}
+ 	return CHANNEL_RC_OK;
+ }
+ 
+@@ -155,14 +164,21 @@ static UINT init_plugin_cb(GENERIC_DYNVC_PLUGIN* base, rdpContext* rcontext, rdp
+ 	context->handle = (void*)base;
+ 	context->AInputSendInputEvent = ainput_send_input_event;
+ 
++	InitializeCriticalSection(&ainput->lock);
++
++	EnterCriticalSection(&ainput->lock);
+ 	ainput->context = context;
+ 	ainput->base.iface.pInterface = context;
++	LeaveCriticalSection(&ainput->lock);
+ 	return CHANNEL_RC_OK;
+ }
+ 
+ static void terminate_plugin_cb(GENERIC_DYNVC_PLUGIN* base)
+ {
+ 	AINPUT_PLUGIN* ainput = (AINPUT_PLUGIN*)base;
++	WINPR_ASSERT(ainput);
++
++	DeleteCriticalSection(&ainput->lock);
+ 	free(ainput->context);
+ }
+ 
diff --git a/meta-oe/recipes-support/freerdp/freerdp3_3.4.0.bb b/meta-oe/recipes-support/freerdp/freerdp3_3.4.0.bb
index 8e53c47103..715354768a 100644
--- a/meta-oe/recipes-support/freerdp/freerdp3_3.4.0.bb
+++ b/meta-oe/recipes-support/freerdp/freerdp3_3.4.0.bb
@@ -30,6 +30,7 @@  SRC_URI = "git://github.com/FreeRDP/FreeRDP.git;branch=master;protocol=https \
            file://CVE-2026-24680_CVE-2026-27950.patch \
            file://CVE-2026-24681.patch \
            file://CVE-2026-24682.patch \
+           file://CVE-2026-24683.patch \
            "
 
 S = "${WORKDIR}/git"