CVE-2026-94282: Out-of-bounds read in libXi's XI2 enter/leave/focus cookie conversion
AIONLYREPORT package: libXi-1.8.2-4.1.hum1 ------ Summary: OOB read in XI2 enter/leave/focus cookie conversion (wireToEnterLeave): malformed XI2 enter/leave/focus GenericEvents can cause a client-side out-of-bounds read when buttonslen exceeds the actual payload length. Requirements to exploit: An attacker must control or compromise the X server or X11 transport endpoint used by a libXi-linked client, and the client must process XI2 XIEnter, XILeave, XIFocusIn, or XIFocusOut events through the cookie conversion path. Component affected: libXi-1.8.2-4.1.hum1, src/XExtInt.c, XInputWireToCookie() and wireToEnterLeave() Version affected: libXi-1.8.2-4.1.hum1, when used by a client that accepts XI2 enter/leave/focus GenericEvents from a malicious or compromised X server Patch available: no released package fix established; proposed patch included below Version fixed: unknown Upstream coordination: Not notified. CVSS: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:H - 6.1 (MEDIUM) AV:L - The attacker must control the X server endpoint the client is already connected to, rather than reach a network service exposed by the package itself. AC:L - Crafting a GenericEvent with a short payload and oversized buttonslen is straightforward once the attacker controls that event stream. PR:N - No privileges are required on the victim host beyond providing the malicious X server data. UI:R - A user must run an affected client and connect it to the malicious or compromised X server. S:U - The effect is confined to the client process that parses the event. C:L - Adjacent in-process bytes may be copied past the received event buffer, creating limited disclosure potential, although disclosure was not directly demonstrated. I:N - The issue does not provide a write primitive or direct data modification capability. A:H - The malformed event can crash the client or otherwise disrupt event processing. Impact: Moderate. This issue can cause client-side denial of service and may allow limited disclosure of adjacent in-process data, but exploitation depends on a malicious or compromised X server and a client taking the affected XI2 cookie conversion path. That makes it harder to exploit than Red Hat's Important or Critical categories, while still representing more than minimal security impact when reachable. Embargo: no Reason: This is a client-side parsing issue with a constrained threat model, no demonstrated code execution, and straightforward operational mitigation by avoiding untrusted X servers until a fix is available. Acknowledgement: Aisle Research Vulnerability Details: In src/XExtInt.c, XInputWireToCookie() routes XIEnter, XILeave, XIFocusIn, and XIFocusOut to wireToEnterLeave() without passing validated wire-event size context. wireToEnterLeave() then trusts the wire-supplied buttonslen field when sizing the destination buffer and copying button-mask bytes: c static int wireToEnterLeave(xXIEnterEvent in, XGenericEventCookie cookie) { int len; XIEnterEvent out; len = sizeof(XIEnterEvent) + in->buttonslen 4; ... out->buttons.masklen = in->buttonslen 4; memcpy(out->buttons.mask, &in[1], out->buttons.masklen); return 1; } There is no validation on this path that buttonslen 4 fits within the received GenericEvent payload before the memcpy() occurs. A malformed XIEnter, XILeave, XIFocusIn, or XIFocusOut event can therefore drive a client-side out-of-bounds read. The directly supported impact is application crash or event-processing failure; limited in-process memory disclosure is also plausible because bytes beyond the received event buffer may be copied into cookie data. Steps to reproduce: 1. Build libXi-1.8.2-4.1.hum1 and a minimal XI2 client with AddressSanitizer enabled that selects XI2 events and processes them via XNextEvent() and the cookie path. 2. Run the client with DISPLAY pointing to a controlled X server or protocol fuzzer that can emit crafted XI2 GenericEvent messages. 3. Emit an XIEnter event (the same applies to XILeave, XIFocusIn, and XIFocusOut) with a small ge.length so the trailing payload is short, but with buttonslen set so buttonslen 4 exceeds the available payload bytes. 4. Observe an AddressSanitizer invalid read at memcpy(out->buttons.mask, &in[1], out->buttons.masklen) in wireToEnterLeave() or an equivalent client crash. Mitigation: Until this is fixed, avoid connecting libXi-linked XI2 clients to untrusted or compromised X servers. Where operationally possible, restrict applications to trusted local display servers and avoid exposing attacker-controlled X11 event streams to the affected cookie conversion path. Proposed Fix: Pass the actual received event size into wireToEnterLeave(), validate the derived button-mask length against that size, and reject malformed events before allocation and copy. diff diff --git a/libXi-1.8.2/src/XExtInt.c b/libXi-1.8.2/src/XExtInt.c index 0000000..0000000 100644 — a/libXi-1.8.2/src/XExtInt.c +++ b/libXi-1.8.2/src/XExtInt.c @@ -55,6 +55,7 @@ #include <config.h> #endif +#include <limits.h> #include <stdio.h> #include <stdint.h> #include <X11/extensions/XI.h> @@ -118,7 +119,8 @@ wireToHierarchyChangedEvent(xXIHierarchyEvent in, XGenericEventCookie cookie) static int wireToRawEvent(XExtDisplayInfo info, xXIRawEvent in, XGenericEventCookie cookie); static int -wireToEnterLeave(xXIEnterEvent in, XGenericEventCookie cookie); +wireToEnterLeave(xXIEnterEvent in, sizet eventbytes, + XGenericEventCookie cookie); static int wireToPropertyEvent(xXIPropertyEvent in, XGenericEventCookie cookie); @@ -1017,7 +1019,9 @@ XInputWireToCookie( case XIFocusIn: case XIFocusOut: cookie = (XGenericEventCookie)save; if (!wireToEnterLeave((xXIEnterEvent)event, cookie)) + if (!wireToEnterLeave((xXIEnterEvent)event, + sizeof(xEvent) + ((sizet)ge->length 4), + cookie)) { printf("XInputWireToCookie: CONVERSION FAILURE! evtype=%d\n", ge->evtype); @@ -2014,12 +2018,23 @@ wireToRawEvent(XExtDisplayInfo info, xXIRawEvent in, XGenericEventCookie coo [event][modifiers][group][button] / static int -wireToEnterLeave(xXIEnterEvent in, XGenericEventCookie cookie) +wireToEnterLeave(xXIEnterEvent in, sizet eventbytes, + XGenericEventCookie cookie) {
int len; + sizet masklen, len; XIEnterEvent out;
len = sizeof(XIEnterEvent) + in->buttonslen 4; + masklen = (sizet)in->buttonslen 4u; + + if (masklen > (sizet)INTMAX) + return 0; + if (eventbytes < sizeof(in) || masklen > eventbytes - sizeof(in)) + return 0; + if (masklen > SIZEMAX - sizeof(XIEnterEvent)) + return 0; + + len = sizeof(XIEnterEvent) + masklen;
cookie->data = out = malloc(len); if (!out) @@ -2057,8 +2072,8 @@ wireToEnterLeave(xXIEnterEvent in, XGenericEventCookie cookie) out->group.latched = in->group.latchedgroup; out->group.effective = in->group.effectivegroup; out->buttons.masklen = in->buttonslen 4;
memcpy(out->buttons.mask, &in[1], out->buttons.masklen); + out->buttons.masklen = (int)masklen; + memcpy(out->buttons.mask, &in[1], masklen);
return 1; } ------ This report was generated using AI technology. Always review AI-generated content prior to use
Other sources
An out-of-bounds read in libXi's XI2 enter/leave/focus cookie conversion in libXi before 1.8.4 could be used by malicious X server to crash an attached X client.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 1.8.4-1 - Upgrade
Upgrade
debian/libxito a version that resolves this vulnerability.Fixed in 2:1.8.4-1 - Compensating control
In libXi's XI2 cookie conversion path, pass the received event size into wireToEnterLeave() and reject malformed events before allocation or copying: verify the payload contains the button-mask bytes, check that the derived mask length fits in INT_MAX and the allocation size does not overflow SIZE_MAX.
- Compensating control
Until the fix is applied, avoid connecting libXi-linked XI2 clients to untrusted or compromised X servers; restrict applications to trusted local display servers.
Event History
Frequently Asked Questions
Which systems are exposed to this issue?
X clients that use libXi before 1.8.4 and connect to an untrusted or malicious X server are exposed. The described impact is a crash of the attached X client.
What does an attacker need to exploit it?
An attacker needs to operate or control the X server to which the affected client connects. The vector is local and requires low privileges and user interaction, according to the supplied severity vector.
What version resolves the issue?
Upgrade libXi to version 1.8.4 or later. The issue affects versions before 1.8.4.