X.Org Security Advisory: multiple security issues in X server extensions

2022-12-13 Thread Peter Hutterer
X.Org Security Advisory: Dec 14, 2022

Multiple security issues in X server extensions
===

All theses issues can lead to local privileges elevation on systems
where the X server is running privileged and remote code execution for
ssh X forwarding sessions.

* CVE-2022-46340/ZDI-CAN-19265: X.Org Server XTestSwapFakeInput stack
overflow

The swap handler for the XTestFakeInput request of the XTest extension
may corrupt the stack if GenericEvents with lengths larger than 32 bytes
are sent through a the XTestFakeInput request.

This issue does not affect systems where client and server use the same
byte order.

* CVE-2022-46341/ZDI-CAN-19381: X.Org Server XIPassiveUngrab
out-of-bounds access

The handler for the XIPassiveUngrab request accesses out-of-bounds
memory when invoked with a high keycode or button code.

* CVE-2022-46342/ZDI-CAN-19400: X.Org Server XvdiSelectVideoNotify
use-after-free

The handler for the XvdiSelectVideoNotify request may write to memory
after it has been freed.

* CVE-2022-46343/ZDI-CAN-19404: X.Org Server ScreenSaverSetAttributes
use-after-free

The handler for the ScreenSaverSetAttributes request may write to memory
after it has been freed.

* CVE-2022-46344/ZDI-CAN-19405: X.Org Server XIChangeProperty
out-of-bounds access

The handler for the XIChangeProperty request has a length-validation
issues, resulting in out-of-bounds memory reads and potential
information disclosure.

* CVE-2022-46283/ZDI-CAN-19530: X.Org Server XkbGetKbdByName use-after-free

The XkbCopyNames function left a dangling pointer to freed memory,
resulting in out-of-bounds memory access on subsequent XkbGetKbdByName
requests.


Patches
---
Patches for theses issues have been committed to the xorg server git
repository. xorg-server 21.1.5 will be released shortly and will include
these patches.


- commit b320ca0ffe4c0c872eeb3a93d9bde21f765c7c63

Xtest: disallow GenericEvents in XTestSwapFakeInput

XTestSwapFakeInput assumes all events in this request are
sizeof(xEvent) and iterates through these in 32-byte increments.
However, a GenericEvent may be of arbitrary length longer than 32 bytes,
so any GenericEvent in this list would result in subsequent events to be
misparsed.

Additional, the swapped event is written into a stack-allocated struct
xEvent (size 32 bytes). For any GenericEvent longer than 32 bytes,
swapping the event may thus smash the stack like an avocado on toast.

Catch this case early and return BadValue for any GenericEvent.
Which is what would happen in unswapped setups anyway since XTest
doesn't support GenericEvent.

CVE-2022-46340, ZDI-CAN 19265


- commit 51eb63b0ee1509c6c6b8922b0e4aa037faa6f78b

Xi: disallow passive grabs with a detail > 255

The XKB protocol effectively prevents us from ever using keycodes above
255. For buttons it's theoretically possible but realistically too niche
to worry about. For all other passive grabs, the detail must be zero
anyway.

This fixes an OOB write:

ProcXIPassiveUngrabDevice() calls DeletePassiveGrabFromList with a
temporary grab struct which contains tempGrab->detail.exact = stuff->detail.
For matching existing grabs, DeleteDetailFromMask is called with the
stuff->detail value. This function creates a new mask with the one bit
representing stuff->detail cleared.

However, the array size for the new mask is 8 * sizeof(CARD32) bits,
thus any detail above 255 results in an OOB array write.

CVE-2022-46341, ZDI-CAN 19381


- commit b79f32b57cc0c1186b2899bce7cf89f7b325161b

Xext: free the XvRTVideoNotify when turning off from the same client

This fixes a use-after-free bug:

When a client first calls XvdiSelectVideoNotify() on a drawable with a
TRUE onoff argument, a struct XvVideoNotifyRec is allocated. This struct
is added twice to the resources:
- as the drawable's XvRTVideoNotifyList. This happens only once per
  drawable, subsequent calls append to this list.
- as the client's XvRTVideoNotify. This happens for every client.

The struct keeps the ClientPtr around once it has been added for a
client. The idea, presumably, is that if the client disconnects we can
remove all structs from the drawable's list that match the client (by
resetting the ClientPtr to NULL), but if the drawable is destroyed we
can remove and free the whole list.

However, if the same client then calls XvdiSelectVideoNotify() on the
same drawable with a FALSE onoff argument, only the ClientPtr on the
existing struct was set to NULL. The struct itself remained in the
client's resources.

