Fix for CVE-2024-9632

Resolves: https://issues.redhat.com/browse/RHEL-61997
This commit is contained in:
Olivier Fourdan 2024-10-30 09:34:38 +01:00
parent b4ee0196b4
commit 256dfbcb5b
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,57 @@
From 26120df7aae6b5bf8086fb4d871d3b1a07ddacdb Mon Sep 17 00:00:00 2001
From: Matthieu Herrb <matthieu@herrb.eu>
Date: Thu, 10 Oct 2024 10:37:28 +0200
Subject: [PATCH xserver] xkb: Fix buffer overflow in _XkbSetCompatMap()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The _XkbSetCompatMap() function attempts to resize the `sym_interpret`
buffer.
However, It didn't update its size properly. It updated `num_si` only,
without updating `size_si`.
This may lead to local privilege escalation if the server is run as root
or remote code execution (e.g. x11 over ssh).
CVE-2024-9632, ZDI-CAN-24756
This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: José Expósito <jexposit@redhat.com>
(cherry picked from commit 85b776571487f52e756f68a069c768757369bfe3)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1735>
---
xkb/xkb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 8d52e25df..8b63e34b5 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -2990,13 +2990,13 @@ _XkbSetCompatMap(ClientPtr client, DeviceIntPtr dev,
XkbSymInterpretPtr sym;
unsigned int skipped = 0;
- if ((unsigned) (req->firstSI + req->nSI) > compat->num_si) {
- compat->num_si = req->firstSI + req->nSI;
+ if ((unsigned) (req->firstSI + req->nSI) > compat->size_si) {
+ compat->num_si = compat->size_si = req->firstSI + req->nSI;
compat->sym_interpret = reallocarray(compat->sym_interpret,
- compat->num_si,
+ compat->size_si,
sizeof(XkbSymInterpretRec));
if (!compat->sym_interpret) {
- compat->num_si = 0;
+ compat->num_si = compat->size_si = 0;
return BadAlloc;
}
}
--
2.47.0

View File

@ -9,7 +9,7 @@
Summary: Xwayland Summary: Xwayland
Name: xorg-x11-server-Xwayland Name: xorg-x11-server-Xwayland
Version: 23.2.7 Version: 23.2.7
Release: 1%{?gitdate:.%{gitdate}git%{shortcommit}}%{?dist} Release: 2%{?gitdate:.%{gitdate}git%{shortcommit}}%{?dist}
URL: http://www.x.org URL: http://www.x.org
%if 0%{?gitdate} %if 0%{?gitdate}
@ -18,6 +18,9 @@ Source0: https://gitlab.freedesktop.org/xorg/%{pkgname}/-/archive/%{commit}/%{
Source0: https://www.x.org/pub/individual/xserver/%{pkgname}-%{version}.tar.xz Source0: https://www.x.org/pub/individual/xserver/%{pkgname}-%{version}.tar.xz
%endif %endif
# Fix for CVE-2024-9632
Patch1: 0001-xkb-Fix-buffer-overflow-in-_XkbSetCompatMap.patch
License: MIT License: MIT
Requires: xorg-x11-server-common Requires: xorg-x11-server-common
@ -135,6 +138,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_libdir}/pkgconfig/xwayland.pc %{_libdir}/pkgconfig/xwayland.pc
%changelog %changelog
* Wed Oct 30 2024 Olivier Fourdan <ofourdan@redhat.com> - 23.2.7-2
- Fix for CVE-2024-9632 - (RHEL-61997)
* Thu May 16 2024 Olivier Fourdan <ofourdan@redhat.com> - 23.2.7-1 * Thu May 16 2024 Olivier Fourdan <ofourdan@redhat.com> - 23.2.7-1
- xwayland 23.2.7 - (RHEL-29912) - xwayland 23.2.7 - (RHEL-29912)