xserver-xorg: Fix CVE-2017-10971
PATCH 1/1 xserver-xorg: Fix CVE-2017-10971
From: Jackie Huang <[email protected]>
Backport 3 patches to fix CVE-2017-10971:
In the X.Org X server before 2017-06-19, a user authenticated to an X Session could crash or execute code in the context of the X Server by exploiting a stack overflow in the endianness conversion of X Events.
Reference:
https://nvd.nist.gov/vuln/detail/CVE-2017-10971
Signed-off-by Jackie Huang <[email protected]>
--- .../xserver-xorg/CVE-2017-10971-1.patch | 76 ++++++++++++++++++++++ .../xserver-xorg/CVE-2017-10971-2.patch | 55 ++++++++++++++++ .../xserver-xorg/CVE-2017-10971-3.patch | 50 ++++++++++++++ .../xorg-xserver/xserver-xorg_1.19.3.bb | 3 + 4 files changed, 184 insertions(+) create mode 100644 meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2017-10971-1.patch create mode 100644 meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2017-10971-2.patch create mode 100644 meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2017-10971-3.patch
meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2017-10971-1.patch new file +76 -0
@@ -0,0 +1,76 @@ +From 215f894965df5fb0bb45b107d84524e700d2073c Mon Sep 17 00:00:00 2001 +From: Michal Srb <[email protected]> +Date: Wed, 24 May 2017 15:54:40 +0300 +Subject: [PATCH] dix: Disallow GenericEvent in SendEvent request. + +The SendEvent request holds xEvent which is exactly 32 bytes long, no more, +no less. Both ProcSendEvent and SProcSendEvent verify that the received data +exactly match the request size. However nothing stops the client from passing +in event with xEvent::type = GenericEvent and any value of +xGenericEvent::length. + +In the case of ProcSendEvent, the event will be eventually passed to +WriteEventsToClient which will see that it is Generic event and copy the +arbitrary length from the receive buffer (and possibly past it) and send it to +the other client. This allows clients to copy unitialized heap memory out of X +server or to crash it. + +In case of SProcSendEvent, it will attempt to swap the incoming event by +calling a swapping function from the EventSwapVector array. The swapped event +is written to target buffer, which in this case is local xEvent variable. The +xEvent variable is 32 bytes long, but the swapping functions for GenericEvents +expect that the target buffer has size matching the size of the source +GenericEvent. This allows clients to cause stack buffer overflows. + +Signed-off-by: Michal Srb <[email protected]> +Reviewed-by: Peter Hutterer <[email protected]> +Signed-off-by: Peter Hutterer <[email protected]> + +CVE: CVE-2017-10971 + +Upstream-Status: Backport [https://cgit.freedesktop.org/xorg/xserver/commit/?id=215f894965df5fb0bb45b107d84524e700d2073c] + +Signed-off-by: Jackie Huang <[email protected]> +--- + dix/events.c | 6 ++++++ + dix/swapreq.c | 7 +++++++ + 2 files changed, 13 insertions(+) + +diff --git a/dix/events.c b/dix/events.c +index 3e3a01e..d3a33ea 100644 +--- a/dix/events.c ++++ b/dix/events.c +@@ -5366,6 +5366,12 @@ ProcSendEvent(ClientPtr client) + client->errorValue = stuff->event.u.u.type; + return BadValue; + } ++ /* Generic events can have variable size, but SendEvent request holds ++ exactly 32B of event data. */ ++ if (stuff->event.u.u.type == GenericEvent) { ++ client->errorValue = stuff->event.u.u.type; ++ return BadValue; ++ } + if (stuff->event.u.u.type == ClientMessage && + stuff->event.u.u.detail != 8 && + stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) { +diff --git a/dix/swapreq.c b/dix/swapreq.c +index 719e9b8..6785059 100644 +--- a/dix/swapreq.c ++++ b/dix/swapreq.c +@@ -292,6 +292,13 @@ SProcSendEvent(ClientPtr client) + swapl(&stuff->destination); + swapl(&stuff->eventMask); + ++ /* Generic events can have variable size, but SendEvent request holds ++ exactly 32B of event data. */ ++ if (stuff->event.u.u.type == GenericEvent) { ++ client->errorValue = stuff->event.u.u.type; ++ return BadValue; ++ } ++ + /* Swap event */ + proc = EventSwapVector[stuff->event.u.u.type & 0177]; + if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */ +-- +1.7.9.5 +
meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2017-10971-2.patch new file +55 -0
55 lines not on this page · raw message
meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2017-10971-3.patch new file +50 -0
50 lines not on this page · raw message
meta/recipes-graphics/xorg-xserver/xserver-xorg_1.19.3.bb +3 -0
@@ -5,6 +5,9 @@ SRC_URI += "file://musl-arm-inb-outb.patch \ file://0002-configure.ac-Fix-wayland-scanner-and-protocols-locat.patch \ file://0003-modesetting-Fix-16-bit-depth-bpp-mode.patch \ file://0003-Remove-check-for-useSIGIO-option.patch \ + file://CVE-2017-10971-1.patch \ + file://CVE-2017-10971-2.patch \ + file://CVE-2017-10971-3.patch \ " SRC_URI[md5sum] = "015d2fc4b9f2bfe7a626edb63a62c65e" SRC_URI[sha256sum] = "677a8166e03474719238dfe396ce673c4234735464d6dadf2959b600d20e5a98"
Signature · 1 line
2.11.0