Description of problem:
Local RedHat Enterprise Linux DoS – RHEL 7.1 Kernel crashes on invalid
USB device descriptors (wacom driver) [local-DoS]
Version-Release number of selected component (if applicable):
OpenSource Security Ralf Spenneberg
Am Bahnhof 3-5
Date: November 12th, 2015
Authors: Sergej Schumilo, Hendrik Schwartke, Ralf Spenneberg
CVE: not yet assigned
CVSS: 4.9 (AV:L/AC:L/Au:N/C:N/I:N/A:C)
Title: Local RedHat Enterprise Linux DoS – RHEL 7.1 Kernel crashes on invalid
USB device descriptors (wacom driver) [local-DoS]
Severity: Critical. The Kernel panics. A reboot is required.
Ease of Exploitation: Trivial
Vulnerability type: Wrong input validation
Products: RHEL 7.1 including all updates
(for debugging-purposes we used the CentOS Kernel kernel-debuginfo-3.10.0-229.14.1.el7)
The Kernel 3.10.0-229.20.1.el7.x86_64 crashes when presented a buggy USB
device which requires the wacom driver.
Detailed product description
We confirmed the bug on the following system:
Kernel = 3.10.0-229.20.1.el7.x86_64
Further products or kernel versions have not been tested.
How reproducible: Always
Actual results: Kernel crashes
The bug was found using the USB-fuzzing framework vUSBf from Sergej Schumilo
(github.com/schumilo) using the following device descriptor:
######### PAYLOAD 1 #########
This is the configuration descriptor containing the malicious value for
bNumEndpoints causing the crash. A zero value for bNumEndpoints crashes the system.
The wacom driver assumes that there will be at least one endpoint-descriptor.
If the interface-descriptor contains a zero-value for bNumEndpoints or no endpoint-descriptor is provided, the driver tries to dereference a null-pointer and the kernel crashes:
$ nm wacom.ko.debug | grep wacom_probe
00000000000054a0 t wacom_probe
$ addr2line -e wacom.ko.debug 0x5A22
**** CentOS-Kernel linux-3.10.0-229.14.1.el7 (drivers/input/tablet/wacom-sys.c)
1309 endpoint = &intf->cur_altsetting->endpoint.desc; /* might be null-pointer */
1366 usb_fill_int_urb(wacom->irq, dev,
1367 usb_rcvintpipe(dev, endpoint->bEndpointAddress), /* possible null-pointer dereference */
1368 wacom_wac->data, features->pktlen,
1369 wacom_sys_irq, wacom, endpoint->bInterval);
1370 wacom->irq->transfer_dma = wacom->data_dma;
Proof of Concept:
1) The bug can be reproduced using USB-fuzzing framework vUSBf from Sergej Schumilo (github.com/schumilo).
The attached vUSBf-obj file contains the payload. Please let us know if you would like to use the Facedancer board.
In such case, we could also provide a patched version of vUSBf which allows to reproduce vUSBf-Payloads using the Facedancer board.
2) For a proof of concept we are providing also an Arduino firmware file. Just flash it
on Arduino Leonardo and plug it into any RHEL machine. The Arduino will
emulate the defective USB device.
avrdude -v -p ATMEGA32u4 -c avr109 -P /dev/ttyACM0 -b 57600 -U flash:w:binary.hex
The file binary.hex has been attached to this bug report.
To prevent automated sending of payloads, use a jumper to connect port D3 and
Severity and Ease of Exploitation
The security weakness can be easily exploited. Using our Arduino firmware only
physical access to the system is required.
Stacktrace, vUSBf-Payload, Arduino-Firmware attached.
Please assign a CVE for this issue since this is a local DoS of the targeted system.
CVSS 4.9 (AV:L/AC:L/Au:N/C:N/I:N/A:C)
Created attachment 1096285 [details]
Created attachment 1096288 [details]
Created attachment 1096289 [details]
Arduino firmware demonstrating the bug
This bz and bz1283377 are related, as both are caused by the same issue, zero endpoints, while the driver expects at least one endpoint to be present. The bug is that the driver does not check that at least one endpoint is present and accesses the first endpoint causing null-ptr deref. Crashes in these 2 bzs are in the different places because of the different execution paths.
[ drivers/input/tablet/wacom_sys.c ]
static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id)
endpoint = &intf->cur_altsetting->endpoint.desc; <<< This is NULL
usb_rcvintpipe(dev, endpoint->bEndpointAddress), << 0-deref
wacom_sys_irq, wacom, endpoint->bInterval);
1c: 48 8b 45 b8 mov -0x48(%rbp),%rax // endpoint (==null)
20: 41 8b b7 88 00 00 00 mov 0x88(%r15),%esi
27: 49 8b 7f 60 mov 0x60(%r15),%rdi
>>2b:* 0f b6 50 02 movzbl 0x2(%rax),%edx // ->bEndpointAddress *BOOM*
2f: 0f b6 48 06 movzbl 0x6(%rax),%ecx // ->bInterval
The upstream driver was rebased and does not have this bug, so this bug is rhel7-only. The fix is to check the number of endpoints (as it was done in [aiptek] driver fix at http://www.spinics.net/lists/linux-input/msg42294.html, [aiptek] was based on [wacom]). Rhel7 patch follows.
Created attachment 1099056 [details]
CVEID was requested at: http://seclists.org/oss-sec/2016/q1/606
CVE-2016-3139 was assigned to this flaw, please, use it in the related communications, see http://seclists.org/oss-sec/2016/q1/623.
Thank you for reporting this flaw.
The Product Security has rated this flaw as having low security impact (bz1316993), so the patch currently is not planned to be added to the RHEL source trees. The upstream and Fedora is rebased, so the fix may get to the RHEL trees at the next USB subsystem code rebase.