If the drawable is now destroyed, the resource system invokes
XvdiDestroyVideoNotifyList which frees the whole list for this drawable
- including our struct. This function however does not free the resource
for the client since our ClientPtr is NULL.

Later, when the client is destroyed and the resource system invokes
XvdiDestroyVideoNotify, we unconditionally set the ClientPtr to NULL. On
a struct that has been freed previously. This i

[ANNOUNCE] xorg-server 21.1.5

2022-12-13 Thread Peter Hutterer
This release fixes 6 recently reported security vulnerabilities in
various extensions. The CVE numbers are:
CVE-2022-46340, CVE-2022-46341, CVE-2022-46342, CVE-2022-46343,
CVE-2022-46344, and CVE-2022-4283

For details on the these issues please see the security advisory here:
https://lists.x.org/archives/xorg-announce/2022-December/003302.html

Jeremy Huddleston Sequoia (3):
  xquartz: Remove unused macro (X11LIBDIR)
  xquartz: Move default applications list outside of the main executable
  meson: Don't build COMPOSITE for XQuartz

Peter Hutterer (8):
  Xtest: disallow GenericEvents in XTestSwapFakeInput
  Xi: disallow passive grabs with a detail > 255
  Xext: free the XvRTVideoNotify when turning off from the same client
  Xext: free the screen saver resource when replacing it
  Xi: return an error from XI property changes if verification failed
  Xi: avoid integer truncation in length check of ProcXIChangeProperty
  xkb: reset the radio_groups pointer to NULL after freeing it
  xserver 21.1.5

git tag: xorg-server-21.1.5

https://xorg.freedesktop.org/archive/individual/xserver/xorg-server-21.1.5.tar.gz
SHA256: 5e391867bfe44ce766a8c748e7563dc9678c229af72b5f94e221a92b1b04b7a1  
xorg-server-21.1.5.tar.gz
SHA512: 
e564e27e9cd6a535ff6cc673443c17bb8878e9ea7b4faba86e593fab514c504f995a7475a73682c4009e3973157e3efb81e89d8455d15819b617a54c93adf599
  xorg-server-21.1.5.tar.gz
PGP:  
https://xorg.freedesktop.org/archive/individual/xserver/xorg-server-21.1.5.tar.gz.sig

https://xorg.freedesktop.org/archive/individual/xserver/xorg-server-21.1.5.tar.xz
SHA256: 05b0c8301cee7c5a78083df421ba3a071891553541a417b3d85adf5cf20f8720  
xorg-server-21.1.5.tar.xz
SHA512: 
a39c6ba36f94241d330b679a9a6fe2c5fda73fc3f5a9308a7a9cfd0d58503e407291759c9e553455c07cf5a3862952ae3904334eeca29c97ff5af7cffd2e6953
  xorg-server-21.1.5.tar.xz
PGP:  
https://xorg.freedesktop.org/archive/individual/xserver/xorg-server-21.1.5.tar.xz.sig



signature.asc
Description: PGP signature


[ANNOUNCE] xwayland 22.1.6

2022-12-13 Thread Peter Hutterer
This release fixes 6 recently reported security vulnerabilities in
various extensions. The CVE numbers are:
CVE-2022-46340, CVE-2022-46341, CVE-2022-46342, CVE-2022-46343,
CVE-2022-46344, and CVE-2022-4283

For details on the these issues please see the security advisory here:
https://lists.x.org/archives/xorg-announce/2022-December/003302.html

Peter Hutterer (8):
  Xtest: disallow GenericEvents in XTestSwapFakeInput
  Xi: disallow passive grabs with a detail > 255
  Xext: free the XvRTVideoNotify when turning off from the same client
  Xext: free the screen saver resource when replacing it
  Xi: return an error from XI property changes if verification failed
  Xi: avoid integer truncation in length check of ProcXIChangeProperty
  xkb: reset the radio_groups pointer to NULL after freeing it
  Bump to version 22.1.6

git tag: xwayland-22.1.6

https://xorg.freedesktop.org/archive/individual/xserver/xwayland-22.1.6.tar.xz
SHA256: 9e4243f03d00fd12435aee39db4ce1071fc4786ffc52547e8a07a65ab55b0e7c  
xwayland-22.1.6.tar.xz
SHA512: 
a78f44f14a6c1e25afbf245c5c757a253f0607afdc80c8b852cf6f810247566d1cc17b63d4442a21d8e69bdb696faf1014438ad98a977fbed9a11b9c5b85e0a4
  xwayland-22.1.6.tar.xz
PGP:  
https://xorg.freedesktop.org/archive/individual/xserver/xwayland-22.1.6.tar.xz.sig



signature.asc
Description: PGP signature