Skip to content

Commit d24f16c

Browse files
[AUTO-CHERRYPICK] Fix CVE-2024-9632 for xorg-x11-server - branch main (#11103)
Co-authored-by: chalamalasetty <[email protected]>
1 parent bf30f73 commit d24f16c

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-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/xorg-x11-server.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Summary: X.Org X11 X server
2222
Name: xorg-x11-server
2323
Version: 1.20.10
24-
Release: 12%{?dist}
24+
Release: 13%{?dist}
2525
License: MIT
2626
Vendor: Microsoft Corporation
2727
Distribution: Mariner
@@ -69,6 +69,7 @@ Patch19: Avoid_possible_double-free_in_ProcRenderAddGlyphs.patch
6969
Patch20: CVE-2024-0229.patch
7070
Patch21: CVE-2024-0409.patch
7171
Patch22: CVE-2024-21886.patch
72+
Patch23: CVE-2024-9632.patch
7273

7374
# Backported Xwayland randr resolution change emulation support
7475
Patch501: 0001-dix-Add-GetCurrentClient-helper.patch
@@ -399,6 +400,9 @@ find %{buildroot} -type f -name "*.la" -delete -print
399400
%{_datadir}/aclocal/xorg-server.m4
400401

401402
%changelog
403+
* Thu Nov 14 2024 Suresh Babu Chalamalasetty <[email protected]> - 1.20.10-13
404+
- Fix for CVE-2024-9632
405+
402406
* Tue Sep 17 2024 Sumedh Sharma <[email protected]> - 1.20.10-12
403407
- Add patch to resolve CVE-2024-0229, CVE-2024-0409 & CVE-2024-21886.
404408

0 commit comments

Comments
 (0)