CVE-2026-50256 (ZDI-CAN-30136) CVE-2026-50263 (ZDI-CAN-30168) CVE-2026-50262 (ZDI-CAN-30165) CVE-2026-50259 (ZDI-CAN-30161) CVE-2026-50258 (ZDI-CAN-30160) CVE-2026-50261 (ZDI-CAN-30164) CVE-2026-50257 (ZDI-CAN-30159) CVE-2026-50260 (ZDI-CAN-30163) Resolves: https://redhat.atlassian.net/browse/RHEL-182444
90 lines
3.3 KiB
Diff
90 lines
3.3 KiB
Diff
From 93596a0b4dec958cc8f614fc25a2b68c8edc852a Mon Sep 17 00:00:00 2001
|
|
From: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Date: Wed, 29 Apr 2026 05:40:33 +0000
|
|
Subject: [PATCH xserver 7/7] dix: increase XLFDMAXFONTNAMELEN to match
|
|
libXfont2's MAXFONTNAMELEN
|
|
|
|
XLFDMAXFONTNAMELEN was 256 bytes, but libXfont2 defines MAXFONTNAMELEN
|
|
as 1024 and allows font names and alias targets up to that length in
|
|
fonts.alias files.
|
|
|
|
doListFontsAndAliases copies the resolved alias target into a
|
|
stack-allocated tmp_pattern[XLFDMAXFONTNAMELEN] and then into
|
|
c->current.pattern[XLFDMAXFONTNAMELEN] (defined in LFWIstateRec).
|
|
doListFontsWithInfo has the same pattern, copying the resolved name into
|
|
c->current.pattern[]. With the old 256-byte limit, a fonts.alias entry
|
|
with a target name between 257 and 1023 bytes would overflow both
|
|
buffers.
|
|
|
|
An attacker can exploit this by:
|
|
1. Creating a font directory with a fonts.alias containing an alias
|
|
whose target name exceeds 256 bytes
|
|
2. Using SetFontPath to add the malicious directory
|
|
3. Calling ListFonts with the alias name to trigger alias resolution
|
|
4. The oversized resolved name overflows the 256-byte stack buffer
|
|
|
|
Increase XLFDMAXFONTNAMELEN from 256 to 1024 to match libXfont2's
|
|
MAXFONTNAMELEN, ensuring the server can handle any name the font library
|
|
produces.
|
|
|
|
This vulnerability was discovered by:
|
|
Anonymous working with TrendAI Zero Day Initiative
|
|
|
|
ZDI-CAN-30136
|
|
|
|
Assisted-by: Claude:claude-opus-4-6
|
|
(cherry picked from commit bb5158f962dc935e58ef8b4b5fcb31be201a6e07)
|
|
|
|
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2230>
|
|
---
|
|
dix/dixfonts.c | 8 ++++++++
|
|
include/closestr.h | 7 ++++++-
|
|
2 files changed, 14 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
|
|
index 4fdb60699..b7eb09f38 100644
|
|
--- a/dix/dixfonts.c
|
|
+++ b/dix/dixfonts.c
|
|
@@ -670,6 +670,10 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
|
|
* is BadFontName, indicating the alias resolution
|
|
* is complete.
|
|
*/
|
|
+ if (resolvedlen > XLFDMAXFONTNAMELEN) {
|
|
+ err = BadFontName;
|
|
+ goto ContBadFontName;
|
|
+ }
|
|
memcpy(tmp_pattern, resolved, resolvedlen);
|
|
if (c->haveSaved) {
|
|
char *tmpname;
|
|
@@ -932,6 +936,10 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
|
|
memcpy(c->savedName, name, namelen + 1);
|
|
aliascount = 20;
|
|
}
|
|
+ if (namelen > XLFDMAXFONTNAMELEN) {
|
|
+ err = BadFontName;
|
|
+ goto ContBadFontName;
|
|
+ }
|
|
memmove(c->current.pattern, name, namelen);
|
|
c->current.patlen = namelen;
|
|
c->current.max_names = 1;
|
|
diff --git a/include/closestr.h b/include/closestr.h
|
|
index 60e6f09bc..7567ac6ea 100644
|
|
--- a/include/closestr.h
|
|
+++ b/include/closestr.h
|
|
@@ -57,7 +57,12 @@ typedef struct _OFclosure {
|
|
|
|
/* ListFontsWithInfo */
|
|
|
|
-#define XLFDMAXFONTNAMELEN 256
|
|
+/* libXfont2 allows font names/aliases up to MAXFONTNAMELEN (1024) bytes in
|
|
+ * fonts.alias files. The server's pattern buffers must be large enough to
|
|
+ * hold resolved alias targets returned by the font library.
|
|
+ * ZDI-CAN-30136
|
|
+ */
|
|
+#define XLFDMAXFONTNAMELEN 1024
|
|
typedef struct _LFWIstate {
|
|
char pattern[XLFDMAXFONTNAMELEN];
|
|
int patlen;
|
|
--
|
|
2.54.0
|
|
|