Bug 2548510

Summary: CVE-2026-93520 tigervnc: xorg-x11-server: arbitrary code execution via out-of-bounds write in XKB keycode handling [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": ["b4135cf9-b336-4eb8-8a81-360ebf453c7c"]}
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:05 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:46:38 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.

This is caused by an incomplete fix regression from commit a3171732d.
     XkbAllocNames() still uses max_key_code+1 for the names->keys allocation
     size, while memset in the ChangeKeycodeRange path uses MAP_LENGTH which
     can be larger. This causes a heap out-of-bounds write when the keycode
     range is changed to a value where MAP_LENGTH exceeds max_key_code+1.

     An authenticated X client can trigger this by sending XKB requests that
     change the keycode range.

     The heap out-of-bounds write can lead to arbitrary code execution or denial
     of service.

     Fixed in: xorg-server-21.1.25 and xwayland-24.1.14
     Fix: https://gitlab.freedesktop.org/xorg/xserver/-/commit/TBD
     Found by: Anonymous working with TrendAI Zero Day Initiative.
               (ZDI-CAN-31941)


* Patch
From 58e2874f69ef83323cdd18a4004535e06a8947bb Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer>
Date: Wed, 26 Aug 2026 17:04:03 +1000
Subject: [PATCH xserver] xkb: allocate names->keys to MAP_LENGTH in
 XkbAllocNames

Commit a3171732d ("xkb: Always use MAP_LENGTH keymap size") converted
most XKB allocation functions to use MAP_LENGTH (256) instead of
max_key_code + 1. It also removed the per-array reallocarray() calls in
XkbChangeKeycodeRange(), replacing them with a memset up to MAP_LENGTH.
However, XkbAllocNames() was missed and still allocates names->keys to
max_key_code + 1.

When a keycodes component with max_key_code < 255 is loaded (e.g.
sun(type6) with max_key_code=132) and then a SetMap request extends
maxKeyCode to 255, XkbChangeKeycodeRange() memsets names->keys from
max_key_code to MAP_LENGTH-1, writing past the undersized allocation.

Fix by allocating names->keys to MAP_LENGTH, consistent with all other
keymap arrays after a3171732d.

This vulnerability was discovered by:
  Anonymous working with TrendAI Zero Day Initiative

ZDI-CAN-31941

CVE-2026-93520

Fixes: a3171732da50 ("xkb: Always use MAP_LENGTH keymap size")

Assisted-by: Claude:claude-opus-4-6
#+begin_src diff
---
 xkb/XKBAlloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c
index dced42eebd2c..314a858ddb09 100644
--- a/xkb/XKBAlloc.c
+++ b/xkb/XKBAlloc.c
@@ -143,17 +143,17 @@ XkbAllocNames(XkbDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases)
             }
         }
     }
     if ((which & XkbKeyNamesMask) && (names->keys == NULL)) {
         if ((!XkbIsLegalKeycode(xkb->min_key_code)) ||
             (!XkbIsLegalKeycode(xkb->max_key_code)) ||
             (xkb->max_key_code < xkb->min_key_code))
             return BadValue;
-        names->keys = calloc((xkb->max_key_code + 1), sizeof(XkbKeyNameRec));
+        names->keys = calloc(MAP_LENGTH, sizeof(XkbKeyNameRec));
         if (names->keys == NULL)
             return BadAlloc;
     }
     if ((which & XkbKeyAliasesMask) && (nTotalAliases > 0)) {
         if (names->key_aliases == NULL) {
             names->key_aliases = calloc(nTotalAliases, sizeof(XkbKeyAliasRec));
         }
         else if (nTotalAliases > names->num_key_aliases) {
-- 
2.55.0
#+end_src

Comment 1 Fedora Update System 2026-11-03 13:40:28 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:54 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:45:00 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:31 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:05 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:12 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.