Bug 2548480

Summary: CVE-2026-93518 tigervnc: xorg-x11-server: arbitrary code execution via integer truncation during keyboard mapping resize [fedora-all]
Product: [Fedora] Fedora Reporter: Rafael Pandini <rpandini>
Component: tigervncAssignee: Jan Grulich <jgrulich>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: jgrulich
Target Milestone: ---Keywords: Security, SecurityTracking
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: {"flaws": ["566b09ae-53d1-4bf3-8a7b-47279d590ee8"]}
Fixed In Version: tigervnc-1.16.2-9.fc44 tigervnc-1.16.2-9.fc45 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2026-11-11 01:06:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rafael Pandini 2026-10-09 11:04:03 UTC
Disclaimer: Community trackers are created by Red Hat Product Security team on a best effort basis. Package maintainers are required to ascertain if the flaw indeed affects their package, before starting the update process.

In XkbResizeKeyType(), the size_syms variable is declared as unsigned
     short. The expression (nTotal * 15) / 10 can exceed 65535 for large
     nTotal values, and the result is truncated when assigned to the
     unsigned short variable. This causes an undersized allocation, and
     subsequent writes overflow the heap buffer.

     An authenticated X client can trigger this by sending XKB requests that
     cause a key type resize with a sufficiently large nTotal value.

     The heap buffer overflow resulting from the truncated allocation can lead
     to arbitrary code execution or denial of service.

     Fixed in: xorg-server-21.1.25 and xwayland-24.1.14

Fields in XkbClientMapRec and XkbServerMapRec that denote size/num
and are unsigned short can result in truncations. For example
when XkbResizeKeyType() computes the new size_syms value as
(nTotal * 15) / 10, the result may be implicitly truncated to 16
bits on assignment. This causes an undersized calloc allocation, and the
subsequent copy loop writes based on the actual (untruncated) key count,
resulting in a heap buffer overflow. A similar truncation may happen
in XkbResizeKeySyms() and XkbResizeKeyActions().

Widen the fields from unsigned short to unsigned int. These are internal
server structures, not wire protocol types.

---
 include/xkbstr.h | 8 ++++----
 xkb/XKBMAlloc.c  | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/xkbstr.h b/include/xkbstr.h
index 749f1f26e500..45a15f37632a 100644
--- a/include/xkbstr.h
+++ b/include/xkbstr.h
@@ -307,18 +307,18 @@ typedef struct _XkbControls {
 } XkbControlsRec, *XkbControlsPtr;
 
 #define	XkbAX_AnyFeedback(c)	((c)->enabled_ctrls&XkbAccessXFeedbackMask)
 #define	XkbAX_NeedOption(c,w)	((c)->ax_options&(w))
 #define	XkbAX_NeedFeedback(c, w) (XkbAX_AnyFeedback((c)) && \
                                   XkbAX_NeedOption((c), (w)))
 
 typedef struct _XkbServerMapRec {
-    unsigned short num_acts;
-    unsigned short size_acts;
+    unsigned int num_acts;
+    unsigned int size_acts;
     XkbAction *acts;
 
     XkbBehavior *behaviors;
     unsigned short *key_acts;
 #if defined(__cplusplus) || defined(c_plusplus)
     /* explicit is a C++ reserved word */
     unsigned char *c_explicit;
 #else
@@ -341,18 +341,18 @@ typedef struct _XkbSymMapRec {
     unsigned short offset;
 } XkbSymMapRec, *XkbSymMapPtr;
 
 typedef struct _XkbClientMapRec {
     unsigned char size_types;
     unsigned char num_types;
     XkbKeyTypePtr types;
 
-    unsigned short size_syms;
-    unsigned short num_syms;
+    unsigned int size_syms;
+    unsigned int num_syms;
     KeySym *syms;
     XkbSymMapPtr key_sym_map;
 
     unsigned char *modmap;
 } XkbClientMapRec, *XkbClientMapPtr;
 
 #define	XkbCMKeyGroupInfo(m, k) ((m)->key_sym_map[(k)].group_info)
 #define	XkbCMKeyNumGroups(m, k) (XkbNumGroups((m)->key_sym_map[(k)].group_info))
diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c
index 78e597f3d93e..8f8ac28fadb9 100644
--- a/xkb/XKBMAlloc.c
+++ b/xkb/XKBMAlloc.c
@@ -380,17 +380,18 @@ XkbResizeKeyType(XkbDescPtr xkb,
                 nTotal += XkbKeyNumSyms(xkb, i);
             else {
                 nTotal += XkbKeyNumGroups(xkb, i) * new_num_lvls;
                 nResize++;
             }
         }
         if (nResize > 0) {
             int nextMatch;
-
+            if (nTotal > INT_MAX / 15)
+                return BadAlloc;
             xkb->map->size_syms = (nTotal * 15) / 10;
             newSyms = calloc(xkb->map->size_syms, sizeof(KeySym));
             if (newSyms == NULL)
                 return BadAlloc;
             nextMatch = 0;
             nSyms = 1;
             for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
                 if (matchingKeys[nextMatch] == i) {
-- 
2.55.0

Comment 1 Fedora Update System 2026-11-03 13:40:25 UTC
FEDORA-2026-6b7d3e80f7 (tigervnc-1.16.2-9.fc44) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-6b7d3e80f7

Comment 2 Fedora Update System 2026-11-03 13:40:51 UTC
FEDORA-2026-80450b1573 (tigervnc-1.16.2-9.fc45) has been submitted as an update to Fedora 45.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-80450b1573

Comment 3 Fedora Update System 2026-11-04 02:44:58 UTC
FEDORA-2026-6b7d3e80f7 has been pushed to the Fedora 44 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-6b7d3e80f7`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-6b7d3e80f7

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 Fedora Update System 2026-11-04 03:35:29 UTC
FEDORA-2026-80450b1573 has been pushed to the Fedora 45 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-80450b1573`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-80450b1573

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2026-11-11 01:06:02 UTC
FEDORA-2026-6b7d3e80f7 (tigervnc-1.16.2-9.fc44) has been pushed to the Fedora 44 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Fedora Update System 2026-11-11 02:00:10 UTC
FEDORA-2026-80450b1573 (tigervnc-1.16.2-9.fc45) has been pushed to the Fedora 45 stable repository.
If problem still persists, please make note of it in this bug report.