Skip to content

[Medium] Patch xorg-x11-server-Xwayland for CVE-2025-49175, CVE-2025-49177, CVE-2025-49178, CVE-2025-49179, CVE-2025-49180 #14082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions SPECS/xorg-x11-server-Xwayland/CVE-2025-49175.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
From 0885e0b26225c90534642fe911632ec0779eebee Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Fri, 28 Mar 2025 09:43:52 +0100
Subject: [PATCH] render: Avoid 0 or less animated cursors
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Upstream Patch Link: https://gitlab.freedesktop.org/xorg/xserver/-/commit/0885e0b26225c90534642fe911632ec0779eebee.patch

Animated cursors use a series of cursors that the client can set.

By default, the Xserver assumes at least one cursor is specified
while a client may actually pass no cursor at all.

That causes an out-of-bound read creating the animated cursor and a
crash of the Xserver:

| Invalid read of size 8
| at 0x5323F4: AnimCursorCreate (animcur.c:325)
| by 0x52D4C5: ProcRenderCreateAnimCursor (render.c:1817)
| by 0x52DC80: ProcRenderDispatch (render.c:1999)
| by 0x4A1E9D: Dispatch (dispatch.c:560)
| by 0x4B0169: dix_main (main.c:284)
| by 0x4287F5: main (stubmain.c:34)
| Address 0x59aa010 is 0 bytes after a block of size 0 alloc'd
| at 0x48468D3: reallocarray (vg_replace_malloc.c:1803)
| by 0x52D3DA: ProcRenderCreateAnimCursor (render.c:1802)
| by 0x52DC80: ProcRenderDispatch (render.c:1999)
| by 0x4A1E9D: Dispatch (dispatch.c:560)
| by 0x4B0169: dix_main (main.c:284)
| by 0x4287F5: main (stubmain.c:34)
|
| Invalid read of size 2
| at 0x5323F7: AnimCursorCreate (animcur.c:325)
| by 0x52D4C5: ProcRenderCreateAnimCursor (render.c:1817)
| by 0x52DC80: ProcRenderDispatch (render.c:1999)
| by 0x4A1E9D: Dispatch (dispatch.c:560)
| by 0x4B0169: dix_main (main.c:284)
| by 0x4287F5: main (stubmain.c:34)
| Address 0x8 is not stack'd, malloc'd or (recently) free'd

To avoid the issue, check the number of cursors specified and return a
BadValue error in both the proc handler (early) and the animated cursor
creation (as this is a public function) if there is 0 or less cursor.

CVE-2025-49175

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: José Expósito <jexposit@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
---
render/animcur.c | 3 +++
render/render.c | 2 ++
2 files changed, 5 insertions(+)

diff --git a/render/animcur.c b/render/animcur.c
index f906cd8130..1194cee7e7 100644
--- a/render/animcur.c
+++ b/render/animcur.c
@@ -305,6 +305,9 @@ AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor,
int rc = BadAlloc, i;
AnimCurPtr ac;

