Skip to content

Commit 0880420

Browse files
[AUTO-CHERRYPICK] Fix CVE-2024-9632 for xorg-x11-server-Xwayland - branch 3.0-dev (#11190)
Co-authored-by: chalamalasetty <[email protected]>
1 parent 7314156 commit 0880420

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
From 85b776571487f52e756f68a069c768757369bfe3 Mon Sep 17 00:00:00 2001
2+
From: Matthieu Herrb <[email protected]>
3+
Date: Thu, 10 Oct 2024 10:37:28 +0200
4+
Subject: [PATCH] xkb: Fix buffer overflow in _XkbSetCompatMap()
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
The _XkbSetCompatMap() function attempts to resize the `sym_interpret`
10+
buffer.
11+
12+
However, It didn't update its size properly. It updated `num_si` only,
13+
without updating `size_si`.
14+
15+
This may lead to local privilege escalation if the server is run as root
16+
or remote code execution (e.g. x11 over ssh).
17+
18+
CVE-2024-9632, ZDI-CAN-24756
19+
20+
This vulnerability was discovered by:
21+
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
22+
23+
Reviewed-by: Peter Hutterer <[email protected]>
24+
Tested-by: Peter Hutterer <[email protected]>
25+
Reviewed-by: José Expósito <[email protected]>
26+
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1733>
27+
---
28+
xkb/xkb.c | 8 ++++----
29+
1 file changed, 4 insertions(+), 4 deletions(-)
30+
31+
diff --git a/xkb/xkb.c b/xkb/xkb.c
32+
index 868d7c1e64..aaf9716b36 100644
33+
--- a/xkb/xkb.c
34+
+++ b/xkb/xkb.c
35+
@@ -2990,13 +2990,13 @@ _XkbSetCompatMap(ClientPtr client, DeviceIntPtr dev,
36+
XkbSymInterpretPtr sym;
37+
unsigned int skipped = 0;
38+
39+
- if ((unsigned) (req->firstSI + req->nSI) > compat->num_si) {
40+
- compat->num_si = req->firstSI + req->nSI;
41+
+ if ((unsigned) (req->firstSI + req->nSI) > compat->size_si) {
42+
+ compat->num_si = compat->size_si = req->firstSI + req->nSI;
43+
compat->sym_interpret = reallocarray(compat->sym_interpret,
44+
- compat->num_si,
45+
+ compat->size_si,
46+
sizeof(XkbSymInterpretRec));
47+
if (!compat->sym_interpret) {
48+
- compat->num_si = 0;
49+
+ compat->num_si = compat->size_si = 0;
50+
return BadAlloc;
51+
}
52+
}
53+
--
54+
GitLab

SPECS/xorg-x11-server-Xwayland/xorg-x11-server-Xwayland.spec

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Distribution: Azure Linux
1111
Summary: Xwayland
1212
Name: xorg-x11-server-Xwayland
1313
Version: 24.1.1
14-
Release: 2%{?dist}
14+
Release: 3%{?dist}
1515

1616
License: MIT
1717
URL: http://www.x.org
@@ -20,6 +20,7 @@ Source0: https://gitlab.freedesktop.org/xorg/%{pkgname}/-/archive/%{commit
2020
%else
2121
Source0: https://www.x.org/pub/individual/xserver/%{pkgname}-%{version}.tar.xz
2222
%endif
23+
Patch0001: CVE-2024-9632.patch
2324

2425
Requires: xkeyboard-config
2526
Requires: xkbcomp
@@ -29,6 +30,7 @@ Requires: libepoxy >= 1.5.5
2930
BuildRequires: gcc
3031
BuildRequires: git-core
3132
BuildRequires: meson
33+
BuildRequires: systemd-devel
3234

3335
BuildRequires: wayland-devel
3436
BuildRequires: desktop-file-utils
@@ -136,6 +138,10 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
136138
%{_libdir}/pkgconfig/xwayland.pc
137139

138140
%changelog
141+
* Thu Nov 14 2024 Suresh Babu Chalamalasetty <[email protected]> - 24.1.1-3
142+
- Fix for CVE-2024-9632
143+
- Added systemd-devel build requires dependency
144+
139145
* Wed Jul 10 2024 Hideyuki Nagase <[email protected]> - 24.1.1-2
140146
- Initial CBL-Mariner import from Fedora 41 (license: MIT).
141147
- License verified.

0 commit comments

Comments
 (0)