+ if (ncursor <= 0)
+ return BadValue;
+
for (i = 0; i < screenInfo.numScreens; i++)
if (!GetAnimCurScreen(screenInfo.screens[i]))
return BadImplementation;
diff --git a/render/render.c b/render/render.c
index 113f6e0c5a..fe9f03c8c8 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1799,6 +1799,8 @@ ProcRenderCreateAnimCursor(ClientPtr client)
ncursor =
(client->req_len -
(bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
+ if (ncursor <= 0)
+ return BadValue;
cursors = xallocarray(ncursor, sizeof(CursorPtr) + sizeof(CARD32));
if (!cursors)
return BadAlloc;
--
GitLab

39 changes: 39 additions & 0 deletions SPECS/xorg-x11-server-Xwayland/CVE-2025-49177.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From fec15c9463b629600306a25fb01801353b6a9bf6 Mon Sep 17 00:00:00 2001
From: Kevin Lockwood <v-klockwood@microsoft.com>
Date: Mon, 23 Jun 2025 15:22:44 -0700
Subject: [PATCH] [Medium] Patch xorg-x11-server-Xwayland for CVE-2025-49177

Upstream Patch Link: https://gitlab.freedesktop.org/xorg/xserver/-/commit/ab02fb96b1c701c3bb47617d965522c34befa6af.patch

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>

Only edit to the upstream patch was because the patcher could not find
where to position a hunk
---
xfixes/disconnect.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xfixes/disconnect.c b/xfixes/disconnect.c
index e412942..b3529af 100644
--- a/xfixes/disconnect.c
+++ b/xfixes/disconnect.c
@@ -69,6 +69,7 @@ ProcXFixesSetClientDisconnectMode(ClientPtr client)
ClientDisconnectPtr pDisconnect = GetClientDisconnect(client);

REQUEST(xXFixesSetClientDisconnectModeReq);
+ REQUEST_SIZE_MATCH(xXFixesSetClientDisconnectModeReq);

pDisconnect->disconnect_mode = stuff->disconnect_mode;

@@ -82,7 +83,7 @@ SProcXFixesSetClientDisconnectMode(ClientPtr client)

swaps(&stuff->length);

- REQUEST_AT_LEAST_SIZE(xXFixesSetClientDisconnectModeReq);
+ REQUEST_SIZE_MATCH(xXFixesSetClientDisconnectModeReq);

swapl(&stuff->disconnect_mode);

--
2.34.1

47 changes: 47 additions & 0 deletions SPECS/xorg-x11-server-Xwayland/CVE-2025-49178.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From d55c54cecb5e83eaa2d56bed5cc4461f9ba318c2 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Mon, 28 Apr 2025 10:46:03 +0200
Subject: [PATCH] os: Account for bytes to ignore when sharing input buffer

Upstream Patch Link: https://gitlab.freedesktop.org/xorg/xserver/-/commit/d55c54cecb5e83eaa2d56bed5cc4461f9ba318c2.patch

When reading requests from the clients, the input buffer might be shared
and used between different clients.

If a given client sends a full request with non-zero bytes to ignore,
the bytes to ignore may still be non-zero even though the request is
full, in which case the buffer could be shared with another client who's
request will not be processed because of those bytes to ignore, leading
to a possible hang of the other client request.

To avoid the issue, make sure we have zero bytes to ignore left in the
input request when sharing the input buffer with another client.

CVE-2025-49178

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
---
os/io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/os/io.c b/os/io.c
index 3e39c10e6f..e7b76b9cea 100644
--- a/os/io.c
+++ b/os/io.c
@@ -441,7 +441,7 @@ ReadRequestFromClient(ClientPtr client)
*/

gotnow -= needed;
- if (!gotnow)
+ if (!gotnow && !oci->ignoreBytes)
AvailableInput = oc;
if (move_header) {
if (client->req_len < bytes_to_int32(sizeof(xBigReq) - sizeof(xReq))) {
--
GitLab

41 changes: 41 additions & 0 deletions SPECS/xorg-x11-server-Xwayland/CVE-2025-49179.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From dcf8726020de572e28ae4f9b0b40be2a6ea27a2c Mon Sep 17 00:00:00 2001
From: Kevin Lockwood <v-klockwood@microsoft.com>
Date: Mon, 23 Jun 2025 14:21:55 -0700
Subject: [PATCH] Patch xorg-x11-server-Xwayland for CVE-2025-49179

Upstream Patch Link: https://gitlab.freedesktop.org/xorg/xserver/-/commit/2bde9ca49a8fd9a1e6697d5e7ef837870d66f5d4.patch

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
---
record/record.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/record/record.c b/record/record.c
index ca9254c..311ec1a 100644
--- a/record/record.c
+++ b/record/record.c
@@ -46,6 +46,7 @@ and Jim Haggerty of Metheus.
#include "swaprep.h"
#include "inputstr.h"
#include "scrnintstr.h"
+#include "include/opaque.h"

#include <stdio.h>
#include <assert.h>
@@ -1299,6 +1300,13 @@ RecordSanityCheckRegisterClients(RecordContextPtr pContext, ClientPtr client,
int i;
XID recordingClient;

+ /* LimitClients is 2048 at max, way less that MAXINT */
+ if (stuff->nClients > LimitClients)
+ return BadValue;
+
+ if (stuff->nRanges > (MAXINT - 4 * stuff->nClients) / SIZEOF(xRecordRange))
+ return BadValue;
+
if (((client->req_len << 2) - SIZEOF(xRecordRegisterClientsReq)) !=
4 * stuff->nClients + SIZEOF(xRecordRange) * stuff->nRanges)
return BadLength;
--
2.34.1

42 changes: 42 additions & 0 deletions SPECS/xorg-x11-server-Xwayland/CVE-2025-49180.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From 3c3a4b767b16174d3213055947ea7f4f88e10ec6 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Tue, 20 May 2025 15:18:19 +0200
Subject: [PATCH] randr: Check for overflow in RRChangeProviderProperty()

Upstream Patch Link: https://gitlab.freedesktop.org/xorg/xserver/-/commit/3c3a4b767b16174d3213055947ea7f4f88e10ec6.patch

A client might send a request causing an integer overflow when computing
the total size to allocate in RRChangeProviderProperty().

To avoid the issue, check that total length in bytes won't exceed the
maximum integer value.

CVE-2025-49180

This issue was discovered by Nils Emmerich <nemmerich@ernw.de> and
reported by Julian Suleder via ERNW Vulnerability Disclosure.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2024>
---
randr/rrproviderproperty.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/randr/rrproviderproperty.c b/randr/rrproviderproperty.c
index 69f66ed278..0c3dcd1bc5 100644
--- a/randr/rrproviderproperty.c
+++ b/randr/rrproviderproperty.c
@@ -182,7 +182,8 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,

if (mode == PropModeReplace || len > 0) {
void *new_data = NULL, *old_data = NULL;
-
+ if (total_len > MAXINT / size_in_bytes)
+ return BadValue;
total_size = total_len * size_in_bytes;
new_value.data = (void *) malloc(total_size);
if (!new_value.data && total_size) {
--
GitLab

17 changes: 15 additions & 2 deletions SPECS/xorg-x11-server-Xwayland/xorg-x11-server-Xwayland.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Distribution: Azure Linux
Summary: Xwayland
Name: xorg-x11-server-Xwayland
Version: 24.1.6
Release: 1%{?dist}
Release: 2%{?dist}

License: MIT
URL: http://www.x.org
Expand Down Expand Up @@ -87,7 +87,13 @@ BuildRequires: pkgconfig(xcb-aux)
BuildRequires: pkgconfig(xcb-image)
BuildRequires: pkgconfig(xcb-keysyms)
BuildRequires: pkgconfig(xcb-renderutil)


Patch0: CVE-2025-49175.patch
Patch1: CVE-2025-49177.patch
Patch2: CVE-2025-49178.patch
Patch3: CVE-2025-49179.patch
Patch4: CVE-2025-49180.patch

%description
Xwayland is an X server for running X clients under Wayland.

Expand Down Expand Up @@ -137,6 +143,13 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_libdir}/pkgconfig/xwayland.pc

%changelog
* Mon Jun 23 2025 Kevin Lockwood <v-klockwood@microsoft.com> - 24.1.6-2
- Add patch for CVE-2025-49175
- Add patch for CVE-2025-49177
- Add patch for CVE-2025-49178
- Add patch for CVE-2025-49179
- Add patch for CVE-2025-49180

* Tue Mar 04 2025 CBL-Mariner Servicing Account <cblmargh@microsoft.com> - 24.1.6-1
- Auto-upgrade to 24.1.6 - to fix CVE-2025-26594, CVE-2025-26595, CVE-2025-26596, CVE-2025-26597, CVE-2025-26598, CVE-2025-26599, CVE-2025-26600, CVE-2025-26601[High]
- Remove older applied patch for CVE-2024-9632
Expand Down
Loading